CVE-2021-35368
📋 TL;DR
This vulnerability allows attackers to bypass ModSecurity Core Rule Set request body inspection by appending a trailing pathname to requests. This affects web applications using vulnerable CRS versions, potentially allowing malicious payloads to reach backend applications.
💻 Affected Systems
- OWASP ModSecurity Core Rule Set
📦 What is this software?
Fedora by Fedoraproject
Fedora by Fedoraproject
⚠️ Risk & Real-World Impact
Worst Case
Attackers can bypass all request body inspection rules, potentially delivering SQL injection, XSS, RCE, or other payloads directly to vulnerable applications.
Likely Case
Attackers bypass specific security controls, enabling injection attacks that would normally be blocked by CRS rules.
If Mitigated
With proper patching and defense-in-depth controls, impact is limited as other security layers may still detect malicious activity.
🎯 Exploit Status
Exploitation requires appending a trailing pathname to bypass request body parsing.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 3.1.2, 3.2.1, or 3.3.2
Vendor Advisory: https://coreruleset.org/20210630/cve-2021-35368-crs-request-body-bypass/
Restart Required: Yes
Instructions:
1. Update CRS to patched version. 2. Restart web server/ModSecurity. 3. Verify rules are loading correctly.
🔧 Temporary Workarounds
Custom Rule to Block Trailing Pathnames
allAdd custom ModSecurity rule to detect and block requests with trailing pathnames used for bypass.
SecRule REQUEST_URI "@rx \\.\\.?/" "id:999999,phase:1,deny,status:400,msg:'Potential CRS bypass attempt'"
SecRule REQUEST_URI "@rx /[^/]+/\\.\\.?/" "id:999998,phase:1,deny,status:400,msg:'Potential CRS bypass attempt'"
SecRule REQUEST_URI "@rx /[^/]+/[^/]+/\\.\\.?/" "id:999997,phase:1,deny,status:400,msg:'Potential CRS bypass attempt'"
🧯 If You Can't Patch
- Implement WAF with updated CRS rules in front of vulnerable system
- Deploy additional application-layer security controls and monitoring
🔍 How to Verify
Check if Vulnerable:
Check CRS version in ModSecurity configuration or rule files. Look for version numbers in the affected ranges.
Check Version:
grep -r "OWASP_CRS" /etc/modsecurity/ or check rule files for version headers
Verify Fix Applied:
Verify CRS version is 3.1.2, 3.2.1, or 3.3.2 or higher. Test with known bypass payloads to confirm blocking.
📡 Detection & Monitoring
Log Indicators:
- Requests with unusual trailing pathnames (e.g., /path/../)
- ModSecurity rule bypass alerts
- Increased blocked requests after patch
Network Indicators:
- HTTP requests containing /../ or /./ patterns in unusual positions
- Requests that bypass expected WAF filtering
SIEM Query:
source="modsecurity" AND ("bypass" OR "/../" OR "/./")
🔗 References
- https://coreruleset.org/20210630/cve-2021-35368-crs-request-body-bypass/
- https://lists.debian.org/debian-lts-announce/2023/01/msg00033.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6MS5GMNYHFFIBWLJW7N3XAD24SLF3PFZ/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IVYUJOKHDEXFTM2CZMEESJ6TZSPVNSSZ/
- https://owasp.org/www-project-modsecurity-core-rule-set/
- https://portswigger.net/daily-swig/lessons-learned-how-a-severe-vulnerability-in-the-owasp-modsecurity-core-rule-set-sparked-much-needed-change
- https://portswigger.net/daily-swig/waf-bypass-severe-owasp-modsecurity-core-rule-set-bug-was-present-for-several-years
- https://security.gentoo.org/glsa/202305-25
- https://coreruleset.org/20210630/cve-2021-35368-crs-request-body-bypass/
- https://lists.debian.org/debian-lts-announce/2023/01/msg00033.html
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/6MS5GMNYHFFIBWLJW7N3XAD24SLF3PFZ/
- https://lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/IVYUJOKHDEXFTM2CZMEESJ6TZSPVNSSZ/
- https://owasp.org/www-project-modsecurity-core-rule-set/
- https://portswigger.net/daily-swig/lessons-learned-how-a-severe-vulnerability-in-the-owasp-modsecurity-core-rule-set-sparked-much-needed-change
- https://portswigger.net/daily-swig/waf-bypass-severe-owasp-modsecurity-core-rule-set-bug-was-present-for-several-years
- https://security.gentoo.org/glsa/202305-25