Executive summaryTeracom TCW122B-CM firmware before 4.07 contains a predictable session cookie vulnerability that allows unauthenticated remote attackers to hijack administrator sessions by guessing tick-counter-derived cookies. Attackers can predict or brute-force the 32-bit cookie from device uptime and login timing to control relays, settings, and administrator credentials.
Description
The session cookie is a sequence of 8 hexadecimal characters (32 bits). It is not random: it is derived from a hardware tick of the microcontroller, tied to the system time.
Example of successive cookies observed:
Figure 1 :
The value increases monotonically and regularly over time, so cookies issued right after a known one can be guessed.
Risk
- Prediction or bruteforce of the administrator's cookie, leading to session hijacking.
- Search space reduced from tens of millions of possibilities to fewer than 6,000 requests, testable in 1 to 2 minutes depending on the network (PoC result).
- Exploitation is easier if the attacker controls or knows the device's time (see scenario).
Attack scenario
- The attacker positions themselves on the local network or on the path to the device.
- They manipulate or observe time synchronization (the configured NTP server is pool.ntp.org) via ARP MitM or DNS spoofing, in order to learn the module's internal time.
- They derive the range of possible cookies for the admin session.
- They test these ~6,000 values within minutes until a valid session is found.
- They access the administration interface, then retrieve the passwords (vuln. #1) and modify the configuration.