Tavis Ormandy has discovered a vulnerability in esearch for Gentoo Linux, which can be exploited by malicious, local users to perform certain actions with escalated privileges. The vulnerability is caused due to the eupdatedb utility creating the temporary file /tmp/esearchdb.py.tmp insecurely. This can be exploited via symlink attacks to create or overwrite arbitrary files with the privileges of the user invoking the utility.
e59e3827b241da0be587c4f5008b80fa8f0fb686c731080a1ab72a5fff0eff55
<body style="margin: 0px;" bgcolor="#ffffff"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<table border="0" cellspacing="0" cellpadding="0" width="100%"><tbody><tr>
<td width="99%" class="content" valign="top" align="left">
<br><p class="dochead">Esearch: Insecure temp file handling</p>
<p class="chaphead">
<span class="chapnum"><a name="doc_chap1">1. </a></span>Gentoo Linux Security Advisory</p>
<p class="secthead"><a name="doc_chap1_sect1">Version Information</a></p>
<table class="ntable">
<tbody><tr>
<td bgcolor="#7a5ada" class="infohead"><b>Advisory Reference</b></td>
<td bgcolor="#ddddff" class="tableinfo">GLSA 200407-01 / esearch</td>
</tr>
<tr>
<td bgcolor="#7a5ada" class="infohead"><b>Release Date</b></td>
<td bgcolor="#ddddff" class="tableinfo">July 01, 2004</td>
</tr>
<tr>
<td bgcolor="#7a5ada" class="infohead"><b>Latest Revision</b></td>
<td bgcolor="#ddddff" class="tableinfo">July 01, 2004: 01</td>
</tr>
<tr>
<td bgcolor="#7a5ada" class="infohead"><b>Impact</b></td>
<td bgcolor="#ddddff" class="tableinfo">normal</td>
</tr>
<tr>
<td bgcolor="#7a5ada" class="infohead"><b>Exploitable</b></td>
<td bgcolor="#ddddff" class="tableinfo">local</td>
</tr>
</tbody></table>
<table class="ntable">
<tbody><tr>
<td bgcolor="#7a5ada" class="infohead"><b>Package</b></td>
<td bgcolor="#7a5ada" class="infohead"><b>Vulnerable versions</b></td>
<td bgcolor="#7a5ada" class="infohead"><b>Unaffected versions</b></td>
<td bgcolor="#7a5ada" class="infohead"><b>Architecture(s)</b></td>
</tr>
<tr>
<td bgcolor="#ddddff" class="tableinfo">app-portage/esearch</td>
<td bgcolor="#ddddff" class="tableinfo">
<=
0.6.1</td>
<td bgcolor="#ddddff" class="tableinfo">
>=
0.6.2</td>
<td bgcolor="#ddddff" class="tableinfo">
All supported architectures
</td>
</tr>
</tbody></table>
<p>
Related bugreports:
<a href="http://bugs.gentoo.org/show_bug.cgi?id=55424">#55424</a>
</p>
<p class="secthead"><a name="doc_chap1_sect2">Synopsis</a></p>
The eupdatedb utility in esearch creates a file in /tmp without first
checking for symlinks. This makes it possible for any user to create
arbitrary files.
<p class="chaphead">
<span class="chapnum"><a name="doc_chap2">2. </a></span>Impact Information</p>
<p class="secthead"><a name="doc_chap2_sect1">Background</a></p>
<p>
Esearch is a replacement for the Portage command "emerge search". It uses
an index to speed up searching of the Portage tree.
</p>
<p class="secthead"><a name="doc_chap2_sect2">Description</a></p>
<p>
The eupdatedb utility uses a temporary file (/tmp/esearchdb.py.tmp) to
indicate that the eupdatedb process is running. When run, eupdatedb checks
to see if this file exists, but it does not check to see if it is a broken
symlink. In the event that the file is a broken symlink, the script will
create the file pointed to by the symlink, instead of printing an error and
exiting.
</p>
<p class="secthead"><a name="doc_chap2_sect3">Impact</a></p>
<p>
An attacker could create a symlink from /tmp/esearchdb.py.tmp to a
nonexistent file (such as /etc/nologin), and the file will be created the
next time esearchdb is run.
</p>
<p class="chaphead">
<span class="chapnum"><a name="doc_chap3">3. </a></span>Resolution Information</p>
<p class="secthead"><a name="doc_chap3_sect1">Workaround</a></p>
<p>
There is no known workaround at this time. All users should upgrade to the
latest available version of esearch.
</p>
<p class="secthead"><a name="doc_chap3_sect2">Resolution</a></p>
<p>
All users should upgrade to the latest available version of esearch, as
follows:
</p>
<a name="doc_chap3_pre1"></a><table class="ntable" width="100%" cellspacing="0" cellpadding="0" border="0">
<tbody><tr><td class="infohead" bgcolor="#7a5ada"><p class="caption">Code Listing 3.1</p></td></tr>
<tr><td bgcolor="#ddddff"><pre> # emerge sync
# emerge -pv ">=app-portage/esearch-0.6.2"
# emerge ">=app-portage/esearch-0.6.2"</pre></td></tr>
</tbody></table>
<br><br>
</td>
</tr></table>