| Название | TOTOLINK CA1200-PoE 5.9c.3994_B20190326 Command Injection in NTPSyncWithHost |
|---|
| Описание | SUMMARY
TOTOLINK CA1200-PoE is a ceiling access point. Its web interface sends form actions as JSON to /cgi-bin/cstecgi.cgi with a topicurl field. The handler setting/NTPSyncWithHost sets the device clock from a hostTime value. The handler copies that value into the shell command date -s "%s" and runs it as root through the vendor CsteSystem wrapper. The value is not length limited, filtered or quoted, so a double quote followed by a semicolon 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:
- lib/cste_modules/system.so, function NTPSyncWithHost at 0x3b6c, parameter hostTime.
- Request value read with websGetVar at 0x3bb8; the key string hostTime is at file offset 0x4b2c.
- Command built with sprintf at 0x3ca4; the format date -s "%s" is loaded at 0x3c9c (string at file offset 0x4b78).
- Sink CsteSystem at 0x3cb8. CsteSystem is lib/libcstelib.so 0x78dc and forks, then executes /bin/sh with a -c argument.
CVSS: CVSS:3.1/AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (8.8). 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
1. The web pages post JSON to /cgi-bin/cstecgi.cgi with a topicurl field. cstecgi.cgi passes it to lib/libmosquitto.so, which publishes it to the local broker. /bin/cste_sub loads /lib/cste_modules/*.so, calls each module_init, and dispatches to the handler whose name matches the last topic segment. NTPSyncWithHost is registered by module_init in system.so.
2. NTPSyncWithHost reads hostTime with websGetVar at 0x3bb8. websGetVar returns the JSON string value without a character filter. The handler calls sprintf at 0x3ca4 with the format string loaded at 0x3c9c, then calls CsteSystem at 0x3cb8. There is no check on length and no quoting beyond the two double quotes in the format string. On the device the web chain runs as root; both accounts the image defines, root and nobody, have user ID 0.
3. Because the format is date -s "%s", a value that contains a double quote closes the quoted argument, and a semicolon after that starts a new command under the same root shell. The rest of the original format is harmless after the injection. The handler continues to its normal response.
4. The page /web_cste/adm/ntp.asp uses this handler at line 213; no extra service is needed.
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 cste_sub so the real module handled the request. 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: 76
Connection: close
{"topicurl":"setting/NTPSyncWithHost","hostTime":"x\"; touch /tmp/pwned; #"}
The CGI returned 200 with a JSON body containing "success": true. The handler built date -s "x"; touch /tmp/pwned; #" and passed it to CsteSystem. The marker file /tmp/pwned was created and the subscriber log showed the command executed. The handler's 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 double quote, semicolon and comment character the same way.
CONTROL
The same request with a normal timestamp returned 200 and created no marker. Only the value with the quote and semicolon created the marker.
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 system.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.
FIX
Do not build a shell command from hostTime. Validate it against a strict date format with a length limit, and call the system time function directly or execute date with a fixed argument vector. Reject any value that contains quotes, whitespace beyond the expected separator, semicolons or other shell metacharacters.
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) |
|---|
| Источник | ⚠️ https://www.appattic.com/cyber/advisories/aa-2026-002 |
|---|
| Пользователь | traianturcu (UID 103053) |
|---|
| Представление | 15.11.2026 19:28 (19 дни назад) |
|---|
| Модерация | 04.12.2026 15:34 (19 days later) |
|---|
| Статус | принято |
|---|
| Запись VulDB | 449767 [TOTOLINK CA1200-PoE 5.9c.3994_B20190326 system.so NTPSyncWithHost hostTime эскалация привилегий] |
|---|
| Баллы | 20 |
|---|