Bug 61221 (CVE-2004-0964:) - VUL-0: CVE-2004-0964:: zinf buffer overflow
Summary: VUL-0: CVE-2004-0964:: zinf buffer overflow
Status: RESOLVED FIXED
Alias: CVE-2004-0964:
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: All Linux
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL:
Whiteboard: CVE-2004-0964: CVSS v2 Base Score: 10...
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-27 20:21 UTC by Ludwig Nussel
Modified: 2021-09-27 14:43 UTC (History)
3 users (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments
playlist.diff (1.03 KB, text/x-diff)
2004-10-07 20:00 UTC, Ludwig Nussel
Details
freeamp-2.1.1-tmpworkaround.diff (612 bytes, patch)
2004-10-07 21:32 UTC, Ludwig Nussel
Details | Diff
zinf-2.2.4-playlist.diff (1.20 KB, patch)
2004-10-07 21:34 UTC, Ludwig Nussel
Details | Diff
zinf-2.2.4-tmpworkaround.diff (649 bytes, patch)
2004-10-07 21:34 UTC, Ludwig Nussel
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ludwig Nussel 2004-09-27 20:21:32 UTC
We received the following report via bugtraq.
The issue is public.

The reporter says the overflow got fixed in 2.2.5. I can't find any
upstream changelog that would clarify whether 2.2.4 on 9.0 is
vulnerable. It at least runs into an endless loop when presented
with a pls file with long lines. Stanislav, do you follow zinf
development/CVS and know when they fixed the bug?

Date: Fri, 24 Sep 2004 21:31:02 +0000
From: Luigi Auriemma <aluigi@autistici.org>
To: bugtraq@securityfocus.com
Subject: Buffer overflow in Zinf 2.2.1 for Win32
X-Spam-Level: 


I don't know why this bug has not been tracked but moreover I don't
completely know why it has not been fixed yet in the Windows version of
Zinf.

In short, Zinf is an audio player for Linux and Windows: http://www.zinf.org
The latest Linux version is 2.2.5 while the latest Windows version is 2.2.1
which is still vulnerable to a buffer-overflow bug in the management of the
playlist files ".pls".

This bug has been found and fixed by the same developers in the recent
versions for Linux but, as already said, the vulnerable Windows version is
still downloadable and can be exploited locally and remotely through the web
browser and a malicious pls file.

A simple proof-of-concept to test the bug is available here:

  http://aluigi.altervista.org/poc/zinf-bof.pls

That's all, just to keep track of this bug and to warn who uses the Windows
version.


BYEZ



--- 
Luigi Auriemma
http://aluigi.altervista.org
Comment 1 Stanislav Brabec 2004-09-27 22:34:48 UTC
I have looked at CVS just now for the first time.

I see 2003/05/18
                                                                               
                                                
   Beginning of code to validate playlist entries before
   sending them to the player where if not available, the user
   is forced to deal with a string of errors.

In current version upper mentioned pls causes error message. Not yet tested with
older ones.

Note, that in older versions zinf was named freeamp.
Comment 2 Ludwig Nussel 2004-10-07 20:00:01 UTC
Created attachment 24728 [details]
playlist.diff

proposal for patch against scanf buffer overflow in freeamp 2.1.1
Comment 3 Stanislav Brabec 2004-10-07 20:06:34 UTC
Is this final version of patch for YOU?
Comment 4 Ludwig Nussel 2004-10-07 20:28:02 UTC
No, I've just also discovered tmp races that can be fixed at the same time. 
I'll provide patches. 
Comment 5 Stanislav Brabec 2004-10-07 20:52:35 UTC
Upper mentioned patch can be applied on older versions (freeamp - 8.1, 8.2). But
for zinf 2.2.4 and 2.2.5 cannot and 2.2.4 (9.0) and 2.2.5 (9.1 and 9.2) code
differs:


2.2.4:
    //strcpy(root, path);
    root = path;
    cp = strrchr(root.c_str(), DIR_MARKER);
    if(cp)
        *(cp + 1) = 0x00;
    fp = fopen(path.c_str(), "rb");
    if (!fp)
       return kError_FileNotFound;
    len = -1;
    while(!feof(fp)){
        if (fscanf(fp, " [%[^]]] ", key))
            continue;
        if (fscanf(fp, "%[^=]=%[^\n\r] ", key, value)){
            if (strncmp(key, "File", 4) == 0){
                if (file.length()){
                    AddItem(list, file, title, len, root);
                    title = "";
                    len = -1;
                }
                file = value;
                continue;
            }
            if (strncmp(key, "Title", 5) == 0){
                title = value;
                continue;
            }
            if (strncmp(key, "Length", 6) == 0){
                len = atoi(value);
                continue;
            }
            continue;
        }
    }
    if (file.length())
       AddItem(list, file, title, len, root);
    fclose(fp);
    if (cleanpath) unlink(path.c_str());


2.2.5:
Error PLS::ReadPlaylist( const char* url,
                            std::vector<PlaylistItem*>* list,
                            PLMCallBackFunction function,
                            void* cookie )

{
    vector<string> items;

    Error r = readPlaylist (string(url), items);

    for (vector<string>::iterator i = items.begin();
         i != items.end(); i++) {
        PlaylistItem *item = new PlaylistItem(*i);
        list->push_back(item);
    }
    return r;
}
Comment 6 Ludwig Nussel 2004-10-07 21:05:30 UTC
2.2.5 is said to be unaffected by the problem. The patch can be applied with 
little modifications to 2.2.4, just the context is bit different. 
 
Did you ever try to actually run zinf on 9.0? This thing is broken beyond 
repair! It only starts the second time you call it and then it segfaults or 
hangs at every other operation. 
Comment 7 Ludwig Nussel 2004-10-07 21:32:04 UTC
Created attachment 24733 [details]
freeamp-2.1.1-tmpworkaround.diff
Comment 8 Ludwig Nussel 2004-10-07 21:34:17 UTC
Created attachment 24734 [details]
zinf-2.2.4-playlist.diff
Comment 9 Ludwig Nussel 2004-10-07 21:34:38 UTC
Created attachment 24735 [details]
zinf-2.2.4-tmpworkaround.diff
Comment 10 Ludwig Nussel 2004-10-07 21:41:14 UTC
Note the tmp stuff is just a hack. They should change their API and use 
mkstemp instead of tmpnam or create a temorary directory in a save way and use 
that. 2.2.5 is also affected but I don't think we need to do an update just 
for this. 
Comment 11 Ludwig Nussel 2004-10-07 22:19:58 UTC
*grmbl* the setenv doesn't work for some reason. 
Comment 12 Ludwig Nussel 2004-10-07 22:26:57 UTC
just scratch that tmp stuff and fix only the buffer overflow. If'm not 
mistaken an attacker would need to create 56800235584 ((26+26+10)^6) symlinks 
within the blink of an eye to exploit the race which is probably unlikely 
enough for non-setuid application ;-) 
Comment 13 Stanislav Brabec 2004-10-07 23:22:35 UTC
Fixed for freeamp in 8.1 and 8.2 and zinf 9.0 and submitted.

- Fixed buffer overflow in playlist (Luigi Auriemma, #46221).

You can create patchinfo.
Comment 14 Ludwig Nussel 2004-10-11 19:29:04 UTC
patchinfo submitted 
Comment 15 Ludwig Nussel 2004-10-12 17:17:35 UTC
approved 
Comment 16 Ludwig Nussel 2004-11-09 18:06:56 UTC
CAN-2004-0964 
Comment 17 Thomas Biege 2009-10-13 19:51:56 UTC
CVE-2004-0964: CVSS v2 Base Score: 10.0 (AV:N/AC:L/Au:N/C:C/I:C/A:C)