Remix.run Logo
▲ Multiple vulnerabilities in Regexp and String case conversion(ruby-lang.org)
79 points by runesoerensen 2 hours ago | 16 comments
▲tptacek an hour ago | parent | next [-]

There's what I think is probably an awesome bug here.

Windows-1252 encoding has a representation for lowercase German sharp 's' (ß), but not one for the uppercase. If you upcase a string containing a sharp 's', it gets normalized to "SS", which increases the length of the string by one character. The 1252 case conversion code doesn't handle this; it looks like it checks for headroom in the buffer one character at a time. So if the last character of a string you upcase is ß, it looks like you get a one-byte overflow (of 'S').

If that's really the bug (there's a claimed RCE POC), the heap grooming for it must be really fussy! I couldn't find any other character pairs that expand like this.

You can feed strings in 1252 to a Rails program through multipart POSTs, which get to pick their encodings.

The great thing about this bug, apart from how it illustrates how doomed we all are (if I'm right), is that it should by rights have the best vulnerability name of the year, because you get to work 'ß' into it.

▲bee_rider 16 minutes ago | parent | next [-]

Haha, that exact character caused problems in a programming class I tutored for. Got to throw the first year students some curveballs.

▲testplzignore 32 minutes ago | parent | prev | next [-]

I wonder if there is a similar bug for U+0130 which (I think) expands to two characters when lowercased.

▲tptacek 30 minutes ago | parent [-]

Maybe somewhere! But that character isn't in Windows-1252 at all, so it can't trip this string counting bug.

▲xp84 41 minutes ago | parent | prev | next [-]

Should we call it #upcaße2Shell?

▲tptacek 37 minutes ago | parent [-]

One of the discoverers suggested, on Twitter, Ruby2ßhell. My wife, who speaks and writes German, refused to entertain this.

▲cowlevel an hour ago | parent | prev [-]

Unicode also has this feature because SS is the correct uppercase form of ß

▲lousken 2 hours ago | parent | prev | next [-]

I need a vacation

▲donkey_brains 2 hours ago | parent | next [-]

We all do, but we don’t know if our companies will still be there when we get back.

▲cwmoore an hour ago | parent | prev | next [-]

I hear Java is nice

▲layer8 an hour ago | parent | next [-]

You can find nice shells on the beaches.

▲NooneAtAll5 an hour ago | parent | prev [-]

java had vulnerability in base64 decode asm

https://calif.io/java4shell/

▲_pdp_ an hour ago | parent | prev [-]

Book it for 18 months from now. Oh, also bring your laptop.

▲TZubiri an hour ago | parent | prev [-]

It should be pretty straightforward to replace regexes with good ole ifs, array acceses, and comparision operators, whether manually or with an LLM. Pretty low hanging fruit to shave off some kilobytes of attack vector

▲preinheimer 27 minutes ago | parent [-]

I think you’re underestimating the complexity of a lot of regular expressions.

▲marcus_holmes 23 minutes ago | parent [-]

Also that a lot of the regexes will be inside Rails code that we can't touch, Gems that need maintaining, etc.