Remix.run Logo
▲ stuxf 3 hours ago

this relies on specific behavior with how the upcase function worked, the ß is the only one that expands in a way that works for this vulnerability.

▲weinzierl 2 hours ago | parent [-]

Can you elaborate on what makes ß special enough to enable the vulnerability.

A quick search showed that there are other cases in legacy encodings that expand to multiple bytes.

For example 0xEF in ISO 6937 expands to CA BC 4E in UTF-8 after case transformation. Similar to ß this is a case with a single byte legacy encoding with a single lowercase unicode codepoint which has no precomposed upper case equivalent.

▲debugnik an hour ago | parent [-]

From the Ruby docs:

> Non-ASCII case mapping and folding are supported for UTF-8, UTF-16BE/LE, UTF-32BE/LE, and ISO-8859-1~16 Strings/Symbols.

ß might actually be the only character that expands to multiple bytes on the original encoding from that list of ISO encodings.

▲weinzierl an hour ago | parent [-]

Ah, good point. If ISO-8859-1 is the only supported single-byte legacy encoding then ß is most likely the only case.

EDIT: Thinking about it, my example from above should work with UTF-16 input.

U+0149 is a single lower case BMP codepoint, so two bytes in UTF-16. It has no precomposed uppercase, so it turns into two codepoints and 4 bytes in UTF-8 and UTF-16.