-
Notifications
You must be signed in to change notification settings - Fork 141
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
Single and double dot segments in paths cannot be represented – Premature decoding of %2e character sequences. #281
Comments
Because the difference between URL parsers can be exploited by attackers, so it's better to be conservative. Did you test Safari Technology Preview? I'm pretty sure they've fixed this. |
Yes, I have indeed fixed this in current WebKit. You can verify this with Safari Technology Preview at https://developer.apple.com/safari/technology-preview/ |
https://bugs.webkit.org/show_bug.cgi?id=164142 was WebKit conforming to the resolution of #87 |
Thanks for confirming. Closing this since we don't want to change this because of security. Happy to answer any further questions though @alwinb . |
So after reading up a bit, (I need to let it sink in for a while) is it correct that at the moment, no percent decoding (thus normalization) is done on the path at all except for only and exactly those single and double dot path sequences, and that this is special-cased to prevent servers from being tricked to move beyond their document root? |
Yes. |
Thanks. For the record, I do think the solution is somewhat unsatisfactory. I appreciate the safety issue, but I'm not sure about the tradeoff, nor the effectiveness. Servers that fall for such an attack may fall for |
It is currently impossible to represent URLs (note: URLs, not URL-strings) that have paths that contain single or double dot segments, making it impossible, for example, to address files or directories named
.
or..
.Example: According to the specification, the URL-string
http://asd/efg/%2e%2e/
should resolve tohttp://asd/
. The/%2e%2e/
part is considered equivalent to/../
and is hence interpreted as a move to the parent directory. The same holds forhttp://asd/efg/.%2e/
.I propose to change this on account of the following:
Currently (at least) Safari does not shorten the url, and maintains the
/%2e%2e/
segment in the path. As long as there is no consensus, we may be still able to change this!It should be possible to represent URLs (not URL-strings) with single and double dot path components as URL-strings.
It is not elegant and looks like a standardization of buggy parsing/ resolution algorithms. I cannot help but see this as a 'premature decoding' of the
%2e
sequences.I see
.
and..
sequences in URL-strings as syntactic constructs, similar to the?
,#
and/
characters. URLs with path components that contain one of the?
,#
or/
characters can be represented by percent encoding them, e.g. by using%3f
,%23
, or%2f
. Why not allow the same here – while we still can?The text was updated successfully, but these errors were encountered: