CVE-2022-35912
📋 TL;DR
CVE-2022-35912 is a critical remote code execution vulnerability in Grails' data binding component that allows attackers to gain access to the class loader and execute arbitrary code. This affects Grails applications running vulnerable versions when certain Java 8 configurations are used. Organizations using Grails for web applications are at risk of complete system compromise.
💻 Affected Systems
- Grails Framework
📦 What is this software?
Grails by Grails
Grails by Grails
Grails by Grails
Grails by Grails
⚠️ Risk & Real-World Impact
Worst Case
Complete system takeover with attacker gaining full control over the server, data exfiltration, lateral movement, and persistent backdoor installation.
Likely Case
Remote code execution leading to application compromise, data theft, and potential ransomware deployment.
If Mitigated
Limited impact with proper network segmentation, but still potential application-level compromise.
🎯 Exploit Status
The vulnerability is in the data binding component which is commonly used in web applications, making exploitation straightforward for attackers with knowledge of the vulnerability.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: Grails 3.3.15, 4.1.1, 5.1.9, or 5.2.1
Vendor Advisory: https://grails.org/blog/2022-07-18-rce-vulnerability.html
Restart Required: Yes
Instructions:
1. Identify Grails version. 2. Update to patched version: 3.3.15, 4.1.1, 5.1.9, or 5.2.1. 3. Update dependencies in build.gradle or pom.xml. 4. Rebuild and redeploy application. 5. Restart application server.
🔧 Temporary Workarounds
Disable automatic data binding
allConfigure Grails to disable automatic data binding for untrusted input sources
grails.databinding.enabled = false
grails.databinding.useSpringBinder = true
Input validation and sanitization
allImplement strict input validation and use whitelisting for data binding
// In controller: def save = { MyDomain obj -> obj.properties = params.subMap(['allowedField1', 'allowedField2'])}
🧯 If You Can't Patch
- Implement strict network segmentation and firewall rules to limit access to vulnerable applications
- Deploy web application firewall (WAF) with rules to detect and block exploitation attempts
🔍 How to Verify
Check if Vulnerable:
Check Grails version in application.properties or build.gradle. If version is before 3.3.15, 4.1.1, 5.1.9, or 5.2.1, the application is vulnerable.
Check Version:
grep 'app.grails.version' application.properties or check build.gradle dependencies
Verify Fix Applied:
Verify Grails version is 3.3.15, 4.1.1, 5.1.9, or 5.2.1 or higher. Test data binding functionality to ensure it works without allowing class loader access.
📡 Detection & Monitoring
Log Indicators:
- Unusual class loading patterns
- Suspicious data binding operations
- Unexpected Java reflection calls
- ClassLoader manipulation attempts
Network Indicators:
- HTTP requests with unusual parameter patterns attempting class loader access
- Exploitation attempts targeting /grails-databinding endpoints
SIEM Query:
source="application.log" AND ("ClassLoader" OR "data binding" OR "grails.databinding") AND (error OR exception OR suspicious)
🔗 References
- http://www.openwall.com/lists/oss-security/2022/07/20/4
- https://github.com/grails/grails-core/issues/12626
- https://github.com/grails/grails-core/security/advisories/GHSA-6rh6-x8ww-9h97
- https://grails.org/blog/2022-07-18-rce-vulnerability.html
- http://www.openwall.com/lists/oss-security/2022/07/20/4
- https://github.com/grails/grails-core/issues/12626
- https://github.com/grails/grails-core/security/advisories/GHSA-6rh6-x8ww-9h97
- https://grails.org/blog/2022-07-18-rce-vulnerability.html