-
Notifications
You must be signed in to change notification settings - Fork 367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DefaultEncoder / getCanonicalizedURI returns mix encoding for HTML special characters #824
Comments
…javadoc to indicate that the method takes into consideration canonicalization of mixed/multi encoded URLs as specified in ESAPI.props 'allowMixed' and 'allowMultiple' accordingly.
Moved @krog78's comment here. |
Quick notes: Unwrapped URL as-is:
Percent-decoded:
Both versions, unwrapped looking for HTML Entities results in a null finding. |
Found it. As discussed in #823 the first call to canonicalize the entire query string is run into the canonicalize method on line 541 and generates the false positive. Further research is necessary to determine exactly what is being detected because sweeping the input against standard HTML decoding (NOT ESAPI) results in zero change to the output. (There's no collision, so what gives?) |
Issue 1: the call to canonicalize on line 541 is attempting an early canonicalize in the case of the queries. We're not supposed to touch those until we've split the queries into key/value pairs. This will be resolved by finessing the logic to placed 541 into the else block that checks to see if we're at the QUERY segment. THAT will partially mitigate the problem by ensuring the check is done at the correct location. Issue 2: Determine why the input
It appears that I solved that by looking at this. The HTML entity Codec is translating I'm stumped as to why we're translating that &or however. This is just strange. The FP issue will be fixed easy and can go whenever the next point release goes out, but the misdetection on &or.... who knows. I think that's its own issue. |
…se block of the check to see whether or not we were dealing with a query segment.
Discussed in #823
Originally posted by krog78 January 19, 2024
Hi,
DefaultEncoder / getCanonicalizedURI returns mix encoding for HTML special characters in query string (and does not seem to canonicalize the parameter value despite the fact it is mentionned):
esapi-java-legacy/src/main/java/org/owasp/esapi/reference/DefaultEncoder.java
Line 573 in 2136292
And the canonicalize is applied to scheme, host, port and also UriSegment.SCHEMSPECIFICPART, is it really relevant?
Thanks,
Regards,
Sylvain
The text was updated successfully, but these errors were encountered: