Enviar #1097371: TOTOLINK CA1200-PoE 5.9c.3994_B20190326 Command Injection in downloadFlile query stringinformación

TítuloTOTOLINK CA1200-PoE 5.9c.3994_B20190326 Command Injection in downloadFlile query string
DescripciónSUMMARY TOTOLINK CA1200-PoE is a ceiling access point. Its web root contains a CGI program, downloadFlile.cgi, that the lighttpd configuration serves at /cgi-bin/downloadFlile.cgi and also at /api/updater/<value> through a rewrite rule. The program reads the raw query string and formats the shell command echo QUERY_STRING:%s >/tmp/download with the entire string, then runs it through the vendor CsteSystem wrapper. It does not URL-decode or filter the value, so a semicolon in the query starts a second command. A client with a session can run commands as root on the access point. CLASS: Command Injection (CWE-78) AFFECTED: TOTOLINK CA1200-PoE, firmware 5.9c.3994_B20190326, the latest public image. Image file TOTOLINK_C8B180A-1G_CA1200-POE_AP0167_8197F_SPI_8M128M_V5.9c.3994_B20190326_ALL.web, sha256 32e7da327263979568ccbe98c23acd530a5387667e18e6bc888613b249cd1c4e. AFFECTED FILES AND PARAMETERS: - web_cste/cgi-bin/downloadFlile.cgi (MIPS uClibc, stripped), parameter QUERY_STRING. - The CGI reads QUERY_STRING at string file offset 0x1f68 and formats echo QUERY_STRING:%s >/tmp/download at file offset 0x1f78. - The command wrapper prints [system]: %s at file offset 0x1eac and executes /bin/sh at file offset 0x1ebc. - Route: /cgi-bin/downloadFlile.cgi, and the rewrite ^/api/updater/(.+)$ to /cgi-bin/downloadFlile.cgi?updater=$1 in /lighttp/lighttpd.conf. CVSS: CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (8.8). The web server listens on the LAN side; a session is obtainable with no password (reported separately); by code reading the session check runs after the CGI; the result is root command execution on the access point. DETAILS 1. The vendor lighttpd serves the web root /web_cste and executes CGI programs under /cgi-bin. The configuration file /lighttp/lighttpd.conf contains the rewrite ^/api/updater/(.+)$ to /cgi-bin/downloadFlile.cgi?updater=$1, so both /cgi-bin/downloadFlile.cgi and /api/updater/<value> reach the program by configuration; the proof used the query string of the first form. 2. The program reads getenv("QUERY_STRING") and formats the whole string into echo QUERY_STRING:%s >/tmp/download, then passes it to the command wrapper, which executes /bin/sh -c. There is no conversion and no filter. 3. The value is not URL-decoded, so %20 and %23 reach the shell as literal text and do not work as a space or comment. A client cannot put a raw space or comment character in the request line, so the shell variable IFS supplies whitespace: appID=1;touch${IFS}/tmp/pwned; ends the echo with a semicolon, runs touch with an IFS-separated path, and leaves the trailing >/tmp/download, which is harmless. 4. The program has no authentication code of its own; the only web gate is the lighttpd session check, which by code reading runs when the response is written. The proof covers the CGI half with the environment and query string the web server passes. On the device the web server and its CGI programs run as root; both accounts the image defines, root and nobody, have user ID 0. LOGIN REQUIREMENT A session can be obtained with no password through formLoginAuth, reported separately. With the vendor lighttpd binary under a minimal test configuration (not the vendor configuration file), a POST to /cgi-bin/cstecgi.cgi with no cookie was handed to the CGI module with no redirect, and the CGI start then failed under emulation (status 500). The same request with a session cookie gave the same result, and a protected page with no cookie was redirected. That gate test used cstecgi.cgi; downloadFlile.cgi is started by the same CGI module. The start attempt is observed; by code reading the session check runs after the CGI: lighttpd userloginAuth is called from http_response_write_header at 0x408a88, after the CGI has run. The vendor configuration file loads mod_auth, but every auth directive in it is commented out. The end-to-end side effect through the web server was not shown, so this proof covers the CGI half with the same request a client sends. I do not claim the pre-authentication path as proven end to end. PROOF I extracted the public image and ran the vendor downloadFlile.cgi under QEMU user-mode with the CGI environment variables and the raw query string. The request as a client sends it is: GET /cgi-bin/downloadFlile.cgi?appID=1;touch${IFS}/tmp/pwned; HTTP/1.1 Host: <device> Connection: close When using curl, pass the option -g so the braces are sent literally instead of being treated as a URL glob. With this query the program formats echo QUERY_STRING:appID=1;touch${IFS}/tmp/pwned; >/tmp/download and passes it to the shell. In the test run the touch target was a marker file in the test folder; the shell expanded IFS and created it, and the program returned 200. The run's log also shows a shell syntax error, an unterminated quoted string. It matches one of the program's own later commands, echo Couldn't find to upgrade the firmware >>/tmp/download at file offset 0x2018, whose apostrophe is unbalanced; that line gives the same error in a shell on its own, and it runs after the injected command. The command string reached the shell unchanged. The shell observed in emulation was the container's shell; the firmware's /bin/sh is busybox and treats the semicolon and IFS the same way. CONTROL An ordinary query, appID=1&versionId=2&path=/fw&fileName=fw.bin, created no marker, and neither did the query appID=1 alone. Both control runs end in a segmentation fault under emulation; the cause was not determined, and the negative run and the injected run complete. A negative test with the percent-encoded form, appID=1;touch%20<marker>;%23, also created no marker: the shell reported the literal touch%20 and %23 as commands that do not exist. TEST ENVIRONMENT Tested with the vendor's own binary taken from the public firmware image TOTOLINK_C8B180A-1G_CA1200-POE_AP0167_8197F_SPI_8M128M_V5.9c.3994_B20190326_ALL.web (sha256 32e7da327263979568ccbe98c23acd530a5387667e18e6bc888613b249cd1c4e), run under QEMU user-mode emulation. This proof covers the CGI half: downloadFlile.cgi was run directly with the CGI environment and the raw query string that the web server passes. The lighttpd-to-CGI spawn was not shown because the web server and the CGI could not be run together in emulation. The configuration library was not used in this proof. The device was not tested. IMPACT A root command runs on the access point. The attacker can read stored administrator and Wi-Fi credentials, change the wireless configuration and the admin password, use the device as a LAN foothold, and persist through the configuration store. The access point is the network edge, so control of it exposes the traffic and the internal network. FIX Do not pass the raw query string to a shell. Parse the fields the updater needs, accept only an expected character set for each, reject shell metacharacters, and write the diagnostic text with a direct file write. The same rule applies to the second echo command in this program that includes the parsed appId, versionId, path and fileName fields. VENDOR CONTACT The vendor was notified by email on 2026-11-15, before this submission. No CVE has been assigned or requested elsewhere. FINDER: Traian Turcu (App Attic)
Fuente⚠️ https://www.appattic.com/cyber/advisories/aa-2026-006
Usuario traianturcu (UID 103053)
Sumisión2026-11-15 19:44 (hace 19 días)
Moderación2026-12-04 15:35 (19 days later)
EstadoAceptado
Entrada de VulDB449770 [TOTOLINK CA1200-PoE 5.9c.3994_B20190326 downloadFlile.cgi QUERY_STRING escalada de privilegios]
Puntos20

Want to know what is going to be exploited?

We predict KEV entries!