CVE-2022-28366
📋 TL;DR
This CVE describes a denial-of-service vulnerability in Neko-based HTML parsers where crafted Processing Instruction (PI) input causes excessive heap memory consumption. It affects HtmlUnit-Neko up to version 2.26 and CyberNeko HTML up to version 1.9.22, which also impacts OWASP AntiSamy before version 1.6.6. Attackers can exploit this to crash affected applications by exhausting memory resources.
💻 Affected Systems
- HtmlUnit-Neko
- CyberNeko HTML
- OWASP AntiSamy
📦 What is this software?
Antisamy by Antisamy Project
Cyberneko Html by Cyberneko Html Project
Htmlunit by Htmlunit
⚠️ Risk & Real-World Impact
Worst Case
Complete service unavailability due to memory exhaustion leading to application crashes and potential system instability.
Likely Case
Denial of service affecting web applications using vulnerable parsers, causing temporary unavailability until services restart.
If Mitigated
Minimal impact with proper memory limits and monitoring in place, though service degradation may still occur.
🎯 Exploit Status
Exploitation requires sending crafted HTML with malicious Processing Instructions to vulnerable parsers.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: HtmlUnit-Neko 2.27, OWASP AntiSamy 1.6.6
Vendor Advisory: https://sourceforge.net/projects/htmlunit/files/htmlunit/2.27/
Restart Required: Yes
Instructions:
1. Identify affected applications using vulnerable parsers. 2. Update HtmlUnit-Neko to version 2.27 or later. 3. Update OWASP AntiSamy to version 1.6.6 or later. 4. Restart applications to apply changes.
🔧 Temporary Workarounds
Input Validation and Sanitization
allImplement strict input validation to reject or sanitize HTML containing Processing Instructions before parsing.
Memory Limit Configuration
allConfigure application memory limits and monitoring to detect and mitigate memory exhaustion attempts.
🧯 If You Can't Patch
- Implement web application firewalls (WAF) to block malicious HTML payloads.
- Isolate affected systems from untrusted networks and implement strict access controls.
🔍 How to Verify
Check if Vulnerable:
Check application dependencies for HtmlUnit-Neko versions ≤2.26 or CyberNeko HTML versions ≤1.9.22.
Check Version:
Check build configuration files (e.g., pom.xml, build.gradle) for dependency versions.
Verify Fix Applied:
Verify that HtmlUnit-Neko is updated to ≥2.27 and OWASP AntiSamy to ≥1.6.6 in dependency files.
📡 Detection & Monitoring
Log Indicators:
- Unusual memory consumption spikes
- Application crashes or restarts
- Errors related to HTML parsing failures
Network Indicators:
- Incoming HTTP requests with large or malformed HTML content
- Patterns of repeated requests to endpoints using HTML parsers
SIEM Query:
Search for logs containing 'OutOfMemoryError', 'heap exhaustion', or similar memory-related errors in application logs.
🔗 References
- https://github.com/nahsra/antisamy/releases/tag/v1.6.6
- https://search.maven.org/artifact/net.sourceforge.htmlunit/neko-htmlunit
- https://sourceforge.net/projects/htmlunit/files/htmlunit/2.27/
- https://github.com/nahsra/antisamy/releases/tag/v1.6.6
- https://search.maven.org/artifact/net.sourceforge.htmlunit/neko-htmlunit
- https://sourceforge.net/projects/htmlunit/files/htmlunit/2.27/