Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Security Debian Encryption Software Linux

Debian Bug Leaves Private SSL/SSH Keys Guessable 670

SecurityBob writes "Debian package maintainers tend to very often modify the source code of the package they are maintaining so that it better fits into the distribution itself. However, most of the time, their changes are not sent back to upstream for validation, which might cause some tension between upstream developers and Debian packagers. Today, a critical security advisory has been released: a Debian packager modified the source code of OpenSSL back in 2006 so as to remove the seeding of OpenSSL random number generator, which in turns makes cryptographic key material generated on a Debian system guessable. The solution? Upgrade OpenSSL and re-generate all your SSH and SSL keys. This problem not only affects Debian, but also all its derivatives, such as Ubuntu." Reader RichiH also points to Debian's announcement and Ubuntu's announcement.
This discussion has been archived. No new comments can be posted.

Debian Bug Leaves Private SSL/SSH Keys Guessable

Comments Filter:
  • by Anonymous Coward on Tuesday May 13, 2008 @12:10PM (#23391926)
    And we were told this sort of bug could NEVER happen in an open source operating system. Seriously, this is a major cockup.
  • Re:It will be fixed (Score:3, Interesting)

    by JackieBrown ( 987087 ) on Tuesday May 13, 2008 @12:15PM (#23391986)
    As far as the bug linked for changes upstream (#477454,) is that seriously the best example of Debian not sharing changes back upstream?

    It seems more like an attempt to show that a maintainer was being petty which is not what the article was about.

    Does anyone one really think that this change would have been accepted upstream (or even have had a place for it there?)
  • by n0dna ( 939092 ) on Tuesday May 13, 2008 @12:17PM (#23392012)
    http://en.wikipedia.org/wiki/Linus's_law [wikipedia.org]

    I understand he's not unheard of in this arena.
  • by moderatorrater ( 1095745 ) on Tuesday May 13, 2008 @12:21PM (#23392056)
    I also remember some games being broken because you could save, and if the battle didn't go how you wanted it to, you could reload and try again. Nowadays, games tend to save the generator's seed so that things go the same way.

    The point is that encryption, proper randomization, etc are HARD and prone to a lot of errors. That's why you commit changes upstream, so that the people who did the work in the first place are able to review the change and let you know if you changed something vital to the security.
  • 2 years? (Score:5, Interesting)

    by Anonymous Coward on Tuesday May 13, 2008 @12:22PM (#23392068)
    The seeding was removed and it wasn't noticed for TWO YEARS? In a distro as popular as Debian?
  • by Anonymous Coward on Tuesday May 13, 2008 @12:24PM (#23392100)
    What business do they have going that deep within the code? I can understand modifying certain things to make the system more integrated (such as modifying the locations of files), but *WHY* on earth would you fuck around with the cryptographic algorithm? Stupid, stupid, stupid! And I'm not even totally opposed to the idea that this was intentionally done, either.

    This is going to make me seriously reconsider using Debian in the future. I always thought the OpenBSD guys were assholes. Now they're laughing at us.
  • by John Meacham ( 1112 ) on Tuesday May 13, 2008 @12:26PM (#23392108) Homepage
    Interestingly, another source of compromised security is seeding too often.

    http://lists.debian.org/debian-security-announce/2008/msg00152.html [debian.org]

    is an example of a vulnerability caused by seeding the random number generator with the current time right before use.
  • by mikael ( 484 ) on Tuesday May 13, 2008 @12:27PM (#23392114)
    There was a lawsuit story some time ago about a Las Vegas casino vs. a regular punter, over the use of a blackjack game. The punter had found a cabinet unit with a frazzled RNG, so it kept dealing the same sequence of cards every time. The punter managed to memorize the sequence, thus guaranteeing a win every time. Of course, the casino wasn't too happy about this.
  • by Peter H.S. ( 38077 ) on Tuesday May 13, 2008 @12:43PM (#23392322) Homepage

    Having the code is great, but this makes me want to know much more about who last edited that code.
    The great thing about the rpm package management system on Fedora and Red Hat is, that the source rpms always include the pristine, original sourcecode as provided by upstream. The rpm package of course also include separate patches and a .spec file that shows how the patches should be applied on the fly when the binary package is built.
    So if one didn't like the 'muppet.patch' included, one could always remove it before building the package. Much, much better than delivering a patched tarball.

    --
    Regards
  • Going to http://www.links.org/?p=327 [links.org] I read...

    OpenSSL happens to include a rare case when its OK, or even a good idea: its randomness pool. Adding uninitialised memory to it can do no harm and might do some good, which is why we do it.
    Uninitialised data doesn't seem to be a good source of randomness to depend on, since depending on where it happens you may consistently end up with a buffer that previously contained all zeroes (or some default memory test pattern), the same part of the same shared library header, or a series of stack frames that for whatever reason happen to be the same frames on every run.

    In fact I'd expect that separate runs of the same program with the same parameters and environment would leave the same junk on the stack every time.

    So I would hope that they have some better source of entropy than unpredictable uninitialized data of dubious randomness.

    So if this is really a serious problem, then it seems to me there's already a serious problem in OpenSSH.
  • by Yvanhoe ( 564877 ) on Tuesday May 13, 2008 @12:47PM (#23392374) Journal
    This could be very smart.
    Planting a vulnerability that has gone undiscovered for 2 years and that gave the keys to a lot of SSH servers. Genius !
  • Re:It will be fixed (Score:2, Interesting)

    by illumin8 ( 148082 ) on Tuesday May 13, 2008 @12:54PM (#23392448) Journal

    This means that anybody who's used Debian or a Debian derived distribution like Ubuntu needs to go back and destroy all host and personal keys generated since 2006. All of those keys are potentially guessable.
    Great... just when I had mostly convinced the PHBs in management that yes, open source software was trustworthy, and that yes, good developers write Linux, and that no, you don't always get what you pay for, and answered all the hundreds of questions about "why do you think they would develop this software for free?" Now some jackass that shouldn't have even been touching this code fucks around with OpenSSL... I'm not trolling, but maybe open source isn't ready for the enterprise. If some coder did this at a company at least I'm pretty confident they'd get their ass fired, but with open source it's basically "whoops, my bad."
  • Re:2 years? (Score:5, Interesting)

    Hang on. There was a story here the other day about a bug in BSD that had been carried down to all its descendants (FreeBSD, OS X, NetBSD etc) for twenty-five years without anyone noticing. Two years is nothing.
  • by ewhac ( 5844 ) on Tuesday May 13, 2008 @01:27PM (#23392850) Homepage Journal
    Does anyone have any back-of-the-envelope calculations as to how badly this compromises existing keys? That is to say, about how long is the brute-force lifetime shortened? If it's been shortened from the age of the known universe to 300 hours, then that's a problem I need to address fairly immediately. OTOH, if it's been shortened to one-quarter the age of the known universe, then I'm not going to deal with this before I've had more coffee...

    Schwab

  • by Deanalator ( 806515 ) <pierce403@gmail.com> on Tuesday May 13, 2008 @01:28PM (#23392858) Homepage
    From this log: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=363516 [debian.org]
    It looks like openssl is pulling in "entropy" from uninitialized memory, causing valigrind to complain. The debian maintainer "fixed" this issue by memsetting the buffer to zero.

    My question is, wouldn't I see the same behavior using grsecurity to scrub deallocated memory? From what I am seeing, this looks much more like the fault of the openssl team.
  • Re:It will be fixed (Score:5, Interesting)

    by IamTheRealMike ( 537420 ) on Tuesday May 13, 2008 @02:16PM (#23393586)

    He would have been told, but who says he would have cared? This happens all the time, although usually it doesn't result in a giant fucking security hole. I was warning people this sort of thing would happen more than two years ago back when I was working on autopackage. It was entirely predictable.

    Having distributors randomly change source code as they package it is fundamentally broken. It cannot ever work. It's not just OpenSSL that's been broken like this. Wine often went through periods in which the Debian packages were completely hosed in subtle ways. It would look like a bug in Wine, but was in fact due to parts of the software "going away", because the Debian packager felt they weren't important enough to be a part of the base install. Pointing out that their change was broken didn't help. The result was many, many hours wasted tracking down non-bugs. Then you go through a giant waste of time trying to get the bug in the packages fixed, and just as you finally get it sorted out, some other distribution introduces some other bug into their packages.

    So I got sick of this, and started telling people to avoid their distros packages. Some distributors (especially Debian) took it personally and started childish slanging matches. But really, who cares how "integrated" a program is, if it could have had arbitrary bugs silently introduced? It's just a busted model of software distribution.

    Imagine if Microsoft reserved the right to modify any software for Windows in any way it saw fit! Yet that's exactly what Debian (and Fedora and Mandrake and Ubuntu) said to me - they reserve the right to make any modifications they like to the software they ship, and if upstream don't like it, tough luck.

    I wonder if they'll re-evaluate that policy in light of this disaster. Probably not.

  • by Kent Recal ( 714863 ) on Tuesday May 13, 2008 @02:29PM (#23393766)
    Thanks to you and the other guys who responded and confirmed.
    I have now patched my firewall and ssh config to (hopefully) limit any bruteforcing to one attempt per minute: /etc/sshd/sshd_config
    MaxAuthTries = 1 /root/bin/firewall
    iptables -I INPUT -p tcp --dport 22 --syn -m limit --limit 1/minute -j DROP

    Ofcourse what remains is the question of how many attempts would be realistically needed to break a weakened key?
    I'm eager to see the first proof-of-concept exploit.
  • by omz ( 834760 ) on Tuesday May 13, 2008 @02:31PM (#23393794)

    Found this post at openssl-dev list by Kurt Roeckx ( AFAIK the Debian OpenSSL Team member that made this RNG-clean patch )

    http://www.mail-archive.com/openssl-dev@openssl.org/msg21156.html [mail-archive.com]

    Extract:

    "What I currently see as best option is to actually comment out those 2 lines of code. But I have no idea what effect this really has on the RNG. The only effect I see is that the pool might receive less entropy. But on the other hand, I'm not even sure how much entropy some unitialised data has.

    What do you people think about removing those 2 lines of code?

    Kurt

    "

    BTW, i thought that Debian had some kind of policies about testing each package before committing changes in testing/stable branches. Also, the following paper, contributed by another poster, says interesting things about touching cryptographic code, we have to learn from this experience and have tighter policies !

    " In a narrow sense, the security flaw we found in the Netscape browser serves merely as an anecdote to emphasize the difficulty of generating cryptographically strong random numbers. But there's a broader moral to the story. The security community has painfully learned that small bugs in a security-critical module of a software system can have serious consequences, and that such errors are easy to commit. The only way to catch these mistakes is to expose the source code to scrutiny by security experts.

    Peer review is essential to the development of any secure software. Netscape did not encourage outside auditing or peer review of its software-and that goes against everything the security industry has learned from past mistakes. By extension, without peer review and intense outside scrutiny of Netscape's software at the source-code level, there is simply no way consumers can know where there will be future security problems with Netscape's products. "

    http://www.cs.berkeley.edu/~daw/papers/ddj-netscape.html" [berkeley.edu]

  • by Urban Garlic ( 447282 ) on Tuesday May 13, 2008 @02:34PM (#23393824)
    Doesn't this mean that all the "etch" host keys are vulnerable, too, on an ongoing basis?

    SSH host keys are generated at sshd install time, and that package is included on the netinstall CD-roms, which means every time I re-use my 4.0r1 netinstall CD to set up a new box, I generate a new set of vulnerable host keys before I get to the security-updates step.

    Hopefully, they'll advance the next point release and a 4.0r2 netinstall CD will do better.
  • by hackstraw ( 262471 ) on Tuesday May 13, 2008 @02:53PM (#23394078)
    It looks like openssl is pulling in "entropy" from uninitialized memory, causing valigrind to complain. The debian maintainer "fixed" this issue by memsetting the buffer to zero.

    If you look further down the code, it then fills up the buffer with stuff from some random device (/dev/random /dev/urandom, or other things found in ./configure).

    AFAIK, all modern Linux implementations have /dev/urandom and isn't that enough entropy for a seed?

    I only spent a minute looking that the code and the diff in the parent's post, but this is looking not to be a bug to me. But, like I said that I didn't look at the code that long, but I don't see where memsetting the memory makes any difference if its all being overwritten.

  • Re:It will be fixed (Score:2, Interesting)

    by noahm ( 4459 ) on Tuesday May 13, 2008 @03:04PM (#23394214) Homepage Journal

    Imagine if Microsoft reserved the right to modify any software for Windows in any way it saw fit! Yet that's exactly what Debian (and Fedora and Mandrake and Ubuntu) said to me - they reserve the right to make any modifications they like to the software they ship, and if upstream don't like it, tough luck.

    Though, as has been pointed out elsewhere, the Debian package maintainer did raise this issue with the openssl developers [marc.info], and was basically told "go ahead, it's OK."

  • by Anonymous Coward on Tuesday May 13, 2008 @03:06PM (#23394256)
    Since all the random data isn't being used, openssl only uses the processID as a random seed, thus for every ssh key type there are 2^15 possibilities.

  • by speedbiker ( 1234566 ) on Tuesday May 13, 2008 @04:32PM (#23395396)

    Wow, that was still a really stupid patch. There was an #ifndef PURIFY there for a reason. It's because the openssl authors knew that line would cause trouble in a memory debuger like Purify or Valgrind. http://en.wikipedia.org/wiki/IBM_Rational_Purify [wikipedia.org]
    Actually, Kurt did ask on openssl-dev whether this change is acceptable, and did not get any answer that this would be a no-no (his mail and subsequent answers can be seen here [marc.info]).
  • by this great guy ( 922511 ) on Tuesday May 13, 2008 @06:02PM (#23396624)

    A similar story is described in the book The Art of Intrusion by Kevin Mitnick. Mitnick interviewed someone who claimed to be part of a group of 4 friends who bought a slot machine, reverse engineered the firmware, the game application, the pseudo random number generator, etc. They found a flaw in the PRNG, were able to determine its internal state by watching the cards dealt so far, and were able to develop an algorithm able to predict the outcome of the game.

    Then they built a small portable device to run their algorithm on-site, in casinos using the exact same slot machine model. It is rumored they won a lot of money this way and took enough precautions to never being caught (I guess they spread their attack over a large number of casinos/cities and multiple years).

    Of course the story is anonymized so can't be verified. And it is in Mitnick's interest to have exciting stories in his book. But IMHO the attack looks totally plausible. Game developers usually have no security background, especially regarding how to design a secure PRNG.

  • by Serious Callers Only ( 1022605 ) on Tuesday May 13, 2008 @06:42PM (#23397048)
    I believe the security update will automatically prompt you to regenerate the host key (it did for me at least on ubuntu), so it shouldn't really be an issue.

    If the host keys are vulnerable on a server, doesn't this just leave you open to a man in the middle attack anyway? That's not as serious as generating keys you use to login with, in which case you need to regenerate those as soon as possible. Is it possible to break into a server just by guessing the host or server keys?
  • by an.echte.trilingue ( 1063180 ) on Tuesday May 13, 2008 @07:12PM (#23397356) Homepage
    I am going to hijack this thread because I have an eCommerce site hosted on Debian and this made me nervous.

    According to the reps at Thawte, if you are using a third party ssl cert (thawte, verisign, etc), this does not affect you. According to them, this is only dangerous for people who have generated their own SSL certs for their sites from the ground up (probably a minority, I would guess). If anybody has any information to the contrary, please let me know.
  • by sunbird ( 96442 ) <sunbird@riseup . n et> on Wednesday May 14, 2008 @11:05AM (#23403352)
    Look on your CA website for the contract that governs your CA. It should have a clause on revocations. For example, this is the .pdf for ipsCA's contract [ipsca.com] (.pdf, only in Spanish) and it clearly provides that if there's a problem with the certificate that makes it untrustworthy, you get a new one for free.

    This is page 45-46, which talks about the reasons why a certificate may be revoked:

    Los Certificados deberán ser revocados cuando concurra alguna de las circunstancias siguientes:
    *snip*
    Por cualquier causa que razonablemente induzca a creer que el servicio de certificación haya sido comprometido hasta el punto que se ponga en duda la fiabilidad del Certificado.

    Rough translation: The certificate may be revoked when ... there's something that makes you reasonably believe that the certificate has been compromised to the point that it is not reliable.

    And then on page 47 it says:

    La revocación del Certificado por causa no imputable al Suscriptor originará la emisión de un nuevo Certificado a favor del Suscriptor por el plazo equivalente al restante para concluir el período originario de validez del Certificado revocado.

    Rough translation: If the revocation of the certificate is not the fault of the subscriber (that's you), then you get a new certificate with the same validity period as the old one.

    Obviously, you have to check with the contract governing your CA, but you might find something similar, so check with your CA before paying for new certs.

  • by Mysteray ( 713473 ) on Wednesday May 14, 2008 @06:44PM (#23411160)
    https/ssl/tls/ssh etc use the certificates to agree on a conventional "session key" every time you connect. Session keys are typically chosen with strong random numbers... but if either the client or server is using the OpenSSL from Debian Etch, there's nearly no randomness in it.

    Even if your certs are fine, individual transactions are likely vulnerable.

    If someone has taken packet captures, they will likely be able to decrypt them retro-actively.

Living on Earth may be expensive, but it includes an annual free trip around the Sun.

Working...