Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 838050

Summary: [RFE] glibc: warn() and other functions are not protected by FORTIFY_SOURCE format string protection
Product: Red Hat Enterprise Linux 7 Reporter: Stefan Cornelius <scorneli>
Component: glibcAssignee: Carlos O'Donell <codonell>
Status: CLOSED WONTFIX QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: codonell, fweimer, huzaifas, mfranc, mjc, mnewsome
Target Milestone: rcKeywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-06 17:26:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Stefan Cornelius 2012-07-06 09:23:00 UTC
Description of problem:
Huzaifa S. Sidhpurwala of SRT noticed that some functions using formatted printing (e.g. "warn()", "err()", and "warnx()") are not protected by the fortify source format string protection. The relevant functions were never meant to be protected by fortify source, so from a security point of view, this is an enhancement only. Since fixing this would break the ABI, we need to work with upstream to see if a protection for these functions can be included in future versions.

Description from the original bug #836931:
While looking into some format string issue, i found that the warn() function does not seem to be protected by the glibc FORTIFY_SOURCE Format string protection mechanism.

Here is a simple example to prove my point:

[huzaifas@babylon ~]$ cat warn1.c 
#include <stdio.h>
#include <err.h>

void main(int argc, char *argv[])
{
warn(argv[1]);
//printf(argv[1]);
}

[huzaifas@babylon ~]$ gcc -O -g -D_FORTIFY_SOURCE=2 -o warn warn1.c
[huzaifas@babylon ~]$ cat print.c 
#include <stdio.h>
#include <err.h>

void main(int argc, char *argv[])
{
//warn(argv[1]);
printf(argv[1]);
}
[huzaifas@babylon ~]$ gcc -O -g -D_FORTIFY_SOURCE=2 -o print print.c

[huzaifas@babylon ~]$ ./warn "%100s%n"
warn:                                                                                               ?&#9646;&#65533;: Segmentation fault
[huzaifas@babylon ~]$ ./print "%100s%n"
*** %n in writable segment detected ***
                                                                                              L&#65533;|&#65533;Aborted
[huzaifas@babylon ~]$

Comment 2 Jeff Law 2012-07-06 16:28:02 UTC
It might be interesting to do an audit and see if anything is actually using those functions.  I'd be a bit surprised given they're really outside the standard and better functions exist within the standard to handle this stuf

Jeff

Comment 3 Stefan Cornelius 2012-07-09 11:26:05 UTC
*** Bug 836931 has been marked as a duplicate of this bug. ***

Comment 4 Mark J. Cox 2012-07-30 13:18:48 UTC
This request is due https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2012-1151 where we had to fix a format string flaw in a RHEL package because of the lack of warn() fortification and ended up having to do an impact=important RHSA

Comment 5 Jeff Law 2012-08-03 17:56:32 UTC
Thanks Mark.  Amazing to find code using these bogus interfaces.

Any thoughts on doing an audit of the RHEL packages & libraries for other instances that are using these bogus interfaces?  In theory, it's just "nm" piped to "grep" across everything in RHEL.

Jeff

Comment 12 RHEL Program Management 2013-09-06 17:26:18 UTC
Development Management has reviewed and declined this request.
You may appeal this decision by reopening this request.