Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 573106 - <app-portage/portage-utils-0.62: qlop: out-of-bound read in qlop.c
Summary: <app-portage/portage-utils-0.62: qlop: out-of-bound read in qlop.c
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Security
Classification: Unclassified
Component: Auditing (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Security
URL:
Whiteboard: A3 [noglsa stable]
Keywords: STABLEREQ
Depends on:
Blocks: 573574
  Show dependency tree
 
Reported: 2016-01-27 11:29 UTC by Agostino Sarubbo
Modified: 2016-06-15 05:04 UTC (History)
2 users (show)

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


Attachments
crafted-file.log (34-hangs.log,93.38 KB, application/octet-stream)
2016-01-27 11:29 UTC, Agostino Sarubbo
Details
ASan output (file_573106.txt,8.26 KB, text/plain)
2016-01-27 11:30 UTC, Agostino Sarubbo
Details
crash.log (34-hangs.log,93.38 KB, application/octet-stream)
2016-01-27 11:34 UTC, Agostino Sarubbo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Agostino Sarubbo gentoo-dev 2016-01-27 11:29:07 UTC
I found that a crafted file is able to crash qlop.

To see the out of bounds error you need to compile it with -fsanitize=address.

I will attach the crafted file and the output of ASan.
Comment 1 Agostino Sarubbo gentoo-dev 2016-01-27 11:29:46 UTC
Created attachment 423974 [details]
crafted-file.log
Comment 2 Agostino Sarubbo gentoo-dev 2016-01-27 11:30:40 UTC
Created attachment 423976 [details]
ASan output
Comment 3 Agostino Sarubbo gentoo-dev 2016-01-27 11:31:51 UTC
This is reproducible with all versions actually in our main tree, so 0.56 and 0.60


@SECURITY:
I'm waiting your feedback to proceed to ask a CVE ID for this issue. Thanks.
Comment 4 Agostino Sarubbo gentoo-dev 2016-01-27 11:34:56 UTC
Created attachment 423978 [details]
crash.log

Reattached as text/plain.
Comment 5 Agostino Sarubbo gentoo-dev 2016-01-27 11:39:53 UTC
(In reply to Agostino Sarubbo from comment #4)
> Created attachment 423978 [details]
> crash.log
> 
> Reattached as text/plain.

I'm unable to have the file attached in the right way via bugzilla. The crafted file is available here:
http://dev.gentoo.org/~ago/qlop-crash-oob.log
Comment 6 SpanKY gentoo-dev 2016-01-27 17:46:04 UTC
there's no point in hiding this bug.  open it up.
Comment 7 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-01-27 20:52:09 UTC
(In reply to SpanKY from comment #6)
> there's no point in hiding this bug.  open it up.

This is standard policy for security auditing: "When you find a vulnerability, you should write a vulnerability description and submit it for peer-review as a new security bug (with "Gentoo Security" as product and "Auditing" as component, restricted to Gentoo Security). Other auditors (and security team members) will double-check what you found, ensure that it is indeed a bug with a security impact. " https://wiki.gentoo.org/wiki/Project:Auditing
Comment 8 SpanKY gentoo-dev 2016-01-27 21:53:53 UTC
(In reply to Kristian Fiskerstrand from comment #7)

this bug is irrelevant in the wider world.  people aren't running qlop manually on specially crafted files.  the impact is 0.  it is however making it a pain for me to look into it.

if you want me to look into it, open the bug.  otherwise i won't bother.
Comment 9 Kristian Fiskerstrand (RETIRED) gentoo-dev 2016-01-28 08:13:03 UTC
(In reply to SpanKY from comment #8)
> (In reply to Kristian Fiskerstrand from comment #7)
> 
> this bug is irrelevant in the wider world.  people aren't running qlop
> manually on specially crafted files.  the impact is 0.  it is however making
> it a pain for me to look into it.

Fair enough, opening
Comment 10 SpanKY gentoo-dev 2016-01-29 05:31:22 UTC
Comment on attachment 423974 [details]
crafted-file.log

this file works fine to reproduce
Comment 11 SpanKY gentoo-dev 2016-01-29 05:55:29 UTC
the crash is due to a truncated line, so we end up trying to read 2 bytes beyond what is valid.  even then, we're talking about reading beyond the buffer.

we do a single byte write when we see 'completed emerge' in that garbage buffer, but it's only to reset a space (0x20) byte to NUL (0x00).  so the chance of exploit is extremely low if non-existent.  you'd have to do quite a lot of heap grooming first.

fixed by:
https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=7aff0263204d80304108dbe4f0061f44ed8f189f

in terms of versions, it's probably been this way "forever", and not a recent bug.
Comment 13 Tobias Heinlein (RETIRED) gentoo-dev 2016-02-14 02:11:07 UTC
(In reply to SpanKY from comment #12)
> 0.61 in the tree now
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=e5ba4a518a1fc671562fda1e57193e73498095bd

Thanks! Is this ok to go stable?

I agree with the no impact bit, though. Therefore [noglsa stable?].
Comment 14 SpanKY gentoo-dev 2016-03-28 04:56:50 UTC
0.62 is fine to stable now
Comment 15 Aaron Bauman (RETIRED) gentoo-dev 2016-03-28 10:32:38 UTC
@arches, please stabilize:

=app-portage/portage-utils-0.62
Comment 16 Jeroen Roovers (RETIRED) gentoo-dev 2016-03-28 20:36:48 UTC
Stable for HPPA PPC64.
Comment 17 Markus Meier gentoo-dev 2016-03-30 18:30:20 UTC
arm stable
Comment 18 Agostino Sarubbo gentoo-dev 2016-04-02 14:19:30 UTC
amd64 stable
Comment 19 Agostino Sarubbo gentoo-dev 2016-04-11 10:40:05 UTC
x86 stable
Comment 20 Matt Turner gentoo-dev 2016-05-02 04:21:32 UTC
alpha stable
Comment 21 SpanKY gentoo-dev 2016-06-15 05:04:28 UTC
done all the rest now