Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 448246 (CVE-2012-5667)

Summary: <sys-apps/grep-2.12: Arbitrary command execution (CVE-2012-5667)
Product: Gentoo Security Reporter: taaroa <taaroa>
Component: VulnerabilitiesAssignee: Gentoo Security <security>
Status: RESOLVED FIXED    
Severity: major CC: andreis.vinogradovs
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: http://lists.gnu.org/archive/html/bug-grep/2012-12/msg00004.html
Whiteboard: A2 [glsa]
Package list:
Runtime testing required: ---
Bug Depends on: 436692    
Bug Blocks:    

Description taaroa 2012-12-23 03:49:34 UTC
grep <2.11 is vulnerable to command execution vulnerability, and it is not possible to patch unless you build the source directly from the git repo.

ubuntu 12.04(And everything else, I would assume) uses version 2.10 of grep. it is not possible to upgrade without downloading the src and building it yourself.

PoC:

perl -e 'print "x"x(2**31)' | grep x > /dev/null

This is the grep news form for this:

 * Noteworthy changes in release 2.11 (2012-03-02) [stable]

  ** Bug fixes

    grep no longer dumps core on lines whose lengths do not fit in 'int'.
    (e.g., lines longer than 2 GiB on a typical 64-bit host).
    Instead, grep either works as expected, or reports an error.
    An error can occur if not enough main memory is available, or if the
    GNU C library's regular expression functions cannot handle such long lines.
    [bug present since "the beginning"]

Solution: Send out a grep update with atleast 2.11 grep from http://git.sv.gnu.org/cgit/grep.git

References:
https://bugs.launchpad.net/ubuntu/+source/grep/+bug/1091473
http://lists.gnu.org/archive/html/bug-grep/2012-12/msg00004.html
http://seclists.org/oss-sec/2012/q4/509

Reproducible: Always
Comment 1 SpanKY gentoo-dev 2012-12-24 01:30:45 UTC
2.14 has already gone stable
Comment 2 SpanKY gentoo-dev 2012-12-24 01:31:30 UTC
although, i'd also point out grep 2.12 has been stable since ~August
Comment 3 Agostino Sarubbo gentoo-dev 2012-12-26 14:17:18 UTC
(In reply to comment #1)
> 2.14 has already gone stable

Yes. The purpose of the bugreport is to track the issue and to send the glsa.


@security, please file the request.
Comment 4 Sean Amoss gentoo-dev Security 2012-12-26 16:52:42 UTC
New GLSA request filed.
Comment 5 Agostino Sarubbo gentoo-dev 2012-12-26 22:00:27 UTC
*** Bug 448708 has been marked as a duplicate of this bug. ***
Comment 6 GLSAMaker/CVETool Bot gentoo-dev 2013-01-06 13:53:59 UTC
CVE-2012-5667 (http://nvd.nist.gov/nvd.cfm?cvename=CVE-2012-5667):
  Multiple integer overflows in GNU Grep before 2.11 might allow
  context-dependent attackers to execute arbitrary code via vectors involving
  a long input line that triggers a heap-based buffer overflow.
Comment 7 GLSAMaker/CVETool Bot gentoo-dev 2014-03-26 16:15:40 UTC
This issue was resolved and addressed in
 GLSA 201403-07 at http://security.gentoo.org/glsa/glsa-201403-07.xml
by GLSA coordinator Mikle Kolyada (Zlogene).