The case of the 9 bit AES key

(v12.sh)

97 points | by ledoge 7 hours ago

10 comments

  • tptacek 6 hours ago
    "MuPDF versions before 1.28.5 use an implementation of the drand48 family" yeah, ok, so they're basically not doing real encryption. The number of bits in the key space isn't the real story; the keys simply aren't cryptographically random.
    • somat 3 hours ago
      You could do what openbsd did and tie all the traditional weak psudorandom interfaces into a cryptographically secure one. it will still match the drand48() interface. I still don't think I would use them for secure things but now rand() is actually random. http://man.openbsd.org/drand48

      Another pet peeve is when people use the rand() when they want hash() but I will leave that rant for another day.

      • hansvm 1 hour ago
        I'm interested in that rant (at $WORK we adopted hash() for almost everything, and I'm curious to hear other perspectives).
    • NelsonMinar 5 hours ago
      What is wrong with software engineers that we keep making really stupid basic mistakes like this? Sometimes I think programming should require licensing and regular testing.
      • anonymous908213 5 hours ago
        We direly need to split things into a licensed engineering field which is necessary for working on security- and reliability-critical systems, and a generic unlicensed software developer field where people can screw around with their 1000 dependency JS frontends to their hearts' content. The two should not be conflated and yet so easily are.
        • greggsy 3 hours ago
          Certification do exist for engineers, and various industries and governments impose their own certification programs on platforms and software before they’re authorised for use.

          Each with varying degrees of trust. The outcome is never perfect, but that’s not their purpose.

        • LeoPanthera 5 hours ago
          This is partly why I'm not too worried about AI slopcode.

          The human bar is not that high.

          I would much rather have rigorous testing than a filter based on the origin of the code.

          • hansvm 1 hour ago
            What's your method for implementing rigorous testing while using AI?
          • rsalus 5 hours ago
            I think it's safe to assume anything associated with PDFs is radioactive.
            • HackerThemAll 5 hours ago
              Those are not the "software engineers" but coders, those who like to say that the university degree doesn't add anything in programming.
              • anonymous908213 5 hours ago
                University degrees are not the difference between an engineer and a developer, universities have churned out millions of people who don't care about programming and have no idea what they're doing, who are just following the script with as little effort as possible because they were told it was the easiest way to make a lot of money.
                • adrianN 41 minutes ago
                  You can get through a Computer Science degree with just a few thousand lines of code if you focus on theory courses.
                  • thin_carapace 4 hours ago
                    a small wonder the wunderkinds of computer science were at all capable given their lack of computer science degrees
                    • gsich 5 hours ago
                      one and the same
                  • jburgess777 5 hours ago
                    Does the DMCA still make it illegal to access encrypted content no matter how easy it is to discover the key? https://www.law.cornell.edu/uscode/text/17/1201

                    Would the new LLM model owners like to strike this down, or use it to demonstrate how dangerous unrestricted models can be?

                    • nextaccountic 12 minutes ago
                      there is a case to be made that weak encryption is equivalent to no encryption at all
                    • ubutler 6 hours ago
                      Rule #1 of rolling your own RNG: don’t.

                      Rule #2? Please don’t.

                      • j16sdiz 6 hours ago
                        That's why we use the system RNG !
                        • cowlevel 5 hours ago
                          Be careful to use the cryptographic one, not rand(3)

                          And if you're a sysadmin, be extremely careful when generating keys in VMs or embedded devices. They tend to overestimate their entropy sources - it's possible that every clone of a VM generates the same keys. In some cases (cough ECDSA) generating the same key and nonce to sign two different messages is catastrophic - it immediately leaks the private key.

                          • saidnooneever 4 hours ago
                            good point about VMs. if you run some VPS your provider could just link in a shitty rng into the thing and not give access to the correct hardware rng. U'd really need to dig into that to find out :/.

                            -object rng-random,id=objrng0,filename=/dev/null

                            or maybe just a file that contains 4 :O

                            • Novosell 3 hours ago
                              As long as the 4 is random!
                          • flanz_10 5 hours ago
                            btw, the idea that the system rng isnt good enough, or "runs out" or whatever, is no longer true on pretty much every modern, widely used os.

                            btw... im sure there's some legacy rng in windows or some shit that isnt good. read the docs but if it's the blessed system rng, you're probably fine!

                            although... i suppose if this is news to you (the person reading this), then you probably shouldn't be implementing whatever you are that really requires prng. ask a friend for help. im not trying to be a jerk, i just want to make sure you dont hurt yourself!

                          • ahartmetz 5 hours ago
                            Rule 3: Use as many bits of randomness as the key size.

                            Rule 3b: Failing rule 3, disclose motivations and full list of employers and / or customers

                            • timerol 1 hour ago
                              Rule 3c: At least as many bits. Bits tend to not be as random as you think they are
                          • snvzz 38 minutes ago
                            That's way too many PDF implementations affected by this category of stupidity.

                            It makes me wonder: Coincidence, really? There's enough there to think that there might be some invisible hand behind it.

                            • JonChesterfield 6 hours ago
                              Wonderful.
                              • paulpauper 7 hours ago
                                it's like the weak hardware wallet entropy bug
                                • RobotToaster 5 hours ago
                                  Obligatory xkcd https://m.xkcd.com/221/
                                  • esafak 5 hours ago
                                    I assume this is the fruit of AI-driven decompilation? Nice work.
                                    • jeffbee 6 hours ago
                                      You'd have to be completely off your rocker to use a PDF tool written in C anyway.
                                      • advisedwang 6 hours ago
                                        very VERY few people judge tools like this by the language used to develop them.
                                        • jeffbee 6 hours ago
                                          How many people judge their tools based on the AES key entropy?
                                          • OptionX 6 hours ago
                                            A lot actually.

                                            You're confusing just assuming by default its enough for purpose rather than not caring at all.

                                          • j16sdiz 6 hours ago
                                            just down vote it.

                                            You can downvote anything not interesting.

                                            If he have list some alternative or give example, it might be interesting.

                                          • cowlevel 6 hours ago
                                            What are the alternatives?
                                            • crote 5 hours ago
                                              PDF.js, for example. It's what Firefox uses, and most websites with integrated on-page PDF viewing functionality.
                                            • lirolero 6 hours ago
                                              Genuine question, since I'm not very knowledgeable about this: why is using C for a PDF tool such a bad idea?
                                              • zamalek 5 hours ago
                                                File formats are the buffer issue honeypot. You may be aware of how often video and audio codecs have vulnerabilities - it's nearly never the hand-tuned frame decode assembly (where you would think all the mistakes would be). It's nearly always the thing that reads the metadata and encoded frames to memory. Binary formats have things like offsets in them, and those can be trivially used to overrun.

                                                Same thing applies here. Even Rust has a crate for dealing with binary data, despite its memory promises: https://crates.io/crates/untrusted

                                                It's a fucking minefield, and this is one area where the Rust zealots are undeniably correct. It doesn't have to be Rust, any memory safe language will do, but Rust also happens to be performance competitive and that's usually also desirable.

                                                • tialaramex 4 hours ago
                                                  The technology you want for this sort of work is WUFFS, for Wrangling Untrusted File Formats Safely.

                                                  Rust is a general purpose programming language, which is great if your problem might be something never imagined before, but this literally isn't our first rodeo, we have wrangled lots of file formats before, we should use a language purpose-built to do that safely.

                                                  • zamalek 4 hours ago
                                                    > Rust is a general purpose programming language

                                                    I don't understand how I hit the anti-Rust tripwire here:

                                                    > My comment: any memory safe language will do

                                                    • tialaramex 3 hours ago
                                                      Not an anti-Rust tripwire. Just that WUFFS is the appropriate technology.

                                                      I like 4th edition D&D but if you're trying to make a story about nuanced inter-personal conflict in which there's no actual violence it's just not the right roleplaying system and so I'm not going to agree with your choice to recommend 4eD&D as the system for the story "Love and Jealousy in the Elven Forest"

                                                      I've written a whole bunch of Rust, and hardly any WUFFS - but, I wasn't writing code for Wrangling Untrusted File Formats and that's very much what you're doing in a PDF parser.

                                                      • jeffbee 3 hours ago
                                                        I am a big fan of WUFFS but some recent developments by people assisted by AIs writing format parsers in other languages has made me question whether it will be maintained or forgotten.
                                                • tptacek 6 hours ago
                                                  I think the claim is hyperbolic, since most people memory-unsafe PDF implementations, but PDF is a monster format, a metaformat that brings in virtually every conceivable display format, and their renderer implementations with them, often poorly-maintained, never-touched reference implementations from the before times. PDF is pretty scary.
                                                  • cowlevel 5 hours ago
                                                    PDFs are usually untrusted input and C provides no assurance there isn't a bug in the code that allows corrupted input to turn into arbitrary remote code execution.
                                                    • F3nd0 4 hours ago
                                                      Other than Ada/SPARK, which languages can guarantee this won’t happen?
                                                      • cowlevel 3 hours ago
                                                        Very few languages can prevent you writing something like "if(text == "shibboleth") rootshell();" but most languages don't make it trivial to write accidentally.
                                                        • tialaramex 4 hours ago
                                                          This trivially can't happen in WUFFS. Forget RCE, WUFFS can't even do a traditional Hello World program because (1) you can't do I/O in WUFFS and (2) the language doesn't have strings.

                                                          https://github.com/google/wuffs

                                                      • recursive 6 hours ago
                                                        buffer overflow vulnerability in code dealing with user generated data and a complex file format.