Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug
Bug#: 211491
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Jukka Ruohonen <drear@iki.fi>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 211491 depends on: Show dependency tree
Bug 211491 blocks:

Additional Comments: (this is where you put emerge --info)


Not eligible to see or edit group visibility for this bug.






View Bug Activity   |   Format For Printing   |   XML   |   Clone This Bug


Description:   Opened: 2008-02-26 10:30 0000
A classic:

in the function 'searchwn()', called from 'main()', there is a static 'char
tmpbuf[256]' into which an invalid command line option is copied using
sprintf():

            } else {
                sprintf(tmpbuf, "wn: invalid search option: %s\n", av[j]);
                display_message(tmpbuf);
                errcount++;
            }

So pass your favourite long string to wn with an invalid command line option,
yielding a segfault. All versions (2.0, 2.1 and 3.0) in Portage are affected.

I filed this under security since I have seen that Wordnet is sometimes used as
a backend in e.g. web applications. Please judge yourself and move to an
appropriate category if needed.

Patching should be trivial.

------- Comment #1 From Sune Kloppenborg Jeppesen 2008-02-26 10:34:22 0000 -------
app-dicts please advise.

------- Comment #2 From Pierre-Yves Rofes 2008-02-26 10:55:53 0000 -------
(In reply to comment #0)
> A classic:
> 
> in the function 'searchwn()', called from 'main()', there is a static 'char
> tmpbuf[256]' into which an invalid command line option is copied using
> sprintf():
[...]
> I filed this under security since I have seen that Wordnet is sometimes used as
> a backend in e.g. web applications. Please judge yourself and move to an
> appropriate category if needed.

Thanks for the report.

> Patching should be trivial. 

Unfortunately, I don't think so. I just took a quick look to the code, and
given the number of strcpy()/strcat()/... I'm pretty sure other are exploitable
as well. e.g this one:

lib/search.c:2126:    strcpy(wdbuf, synptr->words[wdnum]);

with wdbuf being a 256 chars static buffer... I'd say this stuff would need a
full security audit.

------- Comment #3 From Jukka Ruohonen 2008-02-26 11:47:03 0000 -------
> (In reply to comment #0)
> Unfortunately, I don't think so. I just took a quick look to the code, and
> given the number of strcpy()/strcat()/... I'm pretty sure other are exploitable

With my ten seconds with the code, I did not even dare to look that far.
Indeed: e.g. from do_search() through findtheinfo() to wngrep() (in
../lib/search.c) and therein an user-controlled strcpy with static 256 buffer.
A simple test:

wn [long string here] -grepn

which results an obvious segfault again. As you said, the code is full of
these.

> with wdbuf being a 256 chars static buffer... I'd say this stuff would need a
> full security audit.

Hopefully Princeton-upstream is interested -- after all, Wordnet is an
award-winning piece of software with academic publications and research grants. 

A recommendation from an user: if no one is going to take the big task of a
almost complete rewrite, mask the packages, at least for the time being.

------- Comment #4 From Sune Kloppenborg Jeppesen 2008-02-26 11:51:54 0000 -------
py did you contact upstream?

------- Comment #5 From Pierre-Yves Rofes 2008-02-26 12:18:55 0000 -------
(In reply to comment #4)
> py did you contact upstream?
> 
Upstream contacted with a link to this bug.

------- Comment #6 From Robert Buchholz 2008-09-02 23:15:57 0000 -------
oCERT has covered more bugs in their #2008-014 advisory. Rob has also prepared
a patch, which we should apply.
http://www.ocert.org/advisories/ocert-2008-014.html

------- Comment #7 From Peter Volkov 2008-09-10 06:57:59 0000 -------
Patch was added in wordnet-3.0-r1. x86 team, please, stabilize it.

------- Comment #8 From Robert Buchholz 2008-09-10 11:34:33 0000 -------
going back to [ebuild]. The oCert patch does not address CVE-2008-2149, the
first issue in this bug. Please also apply this patch:
http://svn.debian.org/wsvn/debian-science/packages/wordnet/trunk/debian/patches/50_CVE-2008-2149_buffer_overflows.patch?op=file&rev=0&sc=0

------- Comment #9 From Peter Volkov 2008-09-12 19:36:18 0000 -------
Thank you Robert. Done in wordnet-3.0-r2.

------- Comment #10 From Markus Meier 2008-09-17 20:32:10 0000 -------
x86 stable, all arches done.

------- Comment #11 From Pierre-Yves Rofes 2008-09-21 11:09:23 0000 -------
GLSA request filed

------- Comment #12 From Tobias Heinlein 2008-10-07 18:14:43 0000 -------
GLSA 200810-01.

Bug List: (This bug is not in your last search results)   Show last search results      Search page      Enter new bug