REDHAT-BUG-1324759: Medium severity GNU gcc vulnerability
It was reported that targets that use libssp for SSP (e.g. newlib, Cygwin, RTEMS, MinGW, but not e.g. Glibc, Bionic, NetBSD which provide SSP in libc) are mistakenly missing out on -DFORTIFYSOURCE functionality even when explicitly specified. The problem is in gcc libssp/Makefile.am:
libsubincludedir = $(libdir)/gcc/$(targetnoncanonical)/$(gccversion)/include nobaselibsubincludeHEADERS = ssp/ssp.h ssp/string.h ssp/stdio.h ssp/unistd.h
Headers are structured so that they should be in $(libsubincludedir), instead of $(libsubincludedir)/ssp where they are currently placed.
Demonstration:
$ cat fortifytest.c / example from https://gcc.gnu.org/bugzilla/showbug.cgi?id=50460 [Open URL] / #include <stdio.h> #include <string.h>
const char str1 = "JIHGFEDCBA";
int main () { struct A { char buf1[9]; char buf2[1]; } a; strcpy (a.buf1 + (0 + 4), str1 + 5); printf("%s %s\n", a.buf1, a.buf2); return 0; }
$ gcc -DFORTIFYSOURCE=2 -fstack-protector-strong -o fortifytest -O2 fortifytest.c $ nm -C fortifytest | grep strcpy U strcpychk@@GLIBC2.3.4
$ i686-w64-mingw32-gcc -DFORTIFYSOURCE=2 -fstack-protector-strong -o fortifytest.exe -O2 fortifytest.c $ i686-w64-mingw32-nm -C fortifytest.exe | grep strcpy 004061e8 I impstrcpy 00402624 T strcpy
If headers are moved, we can see:
$ i686-w64-mingw32-gcc -DFORTIFYSOURCE=2 -fstack-protector-strong -o fortifytest.exe -O2 fortifytest.c $ i686-w64-mingw32-nm -C fortifytest.exe | grep strcpy 00406200 I impstrcpychk 00401590 T strcpychk
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Configuration
Move ssp/ssp.h, ssp/string.h, ssp/stdio.h, and ssp/unistd.h from $(libsubincludedir)/ssp into $(libsubincludedir).
GCC libssp Header installation path = $(libsubincludedir)
Event History
Frequently Asked Questions
What is the severity of REDHAT-BUG-1324759?
The severity of REDHAT-BUG-1324759 is considered medium due to the potential oversight of critical security features.
How do I fix REDHAT-BUG-1324759?
To fix REDHAT-BUG-1324759, update to the latest version of the affected libssp package that includes the corrected Makefile configurations.
What systems are affected by REDHAT-BUG-1324759?
The systems affected by REDHAT-BUG-1324759 include those using GCC libssp, newlib, Cygwin, RTEMS, and MinGW.
What impact does REDHAT-BUG-1324759 have on applications?
REDHAT-BUG-1324759 may lead to applications unintentionally lacking expected hardening features, making them more vulnerable to buffer overflow attacks.
Is REDHAT-BUG-1324759 being actively addressed by the developers?
Yes, developers are actively addressing REDHAT-BUG-1324759 and will provide updates in future releases to remedy the issue.