Description
From @WHK102 who posted on SpiderLabs/owasp-modsecurity-crs#268
For example: crs is connected to database log with exp reg to match content, injection sql by logs of crs example:
Change user agent to nikto and request: http://secure.com/"] [unique_id "');drop tables;-- -
Log output: [Mon Nov 16 13:49:08 2015] [error] [client x.x.x.x] ModSecurity: Access denied with code 403 (phase 2). Matched phrase "nikto" at REQUEST_HEADERS:User-Agent. [file "/home/x/crs/activated_rules/modsecurity_crs_35_bad_robots.conf"] [line "20"] [id "990002"] [rev "2"] [msg "Request Indicates a Security Scanner Scanned the Site"] [data "nikto 3.9"] [severity "CRITICAL"] [ver "OWASP_CRS/2.2.9"] [maturity "9"] [accuracy "9"] [tag "OWASP_CRS/AUTOMATION/SECURITY_SCANNER"] [tag "WASCTC/WASC-21"] [tag "OWASP_TOP_10/A7"] [tag "PCI/6.5.10"] [hostname "lapinturita.cl"] [uri "/"] [unique_id "');drop tables;-- -"] [unique_id "VkolJMBjCQ8AAH8FpyAAAAAg"]
[uri "/"] is validate as "/"
[unique_id "';drop tables;-- -"] is validate as ';drop tables;-- -
Now, save this with vulnerable code: insert into crs_logs ... values ('1', '');drop tables;-- -
Some people say that filter the field unique_id if only alphanumeric ?, the answer here.
Solution: display query string in urlencoded mode or escaped correctly the quotes to prevent spoof fields.