Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 162005 - net-misc/axel < 1.0b-r2 false url causes crash
Summary: net-misc/axel < 1.0b-r2 false url causes crash
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Vulnerabilities (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Security
URL:
Whiteboard: B4 [noglsa]
Keywords:
: 171836 173983 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-01-14 09:10 UTC by Executioner
Modified: 2007-09-09 19:15 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to fix unsafe strcpy calls (axel.patch,38.13 KB, patch)
2007-08-05 21:15 UTC, Pierre-Yves Rofes (RETIRED)
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Executioner 2007-01-14 09:10:00 UTC
passing axel a url that doesn't exist causes it to crash... and if you give it a long url you get some interesting heap related errors...  Possibly from a free(null)  

Ex: 
executioner@box:~/tmp/axel-1.0b$ axel A
Initializing download: A

Segmentation fault (core dumped)

Ex2:
executioner@box:~/tmp/axel-1.0b$ axel `perl -e 'print "A"x500'`
Initializing the download: AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
*** glibc detected *** ./axel: free(): invalid next size (normal): 0x0805a9a0 ***
======= Backtrace: =========
/lib/libc.so.6[0xb7e18cb0]
/lib/libc.so.6(__libc_free+0x84)[0xb7e1a2f4]
/lib/libc.so.6(fclose+0x15b)[0xb7e0a20b]
/lib/libnss_files.so.2[0xb7ef34c4]
/lib/libnss_files.so.2(_nss_files_getservbyname_r+0x103)[0xb7ef3bc3]
/lib/libc.so.6(getservbyname_r+0x82)[0xb7e87902]
/lib/libc.so.6(getservbyname+0x8e)[0xb7e877ae]
./axel[0x804b8c9]
./axel[0x80496dd]
./axel[0x804efbd]
/lib/libc.so.6(__libc_start_main+0xd8)[0xb7dcb878]
./axel[0x80491b1]
======= Memory map: ========
08048000-08051000 r-xp 00000000 03:03 6406219    /home/rootfiend/tmp/axel-1.0b/axel
08051000-08052000 rw-p 00008000 03:03 6406219    /home/rootfiend/tmp/axel-1.0b/axel
08052000-08073000 rw-p 08052000 00:00 0          [heap]
b7c00000-b7c21000 rw-p b7c00000 00:00 0
b7c21000-b7d00000 ---p b7c21000 00:00 0
b7d96000-b7da0000 r-xp 00000000 03:03 11684770   /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libgcc_s.so.1
b7da0000-b7da1000 rw-p 00009000 03:03 11684770   /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/libgcc_s.so.1
b7db5000-b7db6000 rw-p b7db5000 00:00 0
b7db6000-b7ecd000 r-xp 00000000 03:03 6471772    /lib/libc-2.4.so
b7ecd000-b7ecf000 r--p 00116000 03:03 6471772    /lib/libc-2.4.so
b7ecf000-b7ed1000 rw-p 00118000 03:03 6471772    /lib/libc-2.4.so
b7ed1000-b7ed4000 rw-p b7ed1000 00:00 0
b7ed4000-b7ee3000 r-xp 00000000 03:03 6471788    /lib/libpthread-2.4.so
b7ee3000-b7ee4000 r--p 0000e000 03:03 6471788    /lib/libpthread-2.4.so
b7ee4000-b7ee5000 rw-p 0000f000 03:03 6471788    /lib/libpthread-2.4.so
b7ee5000-b7ee8000 rw-p b7ee5000 00:00 0
b7ef1000-b7ef9000 r-xp 00000000 03:03 6471783    /lib/libnss_files-2.4.so
b7ef9000-b7efb000 rw-p 00007000 03:03 6471783    /lib/libnss_files-2.4.so
b7efb000-b7efc000 rw-p b7efb000 00:00 0
b7efc000-b7efd000 r-xp b7efc000 00:00 0          [vdso]
b7efd000-b7f17000 r-xp 00000000 03:03 6471761    /lib/ld-2.4.so
b7f17000-b7f18000 r--p 00019000 03:03 6471761    /lib/ld-2.4.so
b7f18000-b7f19000 rw-p 0001a000 03:03 6471761    /lib/ld-2.4.so
bfcd2000-bfce8000 rw-p bfcd2000 00:00 0          [stack]
Aborted (core dumped)


Reproducible: Always
Comment 1 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2007-01-14 11:53:37 UTC
CCing security for an audit, to know how this could be exploitable for a more severe issue. Actually a client-side crash is not a security issue.
Comment 2 Raphael Marichez (Falco) (RETIRED) gentoo-dev 2007-01-14 18:41:16 UTC
upstream is said to be dead, waiting for a patch
Comment 3 Executioner 2007-01-14 18:47:12 UTC
There are also numerous problems with strncpy... 

for instance:

line 40 in conn.c,

strncpy( url, set_url, MAX_STRING );

should be:

strncpy( url, set_url, MAX_STRING - 1);

to make room for the NULL terminator

there are lots more of these...
not to mention MAX_STRING needs to be larger
Comment 4 Executioner 2007-02-15 01:46:24 UTC
Did anyone get in touch with anyone at all who was involved with the upstream project?  I may be interested in personally becoming the upstream maintainer.
Comment 5 Aniruddha Shankar 2007-03-22 19:15:21 UTC
Executioner, could you also look at bug # 171836 ?
Comment 6 Jakub Moc (RETIRED) gentoo-dev 2007-03-22 21:30:23 UTC
*** Bug 171836 has been marked as a duplicate of this bug. ***
Comment 7 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2007-03-25 10:31:00 UTC
Any news on this one?
Comment 8 Jakub Moc (RETIRED) gentoo-dev 2007-04-10 06:13:49 UTC
*** Bug 173983 has been marked as a duplicate of this bug. ***
Comment 9 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-08-05 21:15:13 UTC
Created attachment 126998 [details, diff]
Patch to fix unsafe strcpy calls

I took a look at it, this seems clearly vulnerable to a classic buffer overflow .I wrote a corrective patch, I'll try to contact upstream to see if he can integrate it.
Comment 10 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-08-13 17:00:13 UTC
no response from upstream so far... drizzt, could you merge the patch please?
Comment 11 Timothy Redaelli (RETIRED) gentoo-dev 2007-09-03 21:31:14 UTC
Patch applied
Comment 12 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-09-04 16:46:37 UTC
Thanks. Got a response from upstream in the meanwhile, but he doesn't seem very motivated to release a new version, so...
arches, please test and mark stable net-misc/axel-1.0b-r2.
Target keywords are: ~amd64 ppc ~ppc-macos ppc64 sparc x86 ~x86-fbsd"
Comment 13 Christian Faulhammer (RETIRED) gentoo-dev 2007-09-04 19:17:44 UTC
x86 stable
Comment 14 Markus Rothe (RETIRED) gentoo-dev 2007-09-05 07:53:43 UTC
ppc64 stable
Comment 15 Jose Luis Rivero (yoswink) (RETIRED) gentoo-dev 2007-09-05 10:22:26 UTC
sparc stable.

BTW, the patch is full of "tab removed lines" (without a real content change) which makes it quite big (~39K) and probably will make harder the portability to new versions. Dunno if this was intentioned by some reason.
Comment 16 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-09-05 10:45:28 UTC
(In reply to comment #15)
> sparc stable.
> 
> BTW, the patch is full of "tab removed lines" (without a real content change)
> which makes it quite big (~39K) and probably will make harder the portability
> to new versions. Dunno if this was intentioned by some reason.
> 
You're right, that's my fault as I use a hook for deleting trailing whitespaces when saving files in emacs. Sorry for the inconvenience, I'll probably remove this from my config. 
About new versions, I wouldn't worry too much as upstream is pretty much dead, and if he decides to do a new release, it will probably include this patch anyway.
Comment 17 Tobias Scherbaum (RETIRED) gentoo-dev 2007-09-07 14:54:05 UTC
ppc stable, ready for glsa-voting
Comment 18 Pierre-Yves Rofes (RETIRED) gentoo-dev 2007-09-07 15:00:48 UTC
voting NO.
Comment 19 Sune Kloppenborg Jeppesen (RETIRED) gentoo-dev 2007-09-09 19:15:00 UTC
Voting NO and closing.