CVE-2017-5641
📋 TL;DR
Apache Flex BlazeDS versions 4.7.2 and earlier have insecure default AMF(X) object deserialization that allows arbitrary code execution. Attackers can exploit this to achieve remote code execution by sending specially crafted serialized objects. This affects any system running vulnerable versions of Apache Flex BlazeDS with AMF(X) endpoints exposed.
💻 Affected Systems
- Apache Flex BlazeDS
📦 What is this software?
⚠️ Risk & Real-World Impact
Worst Case
Complete system compromise via remote code execution, allowing attackers to execute arbitrary commands, install malware, or pivot to other systems.
Likely Case
Remote code execution leading to data theft, system manipulation, or deployment of ransomware/malware.
If Mitigated
Denial of service or limited information disclosure if proper input validation and type restrictions are implemented.
🎯 Exploit Status
Multiple exploit chains exist using Java standard library and third-party libraries. Metasploit modules are available.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 4.7.3 and later
Vendor Advisory: https://issues.apache.org/jira/browse/FLEX-35290
Restart Required: Yes
Instructions:
1. Upgrade to Apache Flex BlazeDS 4.7.3 or later. 2. Replace the blazeDS JAR files with patched versions. 3. Restart the application server. 4. Verify the fix by checking the version.
🔧 Temporary Workarounds
Implement type filtering
allConfigure BlazeDS to restrict allowed types during deserialization
Configure allowed-types in services-config.xml: <serialization><allow-types><type>allowed.package.*</type></allow-types></serialization>
Network segmentation
linuxRestrict access to AMF(X) endpoints using firewalls or network controls
iptables -A INPUT -p tcp --dport [AMF_PORT] -s [TRUSTED_IPS] -j ACCEPT
iptables -A INPUT -p tcp --dport [AMF_PORT] -j DROP
🧯 If You Can't Patch
- Implement strict input validation and sanitization for all AMF(X) endpoints
- Deploy web application firewall (WAF) with rules to detect and block serialization attacks
🔍 How to Verify
Check if Vulnerable:
Check the BlazeDS version in JAR files or configuration. Versions 4.7.2 or earlier are vulnerable.
Check Version:
java -cp blazeds-core.jar org.apache.flex.blazeds.Version
Verify Fix Applied:
Verify the application is using BlazeDS 4.7.3 or later and test AMF(X) endpoints with known exploit payloads.
📡 Detection & Monitoring
Log Indicators:
- Unusual Java deserialization errors
- Stack traces containing 'java.io.ObjectInputStream'
- Unexpected class loading in logs
Network Indicators:
- AMF(X) traffic containing serialized Java objects with suspicious class names
- Unusual traffic patterns to AMF endpoints
SIEM Query:
source="*blazeds*" AND ("ObjectInputStream" OR "readObject" OR "ClassNotFoundException")
🔗 References
- http://mail-archives.apache.org/mod_mbox/flex-dev/201703.mbox/%3C6B86C8D0-6E36-48F5-AC81-4AB3978F6746%40c-ware.de%3E
- http://www.securityfocus.com/bid/97383
- http://www.securitytracker.com/id/1038273
- https://issues.apache.org/jira/browse/FLEX-35290
- https://support.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbhf03823en_us
- https://www.kb.cert.org/vuls/id/307983
- https://www.zerodayinitiative.com/advisories/ZDI-22-506/
- https://www.zerodayinitiative.com/advisories/ZDI-22-507/
- http://mail-archives.apache.org/mod_mbox/flex-dev/201703.mbox/%3C6B86C8D0-6E36-48F5-AC81-4AB3978F6746%40c-ware.de%3E
- http://www.securityfocus.com/bid/97383
- http://www.securitytracker.com/id/1038273
- https://issues.apache.org/jira/browse/FLEX-35290
- https://support.hpe.com/hpsc/doc/public/display?docLocale=en_US&docId=emr_na-hpesbhf03823en_us
- https://www.kb.cert.org/vuls/id/307983
- https://www.zerodayinitiative.com/advisories/ZDI-22-506/
- https://www.zerodayinitiative.com/advisories/ZDI-22-507/