Summary
TOTOLINK CA1200-PoE is a ceiling access point. Its web interface sends form actions to /cgi-bin/cstecgi.cgi as JSON with a topicurl field. The handler setting/recvUpgradeNewFw receives an upgrade request with an fwUrl value and writes that value into the shell command echo %s > /tmp/DlFileUrl before running it as root through the vendor CsteSystem wrapper. The value is not length limited, filtered or quoted, so a semicolon starts a second command. A client with a session can run commands as root on the access point.
Affected product
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
lib/cste_modules/ap.so, functionrecvUpgradeNewFwat0x64d8, parameterfwUrl.fwUrlread withwebsGetVarat0x6534;newSvnread at0x6554,acIpat0x6574,tSecondat0x6590,magicidat0x65b0.- Branch check: the running firmware SVN is the constant 3994, formatted at
0x65f4;strcmpwithnewSvnat0x6608;get_cs_update_flagat0x6638;atoioftSecondat0x6650. - Command built with
sprintfat0x6678, formatecho %s > /tmp/DlFileUrl. - Sink
CsteSystemat0x668c.CsteSystemislib/libcstelib.so0x78dcand executes/bin/shwith a -c argument.
Severity
The web interface 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
- The web pages post JSON to
/cgi-bin/cstecgi.cgiwith atopicurlfield.cstecgi.cgipasses it tolib/libmosquitto.so, which publishes it to the local broker./bin/cste_subloads/lib/cste_modules/*.so, calls eachmodule_init, and dispatches to the handler whose name matches the last topic segment.recvUpgradeNewFwis registered bymodule_initinap.so. - The handler reads
fwUrlwithwebsGetVarat0x6534.websGetVarreturns the JSON string value without a character filter. It comparesnewSvnwith the running SVN at0x6608; a different value takes the update branch.get_cs_update_flagat0x6638must not return 1; the flag file is absent on a fresh boot, so the branch is taken. - The handler formats
echo %s > /tmp/DlFileUrlwithfwUrlat0x6678and passes the result toCsteSystemat0x668c. The value is placed directly in a shell string with no quoting. A semicolon infwUrlends the echo command and starts the attacker's command under the same root shell. On the device the web chain runs as root; both accounts the image defines, root and nobody, have user ID 0. - After the echo the handler continues its upgrade work, including
forceupg; the injected command has already run. Themagicidparameter of the same handler reaches a second command through a different call (systemat0x66b8) and is reported separately. No extra service is needed and the handler is present in the default firmware.
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. 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 and handler 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, ran cstecgi.cgi under QEMU user-mode with the CGI environment and the JSON body on standard input, and ran the local broker and the cste_sub binary so the handler executed in the real module. The equivalent HTTP request is:
POST /cgi-bin/cstecgi.cgi HTTP/1.1
Host: <device>
Cookie: SESSION_ID=<session>
Content-Type: application/json
Content-Length: <body length>
Connection: close
{"topicurl":"setting/recvUpgradeNewFw","fwUrl":"x;touch /tmp/pwned;","newSvn":"1","acIp":"<device>","tSecond":"0","magicid":"abcd"}With this value the handler builds echo x;touch /tmp/pwned; > /tmp/DlFileUrl and passes it to CsteSystem. In the test run the touch target was a marker file in the test folder, and it was created. The subscriber log shows the echoed x, which the control log does not show, and then, as in the control run, that forceupg, which the handler goes on to call, is not installed in the emulation container. The CGI did not return within the test timeout, in the control run and the test run alike; the marker is created before that. 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 the same way.
Control
The same request with fwUrl set to an ordinary URL and the same newSvn, acIp, tSecond and magicid values created no marker. By code reading, a newSvn equal to the running SVN takes the no-update branch and never reaches the echo command; that branch was not shown at run time.
Test environment
Tested with the vendor's own binaries 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. The configuration library libapmib.so was stubbed because the emulation container has no flash device. The web server and the CGI could not be run together in emulation, so this proof covers the CGI and handler half: cstecgi.cgi, the local broker and subscriber, and the real ap.so handler. The lighttpd-to-CGI spawn was not shown. 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.
Recommended fix
Do not build a shell command from fwUrl. Parse it as a URL with an expected scheme and character set, reject semicolons and other shell metacharacters, and pass it to the download tool with a fixed argument vector. Apply the same check to the other fields used by this handler.
Timeline
- Reported to the vendor by email
- Submitted to VulDB with a CVE request
- CVE assigned as CVE-2026-144991, VulDB entry VDB-449768 published; the entry covers both the fwUrl and the magicid parameter of this function, so it also carries AA-2026-004
Related advisories
- AA-2026-001 TOTOLINK CA1200-PoE: authentication bypass in formLoginAuth (authCode)
- AA-2026-004 TOTOLINK CA1200-PoE: command injection in recvUpgradeNewFw (magicid)