CVE-2024-35538
Executive Summary
CVE-2024-35538 is a Client IP Spoofing vulnerability in Typecho v1.3.0, a popular open-source blogging platform. The flaw allows an unauthenticated attacker to falsify their IP address by injecting arbitrary values into the X-Forwarded-For or Client-Ip HTTP headers. This can be exploited to bypass IP-based access controls, logging, and rate-limiting mechanisms, potentially enabling further attacks such as brute-force attempts or privilege escalation. The vulnerability has a CVSS score of 0.0 (pending official assessment), but based on the vector, it is considered low severity with a high attack surface due to the lack of authentication required. No official patch has been released, and no public exploit code is available, though the technique is well-documented.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
Typecho is a PHP-based application distributed via GitHub and its official website. The vulnerability exists in the core application code, not in any third-party package. Users should verify the integrity of their installation and monitor for updates from the vendor.
CVSS Breakdown & Threat Level
- Attack Vector (AV): Network (N) – Exploitable remotely.
- Attack Complexity (AC): Low (L) – No special conditions required.
- Privileges Required (PR): None (N) – No authentication needed.
- User Interaction (UI): None (N) – No user action required.
- Scope (S): Unchanged (U) – Impact confined to the vulnerable component.
- Confidentiality (C): None (N) – No data disclosure.
- Integrity (I): Low (L) – IP-based controls can be bypassed.
- Availability (A): None (N) – No denial of service.
Threat Level: Low (CVSS 3.1 base score ~3.5). However, the risk is elevated in environments relying on IP-based authentication or logging for security decisions.
Deep Dive & Mechanics
The vulnerability stems from Typecho's improper handling of HTTP headers used for client IP identification. The application trusts the X-Forwarded-For and Client-Ip headers without validation, allowing an attacker to set these headers to any arbitrary IP address. This is a classic case of CWE-348 (Use of Less Trusted Source). The affected code likely resides in the IP retrieval function, which directly reads from $_SERVER['HTTP_X_FORWARDED_FOR'] or $_SERVER['HTTP_CLIENT_IP'] without verifying the source.
Attack Scenario:
- An attacker sends an HTTP request to a Typecho instance with a spoofed
X-Forwarded-For: 192.168.1.100header. - The application logs the attacker's IP as
192.168.1.100instead of the real IP. - If IP-based access controls (e.g., admin panel restrictions) are in place, the attacker can bypass them by spoofing a whitelisted IP.
- The attacker can also evade rate-limiting or brute-force detection mechanisms that rely on IP tracking.
Vulnerable vs. Patched Code
Vulnerable Code (Typecho v1.3.0):
// In a function like getIp()
function getIp() {
if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
return $_SERVER['HTTP_CLIENT_IP'];
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
return $_SERVER['REMOTE_ADDR'];
}
}
Patched Code (Recommended Fix):
function getIp() {
// Only trust REMOTE_ADDR as it cannot be spoofed by the client
return $_SERVER['REMOTE_ADDR'];
}
Alternatively, if proxy support is required, validate against a trusted proxy list:
function getIp() {
$trustedProxies = ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'];
if (in_array($_SERVER['REMOTE_ADDR'], $trustedProxies)) {
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
return $_SERVER['HTTP_X_FORWARDED_FOR'];
}
}
return $_SERVER['REMOTE_ADDR'];
}
Exploitation & Lab Setup
Red Team
Prerequisites: A Typecho v1.3.0 instance accessible over HTTP.
Exploitation Steps:
- Identify the target Typecho installation (e.g., via Shodan dork
http.title:"Typecho"). - Send a crafted HTTP request with spoofed headers:
curl -H "X-Forwarded-For: 10.0.0.1" -H "Client-Ip: 10.0.0.1" http://target.com/admin/login.php - If the admin panel restricts access to a specific IP range (e.g., 10.0.0.0/8), the attacker can bypass it by spoofing an IP in that range.
- For brute-force attacks, spoof a different IP for each request to evade rate-limiting:
for i in {1..100}; do curl -H "X-Forwarded-For: 192.168.1.$i" -d "username=admin&password=test" http://target.com/login.php done
No public exploit code is available; the above demonstrates the technique.
Blue Team
Detection:
- Monitor for multiple requests with varying
X-Forwarded-FororClient-Ipheaders from the same source IP. - Alert on requests where the
REMOTE_ADDRdoes not match the forwarded IP (unless behind a trusted proxy). - Use WAF rules to block requests with suspicious or non-standard IP headers.
Honeypot: Deploy a fake Typecho instance and log all X-Forwarded-For and Client-Ip headers for analysis.
Indicators of Compromise (IOCs)
- Network IOCs:
- HTTP requests with
X-Forwarded-FororClient-Ipheaders containing private or reserved IP addresses (e.g., 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16). - Multiple requests from the same source IP with different
X-Forwarded-Forvalues.
- HTTP requests with
- Log IOCs:
- Server access logs showing mismatches between
REMOTE_ADDRandX-Forwarded-Forvalues. - Admin panel login attempts from IPs that should not have access.
- Server access logs showing mismatches between
Detection Engineering
YARA Rule
rule CVE_2024_35538_Client_IP_Spoofing {
meta:
description = "Detects Typecho v1.3.0 Client IP Spoofing attempts"
author = "Valters IT"
date = "2025-04-17"
reference = "CVE-2024-35538"
strings:
$header1 = "X-Forwarded-For"
$header2 = "Client-Ip"
$ip_pattern = /(?:10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})/
condition:
any of ($header*) and $ip_pattern
}
Sigma Rule
title: Typecho Client IP Spoofing Attempt
id: 7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d
status: experimental
description: Detects attempts to exploit CVE-2024-35538 by spoofing X-Forwarded-For or Client-Ip headers
author: Valters IT
logsource:
category: webserver
product: apache
service: access
detection:
selection:
cs-uri-query|contains:
- "X-Forwarded-For"
- "Client-Ip"
condition: selection
falsepositives:
- Legitimate proxy usage
level: medium
Suricata Rule
alert http any any -> any any (msg:"CVE-2024-35538 Typecho Client IP Spoofing Attempt"; flow:to_server; content:"X-Forwarded-For"; http_header; pcre:"/X-Forwarded-For:\s*(?:10\.\d{1,3}\.\d{1,3}\.\d{1,3}|172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}|192\.168\.\d{1,3}\.\d{1,3})/i"; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Apply the patch: Modify the IP retrieval function to only trust
REMOTE_ADDR(see patched code above). - Update Typecho: Monitor the official repository for a security release and upgrade immediately.
- WAF Rules: Block requests with
X-Forwarded-FororClient-Ipheaders unless from trusted proxies. - Logging: Enable detailed logging of all HTTP headers for forensic analysis.
Long-Term Measures:
- Implement IP validation using a trusted proxy list if reverse proxies are used.
- Use CAPTCHA or multi-factor authentication to reduce reliance on IP-based controls.
- Conduct regular security audits of custom code.
Valters IT
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.