Slashdot Mirror


CERT Warns Of Multiple Vulnerabilities In Libpng

jefftp writes "CERT announced today that there are several vulnerabilities in libpng, one is a buffer overflow which could potentially cause a PNG image file to execute arbitrary code. Libpng release 1.2.6rc1 addresses the problems covered by this CERT announcement, and can be obtained from the libpng Sourceforge project. A fully tested version is to be released in the next few weeks."

50 of 259 comments (clear)

  1. Firefox by dolmen.fr · · Score: 2, Interesting

    Is Mozilla/Firefox/Thunderbird using this lib ?

    1. Re:Firefox by black+mariah · · Score: 5, Informative

      Yes. Most everything on Linux that reads or writes PNG's uses it.

      --
      'Standards' in computing only impress those who are impressed by things like 'standards'.
    2. Re:Firefox by beardz · · Score: 4, Informative

      New builds of Mozilla / Firefox / Thunderbird have been released to patch four potential security vulnerabilities including the libpng issue

  2. Mozilla by KidSock · · Score: 2, Interesting

    So does mozilla statically or dynamically link with libpng?

    1. Re:Mozilla by slashdevslashtty · · Score: 4, Informative

      According to this, libpng is part of the source tree. My guess is static.

      --


      M$ Lawyer: But `gcc /dev/random -o kernel.dll` is our trade secret!
    2. Re:Mozilla by Theril · · Score: 5, Funny

      Sure it could. Implement image loading and rendering in Java and nobody has patience to load images anymore.

    3. Re:Mozilla by evil_one666 · · Score: 2, Informative

      I wrote a GIF library in JAVA to display animated gifs on java 1.0 and it was reeeeeeeaaaaaally sloooooooow. It would however not be possible to exploit a buffer overflow on such a decompressor...

    4. Re:Mozilla by forgoil · · Score: 4, Informative

      Buffer owerflow attacks won't happen in languages which doesn't "support" that feature, such as perl, python, ruby, java, C# (any managed code), or managed C++ for that matter.

      Another way of killing the problem is using the NX (I hope I got that correct) instruction/bit in newer CPUs and simply separate code and data, and not allow execution in a data segment. Win SP2 does this, I am sure Linux does/will soon, one of the BSDs have done stuff like this for a while, etc.

      So yes, you would prevent it. But then again, calling a javalib from C... :)

    5. Re:Mozilla by FireFury03 · · Score: 2, Informative

      Another way of killing the problem is using the NX (I hope I got that correct) instruction/bit in newer CPUs and simply separate code and data, and not allow execution in a data segment. Win SP2 does this, I am sure Linux does/will soon

      Yep, Fedora Core 2 has done this since one of the early kernel revisions (I think it was when they went from 2.6.5 to 2.6.6)

    6. Re:Mozilla by Anonymous Coward · · Score: 2, Informative

      " Buffer owerflow attacks won't happen ... using the NX"

      No, you can still overflow the buffer, thus being able to modify the return pointer, and some variables. What does this mean? If you were lucky/elite, you could get it to jump to a different function. Sure it's not executing your own instructions from the stack, but it's still control.

      thanks,
      jacob

  3. Diagram by skraps · · Score: 2, Funny

    Here is a .PNG file with a diagram that explains the problem.

    --
    Karma: -2147483648 (Mostly affected by integer overflow)
  4. Old news by Anonymous Coward · · Score: 2, Interesting

    ...thanks to the Debian Security mailing list, my systems were secured against this hours before it even made it to /.

    1. Re:Old news by LiquidCoooled · · Score: 5, Funny

      "Submissions review procedure" ?

      Taco: "Wooah! this Doom 3 is excellent!!!!"

      Michael: "Anyone else gettin 503s?"

      Simoniker: "Is anybody doing ANY work?"

      Tim: "Simon - yer, just gettin submissions - omg, another 400"

      Taco: "Die scum die!!"

      Michael: "I give up, anyone wanna 7up?"

      Taco [Looking up from game for a minute] "Yer go on then!"

      Taco: "Tim, Throw another story onto the site, the natives are gettin restless."

      Tim: "eeny, meeny miny mo...."

      --
      liqbase :: faster than paper
  5. Ah-ha! by iamdrscience · · Score: 5, Funny

    You all complained about Internet Explorer not being able to display PNGs correctly, but who's laughing now! Obviously they broke PNG support intentionally for security reasons. Once again, Microsoft comes through on the cutting edge.

    1. Re:Ah-ha! by Nerull · · Score: 5, Informative

      I know its a joke, but it seems to work in IE as well, or at least an example PNG crashes it, i suppose one could be crafted for IE to exploit it.

    2. Re:Ah-ha! by billatq · · Score: 2, Interesting

      Someone who saw the leaked source code a while back happened to mention to me that Internet Explorer uses libpng for rendering PNG files--it's just broken because it uses such a friggin' old version of it. So there's a good chance that IE is affected too.

  6. well by Anonymous Coward · · Score: 3, Funny

    it's a good thing all of the porn sites i visit use jpegs

  7. Updates by Sunspire · · Score: 3, Informative

    Fedora Core 1 and 2 already have backported security updates for this as 1.2.5-7 and 1.2.5-8 respectively since yesterday. Much better than having to install a release candidate.

    --
    It's like deja vu all over again.
  8. Bug? it's a feature! by barcodez · · Score: 4, Funny

    a buffer overflow which could potentially cause a PNG image file to execute arbitrary code

    This is not a bug it's a feature; the libpng team are obviously trying to get a piece of the ActiveX control market...

    --

    ----
  9. Re:Didn't this happen with BMP? by noselasd · · Score: 5, Informative

    Well, _lib_png have many, many jmp like instructions, they're called
    function calls, and if you manage to overwrite the return address on the stack, you can make it jump anywhere, like the code you injected.
    Hopefully it's just the stack you can overflow, most of us should run with a no executable stack theses days, no harm done(well, it probably crashes.. )

  10. Re:php ! by Anonymous Coward · · Score: 5, Funny

    Seriously, we need a "Dumbass" mod option

  11. Gentoo by AliasTheRoot · · Score: 2, Interesting

    I just emerge synced and the latest version available is still libpng-1.2.5-r7

    1. Re:Gentoo by Sunspire · · Score: 4, Informative

      Yeah it's still not fixed, but when an updated package is available it will still most likely simply be versioned 1.2.5-r8. You can keep a watch on the package and see immediately when it's fixed here.

      --
      It's like deja vu all over again.
    2. Re:Gentoo by AliasTheRoot · · Score: 3, Insightful

      just ignore advocates, they'll go away eventually :)

      gentoo is good for me, i don't think it's good for everyone - but i'm not everyone, i'm me.

      my wife and my mother both use win2k and thats whats good for them, i help them out with patches and suchlike but neither of them really want to care about having gcc or whatever installed.

      like i said, it's all about choice.

  12. It's a decoder problem by Snaapy · · Score: 5, Informative

    "And how many PHP sites/scripts dynamically generates .png files ? Quite a lot I'd think, so, webservers might be vunerable, but it seems
    like a longshot to try to inject something to such scripts."

    Did you read the article? You don't seem to understand the point here.

    The bug affects only loading of PNG images. One can make a specially crafted PNG image which has some invalid fields causing problems in the decoder. The invalid handling of these special error cases may cause an application crash or potential execution of arbitary code in the application which uses libpng.

    It is not possible to introduce malicious RAW image data to the encoder. And even if it was possible, you should be able to pump data directly in the encoder, which is not a usual case with dynamically generated images. So, your PHP site is safe.

    However, libpng is the most commonly used PNG implementation due to it's free licence. These bugs affect to very many applications (graphics applications, Office applications, user interface managers, browsers, etc.) which happen to use PNG.

    A similiar case like this was zlib bugs some time ago.

  13. Buffer overflow *again*? by Anonymous Coward · · Score: 2, Interesting

    We've all heard about buffer overflow problems in countless programs and libraries again and again. I'm not a programmer, but as I under stand it, the problem is writing to unallocated memory areas. But this is not a new problem, it has happened for ages. Is it really that difficult to avoid? I understand that libpng as a "building block" library needs good performance, but is it really that much of a problem to write things in safer programming languages that don't allow these kind of problems? Can some seasoned programming gurus here enlighten me here?

  14. Re:php ! by dolmen.fr · · Score: 3, Insightful

    The article is about PNG, not PHP.

    Of course, but this means that free PHP hosting services are at risk, as some malicious users will try to exploit this flaw on the server side.

  15. PNG security threat by Anonymous Coward · · Score: 2, Funny

    Is there oil at Papua - New Guinea?

  16. Combine this... by cperciva · · Score: 4, Informative

    ... with this, and Linux gets to join the "visit a malicious website and get rooted" crowd.

    1. Re:Combine this... by achurch · · Score: 2, Informative

      As far as I can tell, that only lets you read memory, which doesn't let you root anything. In fact, I tried the test and though it claimed to have worked, all I got was /proc/mtrr followed 64MB of zeros, which seems odd since my machine's been up long enough that all my physical memory should have been stomped on at some point.

      So yes, these are both serious problems, but they still don't boost Linux up into that vaunted "rootable group". (:

  17. The latest SP2 fixes it. by WhoDaresWins · · Score: 5, Informative
    I know its a joke, but it seems to work in IE as well, or at least an example PNG crashes it, i suppose one could be crafted for IE to exploit it.
    Well using XP SP2 RC2 build 2162 it does nothing in IE other show a broken image link. Whatever Microsoft did in SP2, it seems to have mitigated it. They did recompile major parts of the OS for SP2 with the /GS VC++ stack checking compiler flag. That could have caught it. Or it could be that they were informed about it before full disclosure and they fixed it in SP2. Or that they don't use libpng and their library does it correctly or they fixed the issue by themselves. Whatever be it they seem to have taken care of it. BTW the built-in Windows Picture and Fax Viewer also doesn't crash (nor does mspaint). You can test this out yourself if you have SP2 (don't know if builds earlier than 2162 fix it though) using this image link (Warning! Will crash non patched browsers!) from the original disclosure.

    Its reassuring that for once MS has already taken care of some security issue (for XP SP2 at least).
    1. Re:The latest SP2 fixes it. by Nerull · · Score: 3, Informative

      Try This image

      I got it from the bugzilla entry about the libpng issues.

      Actully, that image and the one above produce 2 diffrent effects in IE now that ive tested both, maybe its a diffrent issue that got mixed in the same bugzilla entry.

  18. Arbitrary Code...? by Anonymous Coward · · Score: 2, Funny

    What is arbitrary code? How is it any different as compared to any other computer code, say a piece of software?

  19. Re:WinXP by Anonymous Coward · · Score: 2, Informative

    Sorry I am kinda new to png stuff... can anyone explain how this might effect my Windows XP box? Should I go get the patch for my system? btw I am running Windows XP professional with service pack 1. Thanks in advance.

    ! - in case this is for real.

    PNG is an image format. It's very popular. There's a free (not copyleft free) library that anyone can put in their software to handle the PNG format.

    There's a problem with this free library. If you're using software with a broken version of this library, you'll need to update the software.

    The XPSP2RC has either fixed or sidestepped the issue. If you want that, you can get it from Windows Update (v5). But it's still a release candidate so you might prefer to wait.

  20. Debian by Fuzzums · · Score: 3, Interesting

    Within an hour (or so) after the CERT-mail I also got the Matt Zimmerman-mail.

    Fixed :)
    I love this!

    Thanks Guys!

    --
    Privacy is terrorism.
  21. SuSE patch also already available by Anonymous Coward · · Score: 2, Informative

    I just patched my SuSE box. Man that was fast ... or perhaps .. it is because Germany is 6 hours ahead of me.

  22. Attribution? by Quixote · · Score: 2, Interesting
    Would it be too much to ask whose code was it that had the vulnerability?

    I think it is time we started attributing vulnerabilities to the authors (just as we do with companies).

    1. Re:Attribution? by FireFury03 · · Score: 2, Insightful

      If you do that (which is probably a good idea) you'll need to weight it based on the amount of code written by that author that _could_ contain a security hole. Otherwise the stats will just show that the authors who write 99% of the complex network-facing code are responsible for most security holes.

    2. Re:Attribution? by pclminion · · Score: 2, Insightful
      I think it is time we started attributing vulnerabilities to the authors (just as we do with companies).

      Terrible idea. I can tell you right now, if I knew I'd be held personally responsible for bugs in open source software I contributed to, I would not contribute. If you want me to take responsibility for my bugs, give me money.

      If you don't like buggy free software, don't use it. What you're describing sounds almost like an inverse meritocracy, where people get branded if they don't write code that's "good enough." All that serves to do is scare people away from contributing.

      What's really irritating to me, is that often times the people bitching the loudest are unwilling and unable to contribute to such projects themselves. Sorry, but I'm not going to subject myself to a bunch of amateur sideline criticism. It ain't worth it.

  23. Re:Didn't this happen with BMP? by FireFury03 · · Score: 2, Interesting

    most of us should run with a no executable stack theses days

    Ah, you mean the vast majority of people are now running Athlon64's? (tip: Plain IA32 CPUs don't support the NX bit).

  24. Re:Didn't this happen with BMP? by noselasd · · Score: 3, Informative

    This explains how it's done:
    http://people.redhat.com/mingo/exec-shield/ ANNOUNC E-exec-shield

  25. Another exploit in libpng by ShadowRage · · Score: 4, Interesting

    image bombs. basically, you create a 190000x190000 pixel monochrome image, save it, and it compresses to 43 kb

    anyone opens it... *BAM* it expands into 2gb of ram.

    1. Re:Another exploit in libpng by thogard · · Score: 4, Interesting

      This is a problem? I've got about 300 people try to anon-proxy through one my servers every day. When they ask for a gif (or png or whatever) would be a nice to give them something to make them go away.

  26. BOEM. by leuk_he · · Score: 2, Informative

    Microsoft internet explorer has encountered a problem ands needs to close. we are sorry for the inconvience.

    bla bba
    [x] restart mirosoft internet explorer ...

    [b]WOW[/b], it is a portable bug!

    can anybody tell us if this is exploitable?

  27. Bugs in Compilers... by Tom7 · · Score: 2, Interesting

    On the other hand, it's quite difficult for a bug to creep into a compiler's bounds checking code (which is typically very simple). I know of no such historic examples, though perhaps this is because relatively few apps actually use safe compiled languages. (It would presumably have to be matched by a bug in the application code...) Interpreters and JIT compilers are much more subject to this kind of problem, particularly if they are written in C themselves. ;) There have been a few JVM exploits historically, though it is still much easier to make a secure JVM than to make tens of thousands of secure applications.

    Finally, remember that even C has the burden of bugs in its compiler, runtime, and libraries, so this argument is useless at differentiating between C and safe compiled languages (unless you can argue that the latter have more complicated support code).

  28. Re:How old is it REALLY? by Waffle+Iron · · Score: 2, Informative
    Programmers and advanced sysadmins can get a fixed version right now. Every normal person has to wait "a few weeks".

    Umm... the point-and-drool update utility in my SuSE box automatically installed the patch last night. No programming or advanced sysadmining was required on my part.

  29. Canary by bsd4me · · Score: 3, Informative

    You can protect against this to. The technique is put a ``canary'' on the stack frame and make sure it is still there before you return.

    There are at least two patches to gcc that do this. One is called ProPolice. The name of the second is escaping me right now. OpenBSD includes ProPolice by default.

    Google on stack-smashing protectors for more info.

    --

    (S(SKK)(SKK))(S(SKK)(SKK))

  30. Official Language-based security thread! by Tom7 · · Score: 2, Insightful

    (This troll would be more effective if not posted anonymously.)

    Indeed this flamewar has been repeated many times. Safe languages do indeed provide protection from these kinds of attacks and typically at a fairly small speed penalty (depending on the language; the number-two language on that list is safe and places above C++!).

    See the earlier slashdot discussion for loads of argument. ( here for my perspective--note, I am a tower-in-the-sky PhD student in programming languages, but I do write lots of code in many languages, including C and C++.) I am still boggled that programmers who claim to be interested in security (and who moreover claim to be uninfluenced by marketing and "cool", but rather by technical concerns) still choose C or C++ for their projects.

  31. Mitigation... by Chief+Typist · · Score: 2

    It appears to me that this problem exists at both the client and the server.

    Updating a server to use the patched version of libpng is an obvious first step. You don't want the buffer overflow compromising security as you deliver a .png file (which would only be an issue if you read the .png from the server before delivery.)

    The tricky part is what to do with the .png files that have been tampered with. You don't really want to serve those up to clients -- you'd be delivering a security risk. There will be a significant lag before client software is updated -- browsers and anything else that streams .png over a network connection will be at risk during this time.

    It seems to me that there's a need for some kind of scanning tool that checks for bogus .png files. At the server side, you could scan for compromised files and get rid of them.

    Does such a tool exist?

    -ch

  32. Where's the outcry? by rd_syringe · · Score: 2, Insightful

    If this was a Microsoft thing, Slashdot would be all over it. Arbitrary code execution from an IMAGE READING LIBRARY?!

    Just the obligatory "perspective" post. :)