Limited URL spoofing via crafted A-label
Description
Activity
Markus Scherer August 14, 2020 at 9:37 PM
I also submitted a Unicode bug report for these edge cases, proposing to add them to https://www.unicode.org/reports/tr46/#ProcessingStepPunycode
Markus Scherer August 14, 2020 at 9:36 PM
Fixed with PR #1234: validate ACE label edge cases
Check for `"xn--"` and `"xn--ASCII-"` and fail equivalently to IDNA2008 ToUnicode which verifies that its input round-trips via ToASCII back to the same string. These strings turn into `""` and `"ASCII"`, different from the input.
UTS #46 otherwise validates equivalently as well. The code here uses a much simpler test for these edge cases.
Markus Scherer August 13, 2020 at 11:49 PM
As the bug report points out, RFC 3492 ToUnicode says to double-check: Convert back from Punycode (apply ToASCII) and check that the result is the same as the input.
ICU actually implements UTS #46, not vanilla IDNA2008. I don’t see such a double-check in the ToUnicode or Processing parts of this spec.
Should we update the UTS #46 spec? Are there any other types of bad inputs that only a round-trip with the extra ToASCII will catch, or would it suffice to only check for this case?
Markus Scherer August 13, 2020 at 6:38 PM
in provided "Punycode Sample Implementation" there is function punycode_decode() which has the necessary check:
if (in >= input_length) return punycode_bad_input
Yes, but that’s in the nested loop for decoding a variable-length integer. The outer loop has the condition in < input_length
so for an empty string after the last hyphen the whole outer loop is just skipped. See page 29 of the RFC: https://tools.ietf.org/html/rfc3492#page-29
Same with the spec for the Decoding Procedure: https://tools.ietf.org/html/rfc3492#section-6.2
The inner loop has “consume a code point, or fail if there was none to consume“ but the outer loop has “while the input is not exhausted do begin“ so does nothing if there is no input after the last delimiter.
That is, as far as I can tell, our Punycode implementation conforms to the spec.
I will take a look at the next level up.
Shane Carr March 28, 2020 at 12:08 AM
This is scheduled for ICU 68, which is expected in Q4 2020; however, if the fix is small, you could patch it in sooner than that, depending on Markus’s timeline.
We got the following report in Chromium (https://bugs.chromium.org/p/chromium/issues/detail?id=1063566):
xn--chromium-.org → chromium.org
Meacer says:
Reporter says: