PT-2013-63: Hash Length Extension in HTMLPurifier

(PT-2013-63) Positive Technologies Security Advisory
Hash Length Extension in HTMLPurifier

Vulnerable software

Version: 4.5.0 and earlier


Severity level

Severity level: Medium
Impact: Signature Forgery, Arbitrary Value Injection into Signed Data
Access Vector: Remote

CVSS v2:
Base Score: 5.0
Vector: (AV:N/AC:L/Au:N/C:N/I:P/A:N)

CVE: not assigned

Software description

HTML Purifier is a standards-compliant HTML filter library written in PHP.

Vulnerability description

The specialists of the Positive Research center have detected a vulnerability in HTMLPurifier that allows attackers to carry out a "Hash Length Extension" attack..

Class HTMLPurifier_URIFilter_Munge implements a URI filter that replaces all links with a formatted URL, for example, it can be used to rewrite links to pass them into redirection script. To prevent links from being altered HTMLPurifier allows specifying a secret key via "URI.MungeSecretKey" configuration directive. However, this signature generation method is susceptible to a hash length extension attack.

The vulnerability allows attackers to append an arbitrary value to the signed data without knowing the secret key. This may cause other vulnerabilities in the web applications, which use signature generated by HTMLPurifier to keep the links from being altered.

How to fix

Update your software up to the latest version

Advisory status

03.09.2013 - Vendor gets vulnerability details
30.11.2013 - Vendor releases fixed version and details 
04.12.2013 - Public disclosure


The vulnerability was detected by Arseny Reutov, Positive Research Center (Positive Technologies Company)


Reports on the vulnerabilities previously discovered by Positive Research:

About Positive Technologies

Positive Technologies is among the key players in the IT security market in Russia.

The principal activities of the company include the development of integrated tools for information security monitoring (MaxPatrol); providing IT security consulting services and technical support; development of the Securitylab leading Russian information security portal.

Among the clients of Positive Technologies, there are more than 40 state enterprises, more than 50 banks and financial organizations, 20 telecommunication companies, more than 40 plant facilities, as well as IT, service and retail companies from Russia, the CIS countries, the Baltic States, China, Ecuador, Germany, Great Britain, Holland, Iran, Israel, Japan, Mexico, the Republic of South Africa, Thailand, Turkey, and the USA.

Positive Technologies is a team of highly skilled developers, advisers and experts with years of vast hands-on experience. The company specialists possess professional titles and certificates; they are the members of various international societies and are actively involved in the IT security field development.