feat(921300): Query delimiter confusion#4571
feat(921300): Query delimiter confusion#4571touchweb-vincent wants to merge 7 commits intocoreruleset:maincoreruleset/coreruleset:mainfrom
Conversation
|
but how, the example works? Give me an example how can be exploited @touchweb-vincent? |
|
ah!!! yes, that is i already i want to report it |
|
📊 Quantitative test results for language: |
Problems
|
Added a new test case for common call with parameters and updated description for an existing test case.
|
Hi @fzipi , Thanks a lot for your detailed feedback, much appreciated.
([^0-9A-Z_a-z]*?) There are quite a few of these in the 941 ruleset, likely for good reasons. Any clarification on when/why lazy quantifiers are actually beneficial in these contexts would be very helpful for me.
That said, feel free to adjust it if needed, but it wouldn’t be my initiative.
Thanks again for your help and guidance. Vincent |
Proposed changes
This PR introduces a new detection rule targeting a parsing ambiguity where an ampersand (&) appears in the URI path before the beginning of a valid query string (?).
While this pattern is not compliant with standard URI syntax, it is observed in real-world deployments where backend rewrite rules (e.g. ?url=$1) may reinterpret path segments as query parameters. In such cases, characters like & embedded in the path can be promoted to query delimiters after rewriting.
More concretely, if an
.htaccessor vhost contains the following rule:Then, if the following request is sent:
The WAF does not interpret
payloadas a parameter.However, since the rewrite rule transforms the URI into:
The backend application does receive the
payloadparameter with the valuemy_payload.This also introduces additional side effects - including the neutralization of potential
sanitiseMatchedinstructions, effectively exposing parameters that should be obfuscated in clear text within the frontend access logs.This behavior creates a discrepancy between how the WAF (CRS) and the backend application interpret the request. Since CRS relies on normalized query parsing to populate ARGS collections, parameters injected via the path are not analyzed during rule evaluation. As a result, this can effectively neutralize detection logic relying on ARGS and enable parameter smuggling.
You will likely point out that most rules do not only analyze ARGS but also inspect REQUEST_URI, which mitigates the severity of this bypass; however, it still seems important to take this behavior into account.The proposed rule detects any occurrence of & in the URI before a ?, which is a strong indicator of such ambiguity and a potential bypass vector.
This rule will inherently generate false positives, as the & character can be a perfectly legitimate character in filenames or path segments depending on the application context. For this reason, it has been placed at Paranoia Level 3 (PL3), although placement at PL4 could also be considered.
This addition strengthens CRS coverage against parser confusion and rewrite-assisted parameter smuggling techniques, which are currently not explicitly addressed.
What do you think ?
P.S. PrestaShop is very likely not the only application affected by this kind of behavior in .htaccess rewrite rules.
PR Checklist
commentfield to write the expected behaviorFurther comments
For the reviewer
ctl:requestBodyAccess=Offwere used in the rule