PT-2013-63: Hash Length Extension in HTMLPurifier

Vulnerable software

HTMLPurifier
Version: 4.5.0 and earlier

Link:
http://htmlpurifier.org/

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

Credits

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

References

http://en.securitylab.ru/lab/PT-2013-63

Reports on the vulnerabilities previously discovered by Positive Research:

http://www.ptsecurity.com/research/advisory/
http://en.securitylab.ru/lab/