Ruby2ßhell: Pre-authentication RCE on stock Rails

(verialabs.com)

108 points | by jdns 5 hours ago ago

32 comments

  • cowlevel 17 minutes ago

    So the recent RCE wave seems to be people finding more single byte overflows and such, but reporting them as RCEs because AI can do the tedious grunt work of finding the rest of the vulnerability chain.

    If any single byte overflow can be converted into an RCE with minimal human effort then we have no choice but to prove the whole software stack is memory safe.

    • trismegisti 6 minutes ago

      But are those generic exploits, that don't rely on specific dynamic library and kernel versions? i doubt it.

    • miohtama 11 minutes ago

      This is bad news for C/C++

  • circularfoyers 2 hours ago

    Thought this was another vulnerability for a second, but for anyone else who thought the same, this is already covered in the Ruby advisory being discussed here https://news.ycombinator.com/item?id=50554038 (which covers six other vulnerabilities).

  • barbegal 42 minutes ago

    More interested to see how you can use just a single byte overflow to trigger RCE. Definitely achievable but sounds tough.

  • weinzierl 2 hours ago

    There should be other codepoints other than ß that in principle could be used for a vulnerability like that. There are even ones that expand to three codepoints, like ffi.

    • stuxf an hour 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 10 minutes ago

        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.

  • Panzerschrek 2 hours ago

    I suppose this function has been written first in assumption, that case conversion doesn't affect length, but later ß -> SS conversion has been added without proper testing.

    • johnp_ an hour ago

      There was never any guarantee that case conversion is byte length equivalent. Except for pure ASCII, that's just been an incorrect assumption from the start.

    • rob74 an hour ago

      Ah, so that's the real reason "ß" is now allowed in uppercase too (https://en.wikipedia.org/wiki/%C3%9F)? Reducing the risk of security issues by removing an edge case?

      • pwdisswordfishq 28 minutes ago

        The Unicode case mappings are covered by backwards-compatibility guarantees. "ß" is going to be mapped to "SS" forever.

      • cubefox 26 minutes ago

        It even seems the "more correct" uppercase form of ß is now ẞ, not SS.

        > Traditionally, ⟨ß⟩ did not have a capital form, and was capitalized as ⟨SS⟩. Some type designers introduced capitalized variants. In 2017, the Council for German Orthography officially adopted a capital form ⟨ẞ⟩ as an acceptable variant, ending a long debate.[4] Since 2024 the capital has been preferred over ⟨SS⟩.[5]

  • speedgoose an hour ago

    But can the attacker specify the encoding in rails? It's not like UTF-8 or GTFO?

    • CER10TY an hour ago

      You can freely specify the encoding when sending multipart/form-data POST since Rails respects the charset attribute in Content-Type, eg Content-Type: text/plain; charset=Windows-1252

      • bloak 28 minutes ago

        So you have to convert ISO-2022-JP, for example? That sounds like a disaster waiting to happen.

        • lmz 23 minutes ago

          Clients have to do the same with server responses.

  • zelphirkalt 2 hours ago

    Name as discussed earlier here on Hackernews :) Glad they went with that name.

  • lousken 2 hours ago

    Scheiße2Shell?

  • tvvocold 44 minutes ago

    One Shell a Day, Ops Run Away.

  • rs_rs_rs_rs_rs 2 hours ago

    For once a bug name that's cool.

    • stuxf 2 hours ago

      we were thinking of naming it ruby off rails haha, but this title ties into how this vulnerability works which was super cool

      • rs_rs_rs_rs_rs 39 minutes ago

        And the fact that you can almost read it ruby 2 hell

  • gsich 43 minutes ago

    no poc. go away.

    • stuxf 36 minutes ago

      would you rather we publish a PoC for a vulnerability that doesn't even have a patch yet? e.g self-hosted GitLab still hasn't shipped a newer version of Ruby that's patched...

      would be wildly irresponsible

    • spikewall 41 minutes ago

      took glm a bit over 20 minutes to write one, based on the report.

  • sgt an hour ago

    Django next? Although it's unlikely, Django is known to be above average in terms of security by now.

    • Gigachad an hour ago

      The bug here is in the C code for Ruby. Python is also written in C and just as likely to have memory bugs.

      • pjmlp an hour ago

        CPython.

    • imtringued 39 minutes ago

      The days of people feeling secure because they don't make egregious mistakes are unfortunately over. Now the rule is: You are vulnerable, you just don't know how.

    • DarkNova6 an hour ago

      Above average doesn’t cut it these days. And doesn’t Python have some of the strongest exposures to C libraries?

      Well…

      • sgt 19 minutes ago

        Uh oh. I guess it's being hammered with people with Red Team access right now.