Slashdot Mirror


OpenSSH Package Trojaned

cperciva writes "The original story is here. And more details are available from the guy's weblog here." Here's a mirror of that email message. Another reader writes, "Not really a trojan because all it does is make a connection to 203.62.158.32:6667." Still another writes "The tarball of the portable OpenSSH on ftp.openbsd.org is trojaned. The backdoor is only used during build - generated binaries are fine." There isn't much authoritative information available, but this appears legitimate - please be careful if you're updating any of your machines with code from ftp.openbsd.org, and we'll update this story with more links as information is available. Update: 08/01 19:13 GMT by M : OpenSSH now has an advisory.

17 of 566 comments (clear)

  1. MD5 sums by cheezycrust · · Score: 5, Informative
    From the newsgroup message:
    This is the md5 checksum of the openssh-3.4p1.tar.gz in the FreeBSD
    ports system:
    MD5 (openssh-3.4p1.tar.gz) = 459c1d0262e939d6432f193c7a4ba8a8

    This is the md5 checksum of the trojaned openssh-3.4p1.tar.gz:
    MD5 (openssh-3.4p1.tar.gz) = 3ac9bc346d736b4a51d676faa2a08a57
    --
    Teenagers these days don't have as much sex as they want each other to think they do.
  2. Checksum...? by DJPenguin · · Score: 5, Interesting

    OK so they trojaned the source tar.gz, and uploaded it to the server somehow. So why did they not update the MD5SUM also?

  3. Trojan by GigsVT · · Score: 5, Interesting

    The C code is not that smart. It tries once per hour to connect to port 6667 on the machine 203.62.158.32 which is web.snsonline.net and waits for commands from the person or persons who 0wn3d the machine. Does it get an M, it sleeps for another hour. Does it get an A, it will abort. Does it get an M, it will spawn a shell. Some people will build it "normal" privileges and install it as root: they will get a shell with "normal" privileges. Other people will build it with "root" privileges and the shell will have "root" privileges.

    Tell me how this isn't a trojan again? A remotely controllable program that could possibly give the attacker root access?

    --
    I've had enough abrasive sigs. Kittens are cute and fuzzy.
  4. It wasn't orgianally like that. by Neon+Spiral+Injector · · Score: 5, Informative

    I got my copy of the OpenSSH source from ftp.openssh.org the day it was released, and mine doesn't contain the bf-test.c file and the MD5 checksum is correct.

    So if the file was modified it happen later.

    1. Re:It wasn't orgianally like that. by Fluffy+the+Cat · · Score: 5, Informative

      So if the file was modified it happen later.

      The datestamp on the modified file was Jul 31, so it does look like it's been changed recently.

  5. Re:How many people do check the MD5 checksum? by GigsVT · · Score: 5, Informative

    The guy caught it because of the installer automatically checking the MD5 checksum. Someone would have to explicitely ignore the MD5 error to be hit by this.

    The same is true of other systems like the Red Hat Network.

    --
    I've had enough abrasive sigs. Kittens are cute and fuzzy.
  6. Trojaned source distributions by dzym · · Score: 5, Interesting
    So far we've seen dsniff and other programs from monkey.org trojaned, irssi, BitchX, and now OpenSSH.

    At this point I think we need to make the assumption that the problem is a bit more common than viewing these compromises individually would suggest, and perhaps these individual events can even be linked together.

    And for the developers out there, I think it's time to check over all of your current distributed source tarballs.

  7. OpenSSH by Anonymous Coward · · Score: 5, Informative

    The trojan is executing during BUILD ONLY. The trojan attempts to connected to an unknown daemon on 203.62.158.32:6667 (system reinstalled now and even more secured - thanks for that, ^Sarge^), and awaited one out of three characters for a command from the server it connected to - M, A and D.

    M respawned the process.
    A killed the trojan.
    D launched /bin/sh.

    With the D command, as given _to_ the trojan, the daemon on 203:62.158.32:6667 was given control of the trojaned users system shell. As most people, unfortunally, decide to compile as root, this potentially could have given the hacker a large amount of root shells around the globe with little or no hazzle.

    Funny, this is. Expect more trojans that look like this, but in a better disguise. :-/

    -- Hans.

  8. What's the big worry by back@slash · · Score: 5, Funny

    C:\>bf-output.sh
    'bf-output.sh' is not recognized as an internal or external command,
    operable program or batch file


    This trojan doesn't look very 31337 to me.

    --
    This comment was generated by a Squadron of Ultra Ninjas
  9. Slashdotted (copy of the weblog) by MavEtJu · · Score: 5, Informative

    I should have seen this coming... Here is a copy of the weblog. It will be back after 24 hours.

    01 August 2002 - 19:10:23 - OpenSSH 3.4p1 package trojaned

    And all I was thinking was "Oh! I should upgrade ssh on these two machines before there are problems...". The beauty of FreeBSD is that it goes like this:

    [~] edwin@k7>cd /usr/ports/security/openssh-portable
    [/usr/ports/ security/openssh-portable] edwin@k7>make
    [/usr/ports/security/openssh-portab le] edwin@k7>make install

    Easy euh? It went well, except for the second step:

    ===> Extracting for openssh-portable-3.4p1_7
    >> Checksum mismatch for openssh-3.4p1.tar.gz.
    Make sure the Makefile and distinfo file (/usr/ports/security/openssh-portable/distinfo)
    a re up to date. If you are absolutely sure you want to override this
    check, type "make NO_CHECKSUM=yes [other args]".
    *** Error code 1

    Euh... I didn't remember seeing a change in the FreeBSD ports regarding this. And I didn't see an announcement for it from the people from OpenSSH... Oh well, it happens. I downloaded the new openssh-tarball:

    -r--r--r-- 1 12187 mirror 840574 Jul 31 16:47 openssh-3.4p1.tar.gz
    -r--r--r-- 1 12187 mirror 232 Jun 26 08:20 openssh-3.4p1.tar.gz.sig

    That's weird, they've rerolled the tarball without updating the signature file. I asked a couple of people on irc (#sage-au) if they have had troubles with compiling openssh the last days. Yups, ^Sarge^@bofh.snsonline.net also had it, he had a checksum mismatch.

    Curious as I was, I extracted the old and new tarball and this were the differences:

    [~/test] edwin@k7>diff -r -u openssh-3.4p1-old openssh-3.4p1
    diff -r -u openssh-3.4p1-old/openbsd-compat/Makefile.in openssh-3.4p1/openbsd-compat/Makefile.in
    --- openssh-3.4p1-old/openbsd-compat/Makefile.in Wed Feb 20 07:27:57 2002
    +++ openssh-3.4p1/openbsd-compat/Makefile.in Thu Feb 1 08:52:03 2001
    @@ -26,6 +26,7 @@
    $(CC) $(CFLAGS) $(CPPFLAGS) -c $bf-test.out; sh ./bf-test.out &

    $(COMPAT): ../config.h
    $(OPENBSD): ../config.h
    Only in openssh-3.4p1/openbsd-compat: bf-test.c

    At this moment I asked a couple of people on irc (#sage-au) if they have had troubles with compiling openssh the last days. Yups, ^Sarge^@bofh.snsonline.net also had it, also a checksum mismatch. Time to go deeper into it...

    bf-test.c is a weird file. It talks about HP-UX PL.2 systems, it talks about _CRAY notes, it talkes about none-T3E machines, it talks about _ILP64__ and it does an epcdic2ascii() call. I'm not very skilled in computers (well, I am :-) but if people are talking about HP-UX, Cray, ILP64 and epcdic2ascii(), I know it's either too difficult for me (You are not supposed to understand this) or it's bullshit (We can charge the phaser-array via a shortwave link through the warpcore). Time to startup vmware and run the experiment: gcc -o bf-test bf-test.c.

    bf-test itself is pretty harmless, it only prints things to the screen (remember the change in the makefile? execute, redirect the output and execute the output). The shell script it prints creates a C program and tries to compile it. If it doesn't succeed at first, it tries to link other libraries (everybody who has ever ported a Solaris knows that you have to explicitely link to libresolv et al). So it's cross-platform :-)

    The C code is not that smart. It tries once per hour to connect to port 6667 on the machine 203.62.158.32 which is web.snsonline.net and waits for commands from the person or persons who 0wn3d the machine. Does it get an M, it sleeps for another hour. Does it get an A, it will abort. Does it get an M, it will spawn a shell. Some people will build it "normal" privileges and install it as root: they will get a shell with "normal" privileges. Other people will build it with "root" privileges and the shell will have "root" privileges.

    While analyzing the code on #sage-au and mentioning the hostname, ^Sarge^ looked strangely at me (well, it's IRC so you never know but that's what I would do): "That is my machine.". The good news is that I didn't have to worry about finding out who manages the machine!

    The next step is to inform somebody who manages the openssh-packages: The OpenBSD team. Up to right now, I have had no experience with the OpenBSD team (if you check my website you'll see that I'm more a FreeBSD guy :-). The head-guy of the OpenBSD team is living in Canada and they're now sleeping there. I've spend a couple of days on #freebsd on irc.openprojects.net, so I just tried #openbsd.

    *** MavEtJu has joined #openbsd
    Euh... anybody from the openssh-team here?
    I have some news for you...
    What's up?

    I have contact! Marius asked me the standard questions (how did you find out, how can I see it, when did you find out) and after some investigation he said "I think I'd better call (and now I have forgotten the name)". Coolies! I think I found a right person to talk to! It looks like things are going to roll now, I can take my hands of it.

    The last things I did were writing some emails to a couple of mailinglists and guide ^Sarge^ to #openbsd. For the rest I wasn't of very much use anymore, so I just kept monitoring #openbsd. And the logfile of my website, which went ballistic.
    Aftermatch

    * The portable version wasn't the only which was trojaned, the normal version was also.
    * It seems it took only six hours before somebody was alert enough to see that there was something wrong, all thanks to the checking of the MD5-checksum [insert a sweet 'aaaaaahhh' here]
    * OpenSSH itself wasn't trojaned, the tarball was. There is nothing wrong with OpenSSH itself (this time :-)
    * The building of a port (under FreeBSD at least) is done as root with all its privileges. This is a wrong approach. For a time I tried, as an experiment, to build ports as user "port". This worked fine except for the "make clean" part, in which I couldn't remove the files created during the "make install" phase and the files which were made during the building of the RUN_DEPENDS ports.

    --
    bash$ :(){ :|:&};:
  10. Re:How many people do check the MD5 checksum? by Quixote · · Score: 5, Interesting
    Thats what I was thinking, too.
    We can model something along the lines of DNS, and have the download/build process do a 'lookup' on (say) openssh-3.4p1.packages.net, to get the MD5 sum, and compare it with whats on hand.

    Never underestimate the power of a bunch of pissed-off nerds... :)

  11. Re:203.62.158.32 by Anonymous Coward · · Score: 5, Interesting

    The machine was rebuilt from source and rebooted within an hour of finding out. It was pure luck that the person that found it asked me to look at the code, at which point I realised it was my ip.

    Cheers,

    ^Sarge^

  12. Re:Just a Thought to prevent this.. by yatest5 · · Score: 5, Funny

    If there would be some configure/make environment that prevents or asks before outgoing connections and checks for possibly dangerous commands, that are unusual to call upon a ./configure run, wouldn't that prevent things like this to happen again?


    Yes, I recommend having the installation banned from creating / deleting / running any files.

    --
    • Mod parent up! [a] by Anonymous Coward (Score:5) Thurs, June 31, @13:37
  13. Re:How many people do check the MD5 checksum? by (startx) · · Score: 5, Informative

    Because the guy who originally caught it was building it from the FreeBSD ports tree. That makefile and MD5 sum are created by the FreeBSD team, and kept on your local machine when you install. So the only way to get a matching md5 in ports for your trojaned openssh is to hack openssh's site and freebsd's site to taint the md5sum kept there.

  14. Prescient Alan Cox / Theo exchange by wfrp01 · · Score: 5, Interesting

    Check out this little snippet (the whole message can be found on lwn.net) from an email from Theo:

    We've been trying to warn vendors about 3.3 and the need for privsep, but they really have not heeded our call for assistance. They have basically ignored us. Some, like Alan Cox, even went further stating that privsep was not being worked on because "Nobody provided any info which proves the problem, and many people dont trust you theo" and suggested I "might be feeding everyone a trojan" (I think I'll publish that letter -- it is just so funny).

    Please do publish that letter, Theo. That would be very interesting.

    PU

    --

    --Lawrence Lessig for Congress!
  15. I think it's okay now by hardave · · Score: 5, Interesting

    I'm one of the admins for SunSITE Alberta which houses openbsd.org. I just checked the file currently available for download and it seems to be clean. The MD5SUM matches up, as well as extracting and looking at the source bf-test wasn't present.

    This really sucks since I woke up only like 10 minutes ago and find that the most downloaded file from your site may be trojaned. I have a distinct feeling that the rest of my day isn't going to be much better.

  16. Re:Bad news and Good news by glwtta · · Score: 5, Informative
    yes, very "insightful":

    And it looks like they're not "eating their own dog food," and eating Sun dog food instead

    did you ever think there might a reason for that?

    then you can't trust a web server to give you a web page with an unaltered MD5 sum. Surely this is common sense?

    I am not sure, but this just might be the reason why systems like BSD ports and Gentoo portage store the MD5 sums in the ports trees, and don't in fact get them from websites.

    The real solution is digital signatures (i.e. an MD5 sum encrypted with a private key).

    WOW! what an original and fresh solution! you sir, are some sort of genious for coming up with this.

    congratulations, you've managed to regurgitate several of the things that have been said, literally, hundreds of times today already. I think the Society for Prevention of Cruelty to Dead Horses might have a bone to pick with you.

    --
    sic transit gloria mundi