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.
As is tradition, Raymond Chen has had something to say about this. The windows-1252 code page was introduced with Windows 1.0, and according to Wikipedia its final version shipped with Win98. String operations are just plain too hard.
There is no good reason for really any Rails app to accept Windows-1252! This is reminiscent of the YAML vulnerability, which surprised most Rails users with the fact that Rails endpoints all accepted YAML to begin with.
Not only that, when you uppercase 1 char with precomposed diacritics, but uppercase doesn't have precomposed diacritics, so they expand into separate chars (max is 1 to 3 chars)
Both fixable, but as with a lot of Unicode stuff, might take a long while
It’s not. There are multiple uppercase forms, including “SS”, “SZ”, and the uppercase ß character, all of which are well-established, which makes all of them correct according to the principle of linguistic descriptivism.
But according to the "principle" of blindly following the Unicode standard with no tailoring, the "correct" form is SS. (And Unicode's stability guarantees preclude ever changing it to ẞ)
Human writing systems themselves have that very same property. The stability of written language prevents them to adapt swiftly to changes to spoken language.
Knight / night is an example for English. That k should be gone, right? Or all those silent -ment and e in French.
Enter the computer and I'm not surprised that German speakers end up mostly with SS because that's what computers do when automatically upcasing words.
A lot of spelling changes are dictated by what's available on keyboards. In Italian we accept E' as È because we don't have that upper case character on our keyboard. Automatic uppercase on start of sentences fixed it where it's available and mobile keywords show an È as an option of you long press a shifted e. But what if you are writing Italian in an English locale form field with a hardware keyboard (here with an OS with English locale) or you have to write È in the middle of a sentence or, go back 30 or 40 years, you have to use a typing machine?
I'm am sure that every language that had to go through a phase of adapting to ASCII and to the limits on the layout of keyboards has similar stories to tell.
We’re all fools for thinking something as inherently dangerous as decoding a base64 string or converting it to upper case should be performed in a non-airgapped environment.
These are all C-based memory corruption vulnerabilities.
The reality of these type of bugs being found by autonomous AI models on established software should tell you by now that memory-unsafe languages are completely exposed.
This is who maintainers you are up against:
"Thanks to Stephan Lipp (Ada Logics) and Anthropic for reporting this issue."
Imagine attackers using abliterated models at scale who don't disclose these issues.
We have been screaming this for years before AI showed up. But instead of removing C wherever possible it was decided fine to just patch the bugs as they showed up.
oh boy. if only we had a language that could prevent this from happening. oh well, i guess there is nothing we can do but patch these things once they're discovered.
Just completely rewrite CRuby which includes a JIT and has to maintain ABI compatibility for compiled extensions. I mean I'm certainly not volunteering for that project.
Oh boy if you could develop a solution that would port C code over with completely safe rust semantics where feasible and without people having to clean up the disaster of a result, that would be nice, instead of you guys trying to demonstrate how superior you and your favorite language are. Because that is the only way you are going to port the world to Rust. Oh, and you have to support COBOL too. Probably a bunch of other old languages that have been around for longer than a lot of us have been alive.
Seriously, all these snarky posts about Rust being the god language really comes off as "look how utterly superior we are as Rust programmers and look how superior the Rust language is, this would never ever happen in Rust the god language". Yes, I'm annoyed by stuff like this.
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
What you're describing is using a parser generator to take a regex and turn it into code you can embed into your project. This already exists and you can use it now. https://re2c.org/
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.
Haha, that exact character caused problems in a programming class I tutored for. Got to throw the first year students some curveballs.
I wonder if there is a similar bug for U+0130 which (I think) expands to two characters when lowercased.
Maybe somewhere! But that character isn't in Windows-1252 at all, so it can't trip this string counting bug.
Should we call it #upcaße2Shell?
One of the discoverers suggested, on Twitter, Ruby2ßhell. My wife, who speaks and writes German, refused to entertain this.
> it should by rights have the best vulnerability name of the year, because you get to work 'ß' into it.
Holy sh!t
Holy Scheiße
As is tradition, Raymond Chen has had something to say about this. The windows-1252 code page was introduced with Windows 1.0, and according to Wikipedia its final version shipped with Win98. String operations are just plain too hard.
https://devblogs.microsoft.com/oldnewthing/20200804-00/?p=10...
https://devblogs.microsoft.com/oldnewthing/20241007-00/?p=11...
There is no good reason for really any Rails app to accept Windows-1252! This is reminiscent of the YAML vulnerability, which surprised most Rails users with the fact that Rails endpoints all accepted YAML to begin with.
values of ß will give rise to dom
Unicode also has this feature because SS is the correct uppercase form of ß
Not only that, when you uppercase 1 char with precomposed diacritics, but uppercase doesn't have precomposed diacritics, so they expand into separate chars (max is 1 to 3 chars)
Both fixable, but as with a lot of Unicode stuff, might take a long while
It’s not. There are multiple uppercase forms, including “SS”, “SZ”, and the uppercase ß character, all of which are well-established, which makes all of them correct according to the principle of linguistic descriptivism.
And according to linguistic perscriptivism, the upper case of ß is ẞ since 2017. (SS is also allowed, but no longer preferred)
But according to the "principle" of blindly following the Unicode standard with no tailoring, the "correct" form is SS. (And Unicode's stability guarantees preclude ever changing it to ẞ)
>And Unicode's stability guarantees preclude ever changing it to ẞ
This seems like a bad property for a system that encodes human writing systems.
Human writing systems themselves have that very same property. The stability of written language prevents them to adapt swiftly to changes to spoken language.
Knight / night is an example for English. That k should be gone, right? Or all those silent -ment and e in French.
Enter the computer and I'm not surprised that German speakers end up mostly with SS because that's what computers do when automatically upcasing words.
A lot of spelling changes are dictated by what's available on keyboards. In Italian we accept E' as È because we don't have that upper case character on our keyboard. Automatic uppercase on start of sentences fixed it where it's available and mobile keywords show an È as an option of you long press a shifted e. But what if you are writing Italian in an English locale form field with a hardware keyboard (here with an OS with English locale) or you have to write È in the middle of a sentence or, go back 30 or 40 years, you have to use a typing machine?
I'm am sure that every language that had to go through a phase of adapting to ASCII and to the limits on the layout of keyboards has similar stories to tell.
What stops you from blindly following the standard with tailoring?
Or so the Germans would have us believe...
I've been saying that for years.
Who cares, I use ASCII :)
I need a vacation
We all do, but we don’t know if our companies will still be there when we get back.
I hear Java is nice
You can find nice shells on the beaches.
java had vulnerability in base64 decode asm
https://calif.io/java4shell/
We’re all fools for thinking something as inherently dangerous as decoding a base64 string or converting it to upper case should be performed in a non-airgapped environment.
Thankfully my servers are too old for this vulnerability to work.
> Java RCE/Memory Corruption
> OpenJDK13
Serves those cutting edge technology adopters right. I'm sitting on JDK8 baby!
Right with you.
A full day ago! Practically ancient
Book it for 18 months from now. Oh, also bring your laptop.
These are all C-based memory corruption vulnerabilities.
The reality of these type of bugs being found by autonomous AI models on established software should tell you by now that memory-unsafe languages are completely exposed.
This is who maintainers you are up against:
"Thanks to Stephan Lipp (Ada Logics) and Anthropic for reporting this issue."
Imagine attackers using abliterated models at scale who don't disclose these issues.
[0] https://github.com/ruby/ruby/security/advisories/GHSA-34m4-m...
We have been screaming this for years before AI showed up. But instead of removing C wherever possible it was decided fine to just patch the bugs as they showed up.
I imagine Ruby programmers thought they were working in a memory-safe language, but apparently that's not enough?
Imagine developers using abliterated models and fixing these issues before releasing any more code.
oh boy. if only we had a language that could prevent this from happening. oh well, i guess there is nothing we can do but patch these things once they're discovered.
exactly, which is why I use ruby.
"There's no way this could be prevented", says users of only programming language where it regularly happens
good developers simply would not have written these bugs.
Just completely rewrite CRuby which includes a JIT and has to maintain ABI compatibility for compiled extensions. I mean I'm certainly not volunteering for that project.
Oh boy if you could develop a solution that would port C code over with completely safe rust semantics where feasible and without people having to clean up the disaster of a result, that would be nice, instead of you guys trying to demonstrate how superior you and your favorite language are. Because that is the only way you are going to port the world to Rust. Oh, and you have to support COBOL too. Probably a bunch of other old languages that have been around for longer than a lot of us have been alive.
Seriously, all these snarky posts about Rust being the god language really comes off as "look how utterly superior we are as Rust programmers and look how superior the Rust language is, this would never ever happen in Rust the god language". Yes, I'm annoyed by stuff like this.
actually rust devs are humble enough to understand their limitations and let the compiler help them out.
as for porting, well, llm go burrrrrr. we can even use llms to port gpl to mit.
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
I think you’re underestimating the complexity of a lot of regular expressions.
Also that a lot of the regexes will be inside Rails code that we can't touch, Gems that need maintaining, etc.
dependencies that themselves are targets for deletion
What you're describing is using a parser generator to take a regex and turn it into code you can embed into your project. This already exists and you can use it now. https://re2c.org/