Ruby2ßhell: Pre-authentication RCE on stock Rails

(verialabs.com)

85 points | by jdns 4 hours ago

12 comments

  • circularfoyers 1 hour 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 18 minutes ago
    More interested to see how you can use just a single byte overflow to trigger RCE. Definitely achievable but sounds tough.
  • weinzierl 1 hour 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 1 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.
  • Panzerschrek 1 hour 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_ 38 minutes 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 48 minutes 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 3 minutes ago
        The Unicode case mappings are covered by backwards-compatibility guarantees. "ß" is going to be mapped to "SS" forever.
      • cubefox 1 minute 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 51 minutes ago
    But can the attacker specify the encoding in rails? It's not like UTF-8 or GTFO?
    • CER10TY 26 minutes 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 3 minutes ago
        So you have to convert ISO-2022-JP, for example? That sounds like a disaster waiting to happen.
  • zelphirkalt 1 hour ago
    Name as discussed earlier here on Hackernews :) Glad they went with that name.
  • lousken 1 hour ago
    Scheiße2Shell?
  • tvvocold 19 minutes ago
    One Shell a Day, Ops Run Away.
  • rs_rs_rs_rs_rs 1 hour ago
    For once a bug name that's cool.
    • stuxf 1 hour 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 14 minutes ago
        And the fact that you can almost read it ruby 2 hell
  • gsich 18 minutes ago
    no poc. go away.
    • stuxf 11 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 17 minutes ago
      took glm a bit over 20 minutes to write one, based on the report.
  • FreeBurn 59 minutes ago
    [flagged]
  • sgt 41 minutes ago
    Django next? Although it's unlikely, Django is known to be above average in terms of security by now.
    • Gigachad 35 minutes 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 21 minutes ago
        CPython.
    • imtringued 15 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 32 minutes ago
      Above average doesn’t cut it these days. And doesn’t Python have some of the strongest exposures to C libraries?

      Well…