Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 210609 - app-misc/wyrd < 1.4.4 Insecure temporary file creation (CVE-2008-0806)
Summary: app-misc/wyrd < 1.4.4 Insecure temporary file creation (CVE-2008-0806)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High trivial (vote)
Assignee: Gentoo Security
URL: http://bugs.debian.org/cgi-bin/bugrep...
Whiteboard: ~3 [noglsa]
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-18 18:31 UTC by Robert Buchholz (RETIRED)
Modified: 2008-02-23 20:09 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Buchholz (RETIRED) gentoo-dev 2008-02-18 18:31:39 UTC
Nico Golde writes:

While searching for a cool calendar software I tried out 
wyrd and noticed a wyrd file in /tmp that didn't look very 
random. Looking at the source code it turns out that wyrd 
dumps its configuration if you press ? (help) in the ui.
It then stores a file named wyrd-tmp.<userid> in /tmp.

rcfile.ml:
139 let tmpfile = "/tmp/wyrd-tmp." ^ (string_of_int (Unix.getuid ()))

An attacker only needs to look up the userid in /etc/passwd 
and create a symlink from /home/victim/someimportantfile /tmp/wyrd-tmp.uid
and this will overwrite the content with the wyrd 
configuration.
Comment 1 Robert Buchholz (RETIRED) gentoo-dev 2008-02-18 18:32:05 UTC
tove, ml, please advise.
Comment 2 Pierre-Yves Rofes (RETIRED) gentoo-dev 2008-02-19 21:52:29 UTC
here's the patch from Nico Golde :  http://people.debian.org/~nion/nmu-diff/wyrd-1.4.3b-3_1.4.3b-3.1.patch

maintainers, please bump.
Comment 3 Torsten Veller (RETIRED) gentoo-dev 2008-02-19 22:24:12 UTC
The patched version quits [Sys_error("Bad file descriptor")] the second time help is called here.

Upstream told me that a fixed version will be released really soon.
Comment 4 nion 2008-02-20 18:59:23 UTC
(In reply to comment #3)
> The patched version quits [Sys_error("Bad file descriptor")] the second time
> help is called here.
> 
> Upstream told me that a fixed version will be released really soon.

Thanks for spotting this. The reason is the vulnerable version just operates on the filename and writes to it and thus always assigns a new fd and closing it afterwards while the fixed version has a global fd to make sure the file does not change in the meantime. Fixed this by moving the file descriptor close to the same place as removing the file (tested) and flushing the output after writing to it.
Comment 5 Torsten Veller (RETIRED) gentoo-dev 2008-02-22 09:12:53 UTC
wyrd-1.4.4 is in the tree.

|2008-02-21     Released 1.4.4.
|
|               Fixed an instance of insecure tempfile creation.  This 
|               addresses a security vulnerability that had the potential to
|               cause data loss.
Comment 6 Pierre-Yves Rofes (RETIRED) gentoo-dev 2008-02-22 09:21:05 UTC
thanks, closing.