Slashdot Mirror


Multiple FLAC Vulnerabilities Affect Every OS

Enon writes "eEye Digital Security has discovered 14 vulnerabilities in the FLAC file format that affect a huge range of media players on every supported operating system (Windows, Mac OS, Linux, Unix, BSD, Solaris, and even some hardware players are vulnerable). Heise points out a number of vulnerable apps that use the open source libavcodec audio codec library, which in turn relies on the flawed libFLAC library. These vulnerabilities could allow a person of ill will to trojanize FLAC files that could compromise your computer if they are played on a vulnerable media player. eEye worked with US-CERT to notify vulnerable vendors."

22 of 360 comments (clear)

  1. Re:Jailbreak!! by Winckle · · Score: 2, Informative

    Apple doesn't support FLAC, they want people to use the Apple lossless codec. Which annoys me tbh, there's no technical reason why they can't play both.

  2. Re:root listens to audio? by springbox · · Score: 4, Informative

    root listens to audio?

    Yes. Windows.

  3. Re:losslessly compressed by Locklin · · Score: 3, Informative
    http://en.wikipedia.org/wiki/Flac

    Free Lossless Audio Codec (FLAC) is a file format for audio data compression. Being a lossless compression format, FLAC does not remove information from the audio stream, as lossy compression formats such as MP3, AAC, and Vorbis do. Like other methods of compression, FLAC's main advantage is the reduction of bandwidth or storage requirements, but without sacrificing the integrity of the audio source. For example, a digital recording (such as a CD) encoded to FLAC can be decompressed into an identical copy of the audio data. Audio sources encoded to FLAC are typically reduced in size 40 to 50 percent. (53% according to their own comparison)
    It's like a zip/bzip/gzip file, once uncompressed, it's binary equal.
    --
    "Knowledge is the only instrument of production that is not subject to diminishing returns" -Journal of Political Econom
  4. Re:losslessly compressed by CastrTroy · · Score: 4, Informative

    It's kind of like running winzip on your wav files. All the data is there, but it fits in a smaller space. Of course, they don't use winzip's compression algorithms because that's really bad at compressing audio. They have special algorithms that are much better at recognizing patterns in wav files. I'm not completely sure how it works, but that's my understanding of it, and the easiest I can explain it.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  5. Re:losslessly compressed by Phlegethon_River · · Score: 2, Informative

    Just think about "ziping" a text file. It is smaller than the original file ("compressed") yet when you "unzip" it ALL of the information is still there ("lossless").

    FLAC and SHN (shorten) are basically fancy ways of "ziping" a file of audio. So, they are effectively the same thing as the original WAV (what is on the CD).

    This of course leaves out any discussion on digital v. analog audio quality, but that is beside the point.

    Yes, I over-over-simplified. But it gets the point across.

  6. Re:losslessly compressed by recoiledsnake · · Score: 4, Informative

    If you rip a Audio CD to MP3,AAC,WMA or OGG that is lossy compression. There is no way of getting the original data back. If you compress it with FLAC, you can get the exact bits present on the original Audio CD. Note that we are talking about only digital conversions. How the CD was mastered from the analog source is a complete different matter and has nothing to do with FLAC.

    --
    This space for rent.
  7. Fixed in Ubuntu by coolhelperguy · · Score: 3, Informative

    If you're using Ubuntu, the latest security updates should have fixed this already (for a few days, I believe). The Ubuntu security team has USN-540-1 as a notification. It looks like it's an issue in Ubuntu 6.06 LTS, Ubuntu 6.10, Ubuntu 7.04, and Ubuntu 7.10 (at least), and their respective Kubuntu/Edubuntu/Xubuntu releases.

    All you really need to update looks to be libflac7 or libflac8, whichever exists on your system (8 is only for Gutsy, aka 7.10), though it's probably a good idea to update all the security updates anyway.

  8. Re:root listens to audio? by gnuman99 · · Score: 4, Informative

    root listens to audio?
    Yes. Windows.

    No. Vista.

    And no you will not get one of them "You want to proceed with blah?" windows because an exploit will not have a manifest. It is difficult to get Vista hosed by malware compared to XP.
  9. guard pages, bit masks, and so on: better by r00t · · Score: 5, Informative

    Lots of people screw up the sanity checks. C has some interesting properties that people struggle with: signed+unsigned promotes to unsigned, and the compiler is allowed to generate code which assumes that signed wrap-around will never happen. Plus people just plain screw up. I'll bet the FLAC code even had sanity checks, just not correct ones.

    Sanity checks are also low-performance.

    Suppose you want a 1 MB buffer. Allocate that, plus 2 pages, plus another page if your allocator doesn't give you page alignment. (mmap does, malloc does not -- you should use mmap to be 100% legit here) Round up to a page if you used malloc. Make that page unreadable via the mprotect call. The next page will start your 1 MB buffer. After the end of that buffer is one more page that you also make unreadable. Now you're safe from regular overflows in that buffer.

    You still risk jumping out of the buffer when you add a potentially big offset. Here, you use the mask. Take an offset into the buffer, add/subtract the untrusted data, mask with 0xfffff for 1 MB, and now you have a fresh new offset that will be within the buffer.

    Regular overflows will hit the unreadable page. If you do nothing extra, the result is a safe crash. You might use the fork call to create a child process that you don't mind losing. Alternately, you can use sigsetjmp and siglongjmp to handle the situation. Set up a signal handler for signal 11 that will call siglongjmp. Call sigsetjmp prior to entering the code which handles untrusted data. If the code takes the exception path (signal and siglongjmp), then you know the untrusted data was bad. (for extra points, verify that the guard page was hit and call _exit if not -- see the sigaction documentation for how to get this info)

    1. Re:guard pages, bit masks, and so on: better by sowth · · Score: 4, Informative

      I didn't say you claimed sanity checks weren't needed at all. I said this guy's proposal was a valid thing to add to a program and anything to make sure your program doesn't die by covering multiple bases is a good thing. You do realize all programmers make mistakes, don't you? Good programmers try to minimize the effects of those mistakes.

      Was he really saying to do that instead of sanity checks? I didn't see anywhere in his post where he explicitly said to do the "guard page" trick and not ever do any other sanity checks. The way he started off by saying how people get sanity checks wrong, it seems to me he was saying you should do that in addition to normal sanity checks, so if you really screw them up, you will still have some protection... Then again, maybe he was just trying to offer a more simple and efficient solution for those who can't get it right or are worried about wasting CPU cycles.

      At any rate, the "guard page" trick coupled with the bitmasking certainly looks like it would be difficult or impossible to write outside the buffer, unless there is some sort of exploit I didn't see. Unlikely since I am quite familiar with assembly language and binary operations. It looked easy and foolproof to me--assuming no one makes a typo or other mistake, but other sanity checks are just as vulnerable to those problems. Just read the strlcpy paper written by Todd C. Miller and Theo De Raadt. Here is a relevant excerpt:

      There are several problems encountered when strncpy() and strncat() are used as safe versions of strcpy() and strcat(). Both functions deal with NUL-termination and the length parameter in different and non-intuitive ways that confuse even experienced programmers. They also provide no easy way to detect when truncation occurs. Finally,strncpy() zero-fills the remainder of the destination string, incurring a performance penalty. Of all these issues, the confusion caused by the length parameters and the related issue of NUL-termination are most important. When we audited the OpenBSD source tree for potential security holes we found rampant misuse of strncpy() and strncat(). While not all of these resulted in exploitable security holes, they made it clear that the rules for using strncpy() and strncat() in safe string operations are widely misunderstood.

      It is difficult to write functions which prevent security flaws. The trick r00t proposed sounds as good as any. You may not catch many bugs with binary masking, but then that is what a debugger and assert() are for.

      Your comments about it being "complicated" and a "complex plan" suggest to me you know nothing about boolean algebra or low level programming. Maybe you should learn a bit more before you write inflammatory comments.

  10. Fuck no, get a clue by Anonymous Coward · · Score: 1, Informative

    These are not problems with the FLAC file format. These are problems with libFLAC, the reference implementation, and potentially others that copied code from it. You can't have stack overflows in a file format, that doesn't even make sense.

  11. libavcodec is not affected, Heise is wrong by unixmaster · · Score: 2, Informative

    libavcodec never ever used libFLAC, it has its own FLAC encoding & decoding code, hence not affected. Lousy journalism on Heise part.

    --
    Never learn by your mistakes, if you do you may never dare to try again
  12. don't need root for a rootkit by r00t · · Score: 2, Informative
    echo "export LD_PRELOAD=/home/you/rootkit.so" >> /home/you/.bashrc
    echo "export LD_PRELOAD=/home/you/rootkit.so" >> /home/you/.bash_profile

    From there, all your processes contain rootkit.so as a library. It can replace functions in the C library. Your editor won't open /home/you/.bashrc when you ask it to; it will instead open a different file.

    You're so pwn3d.

    You'd be safe if you had Bitfrost, like the OLPC XO does. There, apps don't get to mess with your files except when you actively hand the file over.

    1. Re:don't need root for a rootkit by r00t · · Score: 4, Informative

      That code gets injected into your xterm, gnome-terminal, konsole, eterm, screen, emacs, etc.

      You'd better not ever do "su" or "sudo" from a shell in any of them. You wouldn't do that, would you?

      Do you know what an "input method" is? It's a lovely way to play with your keystrokes, no matter what the app. It's normally used to enter things like Chinese characters... and to pwn you.

      BTW, getting into your account is one step closer. Now the attacker is not only inside your firewall, but able to attack setuid binaries and the kernel itself. Any bugs just got exposed. At this point, a local exploit is as good as a remote exploit.

      Not that any of this matters. A typical attacker wants your private data, your IP address, and your network bandwidth. Maybe they want your disk space too. Really, they don't need root. That's just for bragging rights.

    2. Re:don't need root for a rootkit by ookaze · · Score: 4, Informative

      That code gets injected into your xterm, gnome-terminal, konsole, eterm, screen, emacs, etc. No it doesn't !!! At least as long as you don't launch any xterm from your gnome-terminal/konsole/eterm/whatever.
      This little trick would change whatever apps you use that is launched from your shell session, which is just unlikely.
      But wait, there's more ...

      You'd better not ever do "su" or "sudo" from a shell in any of them. You wouldn't do that, would you? This is even more nonsense, as your little trick just won't work on a glibc drived system, meaning nearly every Linux OS out there.
      This was fixed like more than 4 years ago !! Your LD_PRELOAD, containing slashes, will just not work at all and be rejected for suid binaries like su or sudo.
      And if you don't put slashes, the library will be searched in the trusted paths put in your ld.so.conf.
      So sorry to destroy your scary FUD. Not to say a rootkit is not possible, but it requires more than a vulnerability fixed years ago.

      Do you know what an "input method" is? It's a lovely way to play with your keystrokes, no matter what the app. It's normally used to enter things like Chinese characters... and to pwn you. Except this is not launched from a bash session... at all. This is launched by your desktop environment, itself launched from a desktop manager, itself suid and not launched from your bash session. Just wow at your failed pwn methods though!

      BTW, getting into your account is one step closer. Now the attacker is not only inside your firewall, but able to attack setuid binaries and the kernel itself. Just no, you're plain wrong. Kernel is safe as long as you're not root, and setuid binaries are safe too. You have to have an exploit on one of them, and no, LD_PRELOAD is not one.

      Any bugs just got exposed. At this point, a local exploit is as good as a remote exploit. Well, I kind of agree, though it's not as simple as you make it out.
    3. Re:don't need root for a rootkit by r00t · · Score: 2, Informative

      No it doesn't !!! At least as long as you don't launch any xterm from your gnome-terminal/konsole/eterm/whatever.
      This little trick would change whatever apps you use that is launched from your shell session, which is just unlikely. That's a very minor detail. First of all, I can just hit your desktop menu files instead. I can hit .xsessionrc or .xinitrc instead. Second of all, your desktop environment most likely USES THE SHELL to start things, and it is likely that at least some of the shell's files (not all) will still be used.

      This was fixed like more than 4 years ago !! Your LD_PRELOAD, containing slashes, will just not work at all and be rejected for suid binaries like su or sudo. No, I don't mean injecting into su or sudo. I mean injecting into the terminal program. As part of the push for security, the setuid bit has been removed from many of these programs... eliminating the LD_PRELOAD protection. Oops.

      In any case, with control of your menu system, I can substitute a look-alike program of my own design. That could be the terminal program. It could just be su or sudo. Heck, I could probably get away with making them mere shell functions.

      Kernel is safe as long as you're not root, and setuid binaries are safe too. You have to have an exploit on one of them No shit. Suppose I do. I probably can't use it remotely... until I get into your regular user account.
  13. Re:But I thought that this didn't happen with FOSS by Almahtar · · Score: 2, Informative

    So this is really ironic - Its my understating from reading hundreds and hundreds of /. posts that this isn't supposed to happen with FOSS. Then you misunderstood.

    Who did the code reviews? eEye Digital Security.

    Who did the security reviews? eEye Digital Security.

    Who did all the threat modeling? I'll give you three guesses.

    The security impact of open source software is not that it has less bugs, but that they get found because people can analyze the source. Read this article and you'll see that's exactly what happened. It's good news.

    You will have bugs in your software, and they will be found. The difference is are they found by 'good guys' that will warn you and help you fix it or are they found by 'bad guys' that root your system?
  14. Re:Some things in life, money can't buy... by the+eric+conspiracy · · Score: 2, Informative

    5th generation iPods can be flashed with Rockbox or iPodLinux, both of which have FLAC support.

    5th gen (or any other) iPods have crappy DACs and poor amps. FLAC support is irrelevant for them.

    Also USB sound cards are $40 and usually don't sound better than the cards bundled with most laptops, while also being slower than onboard chips.

    USB sound cards that cost $40 don't sound better than the laptop sound cards because they have the same crappy amps and DACs as the laptop sound card. Get a $250 USB sound card like the iBasso D1 or Meier Move that are designed to drive high quality headphones and you are in a whole 'nuther league.

    Finally, $200 will get you 750GB, which is adequate for music, assuming, of course, that you are storing lossless.

    $100 for a 500 GB drive lets you store about 2000 CD's ripped to FLACs. That is pretty adequate and I think would satisfy most people.

    Open your mind and your ears. The world of high fidelity is easy to experience. You won't want to go back to iPods, low bit rate MP3s and earbuds - I assure you.

  15. Re:A lot of these are app flaws, not flac flaws .. by QuantumG · · Score: 2, Informative

    God, is this like the retard thread on Slashdot now?

    The code has been fixed. Yes, there really were security bugs in the libFLAC library. Shocking isn't it? Software had bugs in it! People found those bugs! People fixed those bugs!

    --
    How we know is more important than what we know.
  16. Re:the whole point: it's NOT sanity checking by MrMr · · Score: 2, Informative

    Not really, that would be true for 'better than median'.
    When only a minority of people is responsible for traffic accidents, the majority is indeed better than average.
    'nearly everybody' may be completely right about being a better than average driver...

  17. Many distros/OSs still using FLAC 1.1.2 by Anonymous Coward · · Score: 1, Informative

    I can't believe there are GNU/Linux distros and *BSD OSs still shipping with FLAC 1.1.2. FLAC 1.1.3 was released over a year ago. Since then we've had FLAC 1.1.4, 1.2.0 and 1.2.1. I would be embarrassed being a package maintainer for FLAC and it wasn't up-to-date. There's been some rather good improvements to FLAC since 1.1.2.

    Another annoyance I noticed today is the FreeBSD maintainer is porting fixes from 1.2.1 to 1.1.2 rather than updating the port from 1.1.2 to 1.2.1.

    Here's a list of distros and *BSD OSs and the available FLAC package for each:
    gentoo 1.2.1
    archlinux 1.2.1
    opensuse 1.2.1
    fedora 1.2.1
    debian-testing 1.2.1
    debian-unstable 1.2.1
    ubuntu 1.1.4
    pkgsrc (netbsd, dragonflybsd..) 1.1.3
    debian-stable 1.1.2
    slackware 1.1.2
    openbsd 1.1.2
    freebsd 1.1.2

  18. sanity checks can be exploitable by r00t · · Score: 2, Informative

    One should consider that sanity checks can themselves be security holes. At the very least, you have lots of extra code that can make regular old bugs more difficult to find.

    I'd not suggest that ALL sanity checks need to go, but... cutting down the complexity of your code is certainly not a bad idea.

    For example, if your sanity check code causes a double free, it may be exploitable on MacOS. (shame on Apple)

    As a general rule, the more code the more danger.