Red Hat Bugzilla – Bug 214205
CVE-2006-7234 lynx: .mailcap and .mime.types files read from CWD
Last modified: 2012-06-20 10:22:43 EDT
Description of problem:
Lynx reads .mailcap and .mime.types from its CWD, making it
possible for a malicious person to make it execute arbitrairy
code when user launches lynx while its working directory
contains attacker-provided contents.
Steps to Reproduce:
$ cat .mime.types
$ cat .mailcap
application/x-bug; xmessage 'Hello, World!'
$ cat poc.bug
$ lynx poc.bug
( xmessage 'Hello, World!' ) < /home/lkundrak/L28618-1037TMP.bin
Make lynx read files from ~ instead of CWD.
Debian patch is unusable here, they completly remove code
for reading the files in question.
This is more accurate than the Debian report, which does not
distinguish between the starting directory and directories
which lynx may visit.
I prefer (unless someone can point out a flaw) to use IsOurFile()
to verify that the file is safe to read.
Depending on the use, the Debian patch has some limited value.
As I noted, I added logic to use IsOurFile() to reduce the
scope (and that patch is easily resync'd to 2.8.5). Properly
handling the user's mailcap/mime file settings is harder.
The effect of the Debian patch is to always append that setting
to the user's home-path. It doesn't check if the global setting
is not a relative path. I added a check for the latter, and chose
to address the user's settings by making tilde-expansion in those
work - and then enforcing absolute pathnames for the user's settings.
That's in lynx 2.8.7dev.4 (resyncing the tilde expansion stuff is
more work). I'd suggest adding the 2.8.6rel.3 patch (for IsOurFile),
and combining that with the Debian patch for fixes to older releases.
I'll work on this, this evening to put together a possible
patch to combine the different aspects.
For the sake of completeness... This issue was fixed upstream in 2.8.6rel.4. As of this version, lynx will not search current working directory for PERSONAL_MAILCAP (.mailcap by default) and PERSONAL_EXTENSION_MAP (.mime.types by default) files, but will only try to find those files in the user's home directory.
Patches for older versions:
CVE id CVE-2006-7234 was assigned to this issue:
Untrusted search path vulnerability in Lynx before 2.8.6rel.4 allows
local users to execute arbitrary code via malicious (1) .mailcap and
(2) mime.types files in the current working directory.
This issue was addressed in:
Red Hat Enterprise Linux:
Reporter changed to email@example.com by request of Jay Turner.