Skip to content
DevMeme
5436 of 7590
Languages Post #5959 · source on Telegram

Safely Unsafe: A Rust Library for Memory Vulnerabilities

Description

A screenshot of the documentation for "cve-rs," a satirical Rust library. The text humorously claims to allow developers to introduce memory vulnerabilities like buffer overflows and segfaults in a "memory safe" way. The page header reads "cve-rs" and the tagline is "Blazingly fast memory vulnerabilities, written in 100% safe Rust." The body of the text explains the "benefits" of being able to corrupt memory in a safe language. The technical joke is layered: it satirizes Rust's obsession with safety by creating a library for intentionally unsafe behavior, ironically claiming it's all safe. It's a deep-cut joke for developers who appreciate Rust's memory safety guarantees and the absurdity of circumventing them

Comments

46
Anonymous ★ Top Pick This library is perfect for when you need to explain to your C++ colleagues what a memory-safe language is, but in a language they'll finally understand: a segmentation fault
  1. Anonymous ★ Top Pick

    This library is perfect for when you need to explain to your C++ colleagues what a memory-safe language is, but in a language they'll finally understand: a segmentation fault

  2. Anonymous

    Security wanted a realistic exploit drill but compliance forbade `unsafe`; so I just `cargo add cve-rs` - now we ship use-after-free in 100% safe Rust and Clippy still high-fives the commit

  3. Anonymous

    After 20 years of fighting memory corruption bugs, we've finally achieved the impossible: a way to write segfaults that pass the borrow checker. Now your Rust code can have all the excitement of C++ undefined behavior while still compiling with --release and sleeping soundly knowing you never wrote 'unsafe'

  4. Anonymous

    Finally, a crate that lets you write Rust code with all the memory safety of C, but with the smug satisfaction of still passing `cargo clippy`. It's like achieving zero-cost abstractions by abstracting away the cost of actually being safe - truly the pinnacle of 'if it compiles, it works' philosophy, now with 100% more segfaults as a feature, not a bug

  5. Anonymous

    cve-rs: where Security Theater meets the borrow checker - UB-as-a-Service with #![deny(unsafe_code)] so compliance is happy while prod still gets reproducible segfaults

  6. Anonymous

    The borrow checker greenlit this buffer overflow - peak memory-safe architecture

  7. Anonymous

    Rewriting in Rust broke our bug‑compatible acceptance tests, so we added cve-rs - now even the segfaults pass without unsafe

  8. @tuguzT 2y

    lifetime resolution go brrrrrrrrr

  9. @ov7a0 2y

    https://github.com/Speykious/cve-rs

  10. @azizhakberdiev 2y

    C could never

    1. @ZgGPuo8dZef58K6hxxGVj3Z2 2y

      C++ doesn't need it. It comes automatically if (user->hasSkillIssue)

      1. @azizhakberdiev 2y

        but it ain't blazingly 🔥 fast 🚀 and 100% memory safe 💯

  11. @beton_kruglosu_totchno 2y

    So does it really demonstrate that Rust's safe code is unsafe? There's no joke there?

    1. @purplesyringa 2y

      It demonstrates that rustc has a bug that causes unsound code to be accepted despite that not being the intention. Whether you interpret that as "Rust is unsafe" is your decision

    2. @Saeid025 2y

      Well even in safest language you still can try your best to shoot your leg with a gun...

      1. @beton_kruglosu_totchno 2y

        I see, you are from "you are holding it wrong" team.

        1. @Saeid025 2y

          Not really, I'm more from "use it however you want, in the worse case scenario you'll hurt yourself" team

          1. @azizhakberdiev 2y

            "fuck around and find out" team to be more precise

        2. @LonelyGayTiger 2y

          You have deliberately abuse Rust to get any of these bugs to occur.

        3. @L2CacheGay 2y

          i dunno why people make such a fuzz out of cve-rs

          1. @sylfn 2y

            https://t.me/utk8g/1968

            1. @L2CacheGay 2y

              Hm?

              1. @sylfn 2y

                they are trying to push rust back because they think it is too aggressively imposed

                1. @L2CacheGay 2y

                  Well, they should probably go shopping for better arguments to use, then

          2. @beton_kruglosu_totchno 2y

            compare your replies to my original question

            1. @L2CacheGay 2y

              I have, and I still don’t see why anyone would make a big deal out of it

              1. @beton_kruglosu_totchno 2y

                So does it really demonstrate that Rust's safe code is unsafe? There's no joke there? if you see any "deal" in these words you do not understand language of Shakespeare

                1. @L2CacheGay 2y

                  well, its no big deal because it doesnt demonstrate that rust's safe code is unsafe

                  1. @L2CacheGay 2y

                    like i said, all it demonstrates is "rustc has a bug"

                    1. @Meepers 2y

                      I actually like rust, but doesn't that mean they failed their 'guarantee'?

                      1. @L2CacheGay 2y

                        why would it

                        1. @Meepers 2y

                          Because of what 'guarantee' means?

                          1. @L2CacheGay 2y

                            if the bar for being able to make claims like that is as high as not having even slight implementation bugs, then nothing that hasnt been formally verified can really claim anything

                            1. @L2CacheGay 2y

                              (that is, assuming the models youre using for your verification aren't themselves flawed)

                            2. @L2CacheGay 2y

                              i feel like it makes sense to take these things in context is this kind of bug particularly unique for community-driver compilers? not really does it indicate a fundamental flaw with the memory safety model, or is it just a mistake on the part of the compiler in enforcing that model? everything seems to point to the latter how easy is it to trigger by mistake? doesn't look like it's something you could just easily stumble upon, but it doesn't seem impossibly hard to trigger, either how much does it detract from the goal of memory safety in an average program? given that it seems to have been very rare in the wild, little to basically not at all to me, all that cve-rs seems to indicate for rust is the basically foregone conclusion that "you can't trust a compiler to not never have bugs", which is not something that was ever being claimed for rustc

      2. @CcxCZ 2y

        There are languages that are designed with handling malicious code in mind. There are languages that impose formal verification and compilers that went through one. Sure, there is still possibility for something to go wrong (insufficient model, hardware not behaving according to spec, etc…) but it's significantly different bar.

        1. @Saeid025 2y

          Could you name some?

          1. @CcxCZ 2y

            https://github.com/dckc/awesome-ocap?tab=readme-ov-file#programming-languages https://en.m.wikipedia.org/wiki/CompCert https://cakeml.org/ https://www.fstar-lang.org/ Anything working with mobile code, smart contracts, etc. will generally take the "no escape hatches" approach. Also I've always found Ada to be more readable than Rust.

        2. @colllapse 2y

          but when you hack your teach brain when he compiles your malicious code in his head is priceless

  12. @AlexKart20129 2y

    😄😁👏

  13. @Saeid025 2y

    It's like spoon is safe to use by design, but you still can plop your eyes out with it if you want 😁

    1. @colllapse 2y

      nah, it's a legit compiler bug. and yet unfixable due to ongoing refactoring

      1. @purplesyringa 2y

        GCC's and Clang's codegen around floating-point numbers on x86 is fucking unsound and no one bats an eye rustc has a soundness bug no one could possibly accidentally trigger and everyone loses their minds

        1. @colllapse 2y

          floating point has some spec. rust lifetime doesn't (yet). but losing they mind due to ability to segfault safely

          1. @purplesyringa 2y

            > floating point has some spec I'm not sure how that's related to codegen bugs in any fashion? > but losing they mind due to ability to segfault safely I mean, that's what soundness bugs do. Almost any soundness bug can lead to a segfault when exploited intentionally, regardless of the language. The original bug doesn't cause a segfault by itself, it has to be used as a primitive to perform a use-after-free to corrupt a pointer.

  14. @L2CacheGay 2y

    its a compiler bug, those happen, and rustc is a young compiler. whats the big deal?

Use J and K for navigation