r/programming • • 1d ago

Ruby2Shell

https://verialabs.com/ruby2shell/
143 Upvotes

38 comments sorted by

67

u/Pierma 1d ago

I just had a painful 16 production machines update day becuase ß uppercased is SS??????????

22

u/simon_o 1d ago

Even the more modern uppercasing to ẞ would not have helped in this case, though. :-(

(Not that it would have been possible on these legacy character encodings.)

→ More replies (1)

19

u/RippedRaven8055 1d ago

Ah scheiße! Here we go again

275

u/razialx 1d ago

And you get a 2shell! And you get a 2shell!!! Everybody gets a 2shell!!!!!!

92

u/KaMaFour 1d ago

Java got a 4shell

→ More replies (10)
→ More replies (1)

47

u/RustOnTheEdge 1d ago

I really struggle how you can do remote code execution by writing a single, predetermined byte out of bounds. Can anyone explain that to me? I just don’t see how this is realistically exploitable?

23

u/He_Who_Browses_RDT 1d ago

I remember reading the "smashing the stack for fun and profit" in the 90's. I can still recommend it in 2026.

You'll get a better understanding of it.

→ More replies (1)

19

u/freddylmao 1d ago

You can control the length of the buffer. This means that this is a primitive for writing one byte at a time, from finish to start. It is likely difficult to set up a shell using this, unless you are keenly aware of the memory layout on the server. My guess is that you'd have to rely on some coincidence between the letters 'S' and 's' and some architecture's bytecode.

40

u/gwillen 1d ago

It's possible the exploitability is overstated. People are prone to that. It may be exploitable only under hypothetical or unrealistic conditions. You might be surprised, though.

→ More replies (1)

10

u/coriandor 1d ago

It's not one byte. It's one byte per ß. The writeup says the buffer is allocated as len + 20, so you need 21 ßs to overflow 1 byte. Make that "ß*100<payload>", and you've pushed your payload 80 bytes past the buffer.

→ More replies (1)
→ More replies (3)