Gzip zgrep Implementation May Let Remote Users Execute Arbitrary Commands
|
|
SecurityTracker Alert ID: 1013928
|
|
SecurityTracker URL: http://securitytracker.com/id?1013928
|
|
CVE Reference: CAN-2005-0758
(Links to External Site)
|
Date: May 10 2005
|
Impact: Execution of arbitrary code via network, User access via network
|
Fix Available: Yes
Vendor Confirmed: Yes
|
Version(s): 1.2.4
|
Description: A vulnerability was reported in gzip in the zgrep implementation. A remote user may be able to cause arbitrary commands to be executed.
The zgrep code does not properly validate user-supplied arguments. If arguments originate from an untrusted source, then a user
may be able to cause arbitrary commands to be executed on the target system.
The flaw resides in 'zgrep.in'.
|
Impact: A remote user may be able to cause arbitrary commands to be executed.
|
Solution: A patch for 'zgrep.in' is available in the following bug report:
http://bugs.gentoo.org/show_bug.cgi?id=90626
|
Vendor URL: www.gzip.org/ (Links to External Site)
|
Cause: Input validation error
|
Underlying OS: Linux (Any), UNIX (Any)
|
|
Message History:
None.
|
Source Message Contents
|
Date: Tue, 10 May 2005 00:31:50 -0400
Subject: [none]
|
This old issue seems unfixed in our zgrep.
> zgrep contains the following gem:
>
> for i do
> [snip]
> if test $with_filename -eq 1; then
> sed_script="s|^[^:]*:|${i}:|"
> else
> sed_script="s|^|${i}:|"
> fi
> $grep $opt "$pat" | sed "$sed_script"
> [snip]
> done
>
> Aside of the correctness issues (try to use zgrep on files with e.g. '&' in
> names), it leads to obvious fun when zgrep arguments had been obtained
> by globbing in an untrusted place. Even with standard sed we have at
> least ;w<filename>; to deal with; for GNU sed there's also ;e; on top
> of that (execute the contents of pattern space). bzgrep is no better -
> it's based on zgrep.
>
> AFAICS, there are two solutions - one is to do what *BSD had done and
> make grep(1) use zlib and libbz; then zgrep et.al. become links to
> grep. Another is to quote \, |, ; and newlines, which means extra
> invocation of sed(1)...
|
|