Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1371487 - RPM: OOB read in headerSigVerify()
RPM: OOB read in headerSigVerify()
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
: Security
Depends On: 1372685 1373107
Blocks: 1357448
  Show dependency treegraph
Reported: 2016-08-30 06:14 EDT by Cedric Buissart
Modified: 2017-01-24 06:07 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2017-01-24 06:07:34 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Cedric Buissart 2016-08-30 06:14:48 EDT
A heap based out-of-bound (OOB) read was discovered in RPM headerSigVerify() function, when doing a sanity check of the RPM headers. An attacker could trick a system administrator into reading a specially crafted RPM file, resulting in the crash of the RPM command.
The OOB read happens before the signature verification, thus the RPM does not need to be signed for the OOB to happen.

Upstream fix :
Comment 1 Cedric Buissart 2016-08-30 06:14:53 EDT

Name: Francisco Alonso
Comment 2 Cedric Buissart 2016-08-30 06:24:53 EDT
Valgrind backtrace:

==11445== Invalid read of size 8   
==11445==    at 0x4C2E25E: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==11445==    by 0x4E62530: UnknownInlinedFun (string3.h:51)
==11445==    by 0x4E62530: headerSigVerify (package.c:240)
==11445==    by 0x4E62530: headerVerify (package.c:363)
==11445==    by 0x4E62915: rpmpkgReadHeader (package.c:457)
==11445==    by 0x4E62BEA: rpmpkgRead (package.c:578)
==11445==    by 0x4E6352D: rpmReadPackageFile (package.c:717)
==11445==    by 0x4E6EB81: rpmgiReadHeader (rpmgi.c:90)
==11445==    by 0x4E6EB81: rpmgiLoadReadHeader (rpmgi.c:126)
==11445==    by 0x4E6EB81: rpmgiNext (rpmgi.c:216)
==11445==    by 0x4E671D8: rpmgiShowMatches (query.c:274)
==11445==    by 0x4E671D8: rpmcliArgIter (query.c:518)
==11445==    by 0x4E672A6: rpmcliQuery (query.c:568)
==11445==    by 0x401918: main (rpmqv.c:304)

Vulnerable code :
sigtd.data = memcpy(xmalloc(siglen), dataStart + info.offset, siglen);

While sanity checking a SHA1HEADER, RSAHEADER or DSAHEADER tag entry, there is no check that 'dataStart + info.offset + siglen' remains in the malloc'ed boundary.
Comment 3 Cedric Buissart 2016-09-02 07:29:39 EDT
Created rpm tracking bugs for this issue:

Affects: fedora-all [bug 1372685]

Note You need to log in before you can comment on or make changes to this bug.