Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-42717 PoC — ModSecurity安全漏洞

Source
Associated Vulnerability
Title:ModSecurity安全漏洞 (CVE-2021-42717)
Description:ModSecurity是一个入侵检测、阻止的引擎可以作为Apache Web服务器的一个模块或单独的应用程序来运行,为增强Web应用程序的安全性和保护Web应用程序避免遭受来自已知与未知的攻击。 ModSecurity 3.x 到 3.0.5 存在安全漏洞,该漏洞源于 ModSecurity 错误处理了过度嵌套的 JSON 对象。精心制作的具有数万层嵌套深度的 JSON 对象可能会导致 Web 服务器无法为合法请求提供服务。即使是中等大小(例如 300KB)的 HTTP 请求也可能占用一个有限的 NGIN
Description
Detection and Mitigation script for CVE-2021-42717 -> ModSecurity DoS Vulnerability in JSON Parsing 
Readme
# Detection-and-Mitigation-script-for-CVE-2021-42717
Detection and Mitigation script for CVE-2021-42717 -> ModSecurity DoS Vulnerability in JSON Parsing 

ModSecurity 3.x through 3.0.5 mishandles excessively nested JSON objects. Crafted JSON objects with nesting tens-of-thousands deep could result in the web server being unable to service legitimate requests. Even a moderately large (e.g., 300KB) HTTP request can occupy one of the limited NGINX worker processes for minutes and consume almost all of the available CPU on the machine. Modsecurity 2 is similarly vulnerable: the affected versions include 2.8.0 through 2.9.4.

Possible Mitigation:  Create a phase:1 chained rule that will reject requests that would use the JSON parser if the Content-Length exceeds a certain size (10,000 to 20,000 bytes is likely safe in most installations).  Some v2 users may alternatively be able to make use of the SecRequestBodyNoFilesLimit configuration item if other non-file request bodies are likewise expected to be below similar thresholds. Special note to users with ModSecurity <v2.9.3:  although the problem exists in earlier versions like v2.9.2, it appears to require a larger request body size to trigger problematic delays, which means that limits involving the request body size can probably be larger (perhaps 40,000 to 50,000 bytes) and still provide decent protection in most installations.
https://www.trustwave.com/en-us/resources/blogs/spiderlabs-blog/modsecurity-dos-vulnerability-in-json-parsing-cve-2021-42717/


![image](https://user-images.githubusercontent.com/106553324/202918682-b9ff8b41-788e-4df9-8624-87ee288fa03e.png)
File Snapshot

[4.0K] /data/pocs/e76fc1060d22af12b025524f8581c868d0621133 ├── [1.2K] cve-2021-42717.sh ├── [1.0K] LICENSE └── [1.6K] README.md 0 directories, 3 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. If the original source is unavailable, please email f.jinxu#gmail.com for a local snapshot (replace # with @).
    3. Shenlong has snapshotted the POC code for you. To support long-term maintenance, please consider donating. Thank you for your support.