Skip to content
RCE Write-up Advanced

CVE-2019-12103 – Analysis of a Pre-Auth RCE on the TP-Link M7350, with Ghidra!

The TP-Link M7350 router's web interface passed the user-supplied 'language' parameter directly into a shell command via popen, allowing an unauthenticated attacker to execute arbitrary commands. This could be exploited remotely by someone on the same network or via cross-site request forgery from a malicious webpage.

pentestpartners.com

Published on pentestpartners.com

The TP-Link M7350 (V3) is affected by a pre-authentication (CVE-2019-12103), and a few post-authentication (CVE-2019-12104) command injection vulnerabilities. These injections can be exploited remotely, if the attacker is on the same LAN or otherwise able to get access to the router web interface.

PTP Admin, on pentestpartners.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The application passed user-controlled input directly into a shell command without sanitisation, allowing command injection.

Impact

An attacker on the same LAN or able to reach the router's web interface could execute arbitrary commands without authentication; additionally, a malicious webpage could exploit this via CSRF to run code on the router.

What the attacker needed

Attacker on same LAN or able to reach web interface; or victim visits a malicious webpage (CSRF)

How it was found

  1. Send a POST request to the /cgi-bin/qcmap_web_cgi endpoint with a JSON body containing module 'webServer', action 1, and a malicious language value.
  2. The language value is inserted into a shell command string and executed via popen.
  3. The command runs with the privileges of the web server, allowing remote code execution.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

The router's web page had a feature that let you change the display language. The code took whatever you typed for the language and ran it as a system command without checking it. So an attacker could type a command instead of a language, and the router would run it, giving the attacker control of the device.

What is RCE?

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.