CVE-2009-4142

PHP < 5.2.12 - Cross-Site Scripting via Improper UTF-8 and Multi-byte Sequence Handling

Title source: llm
STIX 2.1

Exploitation Summary

EIP tracks 2 public exploits for CVE-2009-4142. PoCs published by [email protected].

AI-analyzed exploit summary This exploit demonstrates a cross-site scripting (XSS) vulnerability in PHP versions prior to 5.2.12 due to improper sanitization of user-supplied input when using the Shift_JIS charset. The PoC shows how an attacker can inject malicious JavaScript into a web page via crafted GET parameters.

Description

The htmlspecialchars function in PHP before 5.2.12 does not properly handle (1) overlong UTF-8 sequences, (2) invalid Shift_JIS sequences, and (3) invalid EUC-JP sequences, which allows remote attackers to conduct cross-site scripting (XSS) attacks by placing a crafted byte sequence before a special character.

Exploits (2)

exploitdb WORKING POC VERIFIED
by [email protected] · phpremotephp
https://www.exploit-db.com/exploits/33415

This exploit demonstrates a cross-site scripting (XSS) vulnerability in PHP versions prior to 5.2.12 due to improper sanitization of user-supplied input when using the Shift_JIS charset. The PoC shows how an attacker can inject malicious JavaScript into a web page via crafted GET parameters.

Classification
Working Poc 90%
Attack Type
Xss
Complexity
Trivial
Reliability
Reliable
Target: PHP < 5.2.12
No auth needed
Prerequisites: A web application running a vulnerable version of PHP that processes user input with Shift_JIS charset
MITRE ATT&CK
devstral-2 · analyzed Feb 16, 2026 Full analysis →
exploitdb WORKING POC VERIFIED
by [email protected] · phpremotephp
https://www.exploit-db.com/exploits/33414

This exploit demonstrates a cross-site scripting (XSS) vulnerability in PHP versions prior to 5.2.12 due to improper sanitization of user-supplied input with malformed UTF-8, Shift_JIS, and EUC-JP sequences. The PoC shows how `htmlspecialchars` fails to properly escape these sequences, allowing arbitrary script execution in a user's browser context.

Classification
Working Poc 90%
Attack Type
Xss
Complexity
Trivial
Reliability
Reliable
Target: PHP < 5.2.12
No auth needed
Prerequisites: A vulnerable PHP version (< 5.2.12) · A context where user input is reflected in HTML output
MITRE ATT&CK
devstral-2 · analyzed Feb 16, 2026 Full analysis →

References (15)

Core 15
Core References
Release Notes x_refsource_confirm
http://www.php.net/releases/5_2_12.php
Exploit vdb-entry x_refsource_bid
http://www.securityfocus.com/bid/37389
Various Sources x_refsource_confirm
http://bugs.php.net/bug.php?id=49785
Third Party Advisory third-party-advisory x_refsource_secunia
http://secunia.com/advisories/40262
Mailing List vendor-advisory x_refsource_hp
http://marc.info/?l=bugtraq&m=127680701405735&w=2
Exploit vdb-entry x_refsource_sectrack
http://securitytracker.com/id?1023372
Vendor Advisory third-party-advisory x_refsource_secunia
http://secunia.com/advisories/37821
Third Party Advisory third-party-advisory x_refsource_secunia
http://secunia.com/advisories/38648
Mailing List vendor-advisory x_refsource_apple
http://lists.apple.com/archives/security-announce/2010//Mar/msg00001.html
Patch x_refsource_confirm
http://www.php.net/ChangeLog-5.php
Third Party Advisory, VDB Entry vdb-entry signature x_refsource_oval
https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A7085
Third Party Advisory, VDB Entry vdb-entry signature x_refsource_oval
https://oval.cisecurity.org/repository/search/definition/oval%3Aorg.mitre.oval%3Adef%3A10005
Vendor Advisory x_refsource_confirm
http://support.apple.com/kb/HT4077
Vendor Advisory vdb-entry x_refsource_vupen
http://www.vupen.com/english/advisories/2009/3593
Third Party Advisory vendor-advisory x_refsource_debian
http://www.debian.org/security/2010/dsa-2001

Scores

EPSS 0.1695
EPSS Percentile 95.1%

Details

CWE
CWE-79
Status published
Products (35)
php/php 1.0
php/php 2.0
php/php 2.0b10
php/php 3.0
php/php 3.0.1
php/php 3.0.2
php/php 3.0.3
php/php 3.0.4
php/php 3.0.5
php/php 3.0.6
... and 25 more
Published Dec 21, 2009
Tracked Since Feb 18, 2026