From: "noloader at gmail dot com" <sourceware-bugzilla@sourceware.org>
To: bzip2-devel@sourceware.org
Subject: [Bug bzip2/25492] New: bzip2.c: ignoring return value of ‘fchown’
Date: Wed, 01 Jan 2020 00:00:00 -0000 [thread overview]
Message-ID: <bug-25492-11876@http.sourceware.org/bugzilla/> (raw)
https://sourceware.org/bugzilla/show_bug.cgi?id=25492
Bug ID: 25492
Summary: bzip2.c: ignoring return value of ‘fchown’
Product: bzip2
Version: unspecified
Status: UNCONFIRMED
Severity: minor
Priority: P2
Component: bzip2
Assignee: nobody at sourceware dot org
Reporter: noloader at gmail dot com
CC: bzip2-devel at sourceware dot org
Target Milestone: ---
This warning makes me feel uneasy. I believe a similar issue in a different
function was exploited on Android to gain root privileges.
I don't have a specific exploit in mind. It might be a good idea to audit the
use of the function and ensure it is safe with and without root privileges.
gcc -fpic -fPIC -Wall -D_FILE_OFFSET_BITS=64 -g2 -O2 -march=native -fPIC
-pthread -I. -L/usr/local/lib -Wl,-R,'$ORIGIN/../lib' -Wl,-R,/usr/local/lib
-Wl,--enable-new-dtags -o bzip2-shared bzip2.c libbz2.1.0.8.so
bzip2.c: In function ‘applySavedFileAttrToOutputFile’:
bzip2.c:1073:4: warning: ignoring return value of ‘fchown’, declared with
attribute warn_unused_result [-Wunused-result]
(void) fchown ( fd, fileMetaInfo.st_uid, fileMetaInfo.st_gid );
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the Android exploit, the return value of setuid() was not checked when root
attempted to drop privileges. Also see Android's Rage Against the Cage,
https://thesnkchrmr.wordpress.com/2011/03/24/rageagainstthecage/.
--
You are receiving this mail because:
You are on the CC list for the bug.
next reply other threads:[~2020-02-02 5:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-01 0:00 noloader at gmail dot com [this message]
2020-05-17 13:00 ` [Bug bzip2/25492] " mark at klomp dot org
2021-04-11 15:13 ` vapier at gentoo dot org
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bug-25492-11876@http.sourceware.org/bugzilla/ \
--to=sourceware-bugzilla@sourceware.org \
--cc=bzip2-devel@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).