Package: unar
Version: 1.2-1
Severity: normal
Tags: patch

Dear Maintainer,

The CPPFLAGS hardening flags are missing for .m and .cpp files
because they are not enabled for all *FLAGS in the Makefile. For
more hardening information please have a look at [1], [2] and
[3].

The attached patch is an updated version of
pass-cppflags-for-fortify-functions.patch which fixes the issue.
The revised version should be sent to upstream.

CPPFLAGS are preprocessor flags and should be used for all source
files which use a preprocessor, this includes .m and .cpp files.

To check if all flags were correctly enabled you can use
`hardening-check` from the hardening-includes package and check
the build log with `blhc` (hardening-check doesn't catch
everything):

    $ hardening-check /usr/bin/unar /usr/bin/lsar
    /usr/bin/unar:
     Position Independent Executable: no, normal executable!
     Stack protected: yes
     Fortify Source functions: yes (some protected functions found)
     Read-only relocations: yes
     Immediate binding: no not found!
    /usr/bin/lsar:
     Position Independent Executable: no, normal executable!
     Stack protected: yes
     Fortify Source functions: yes (some protected functions found)
     Read-only relocations: yes
     Immediate binding: no not found!

You can see the difference if you add --verbose and check it
without and with the patch.

(Position Independent Executable and Immediate binding is not
enabled by default.)

Use find -type f \( -executable -o -name \*.so\* \) -exec
hardening-check {} + on the build result to check all files.

Regards,
Simon

[1]: https://wiki.debian.org/ReleaseGoals/SecurityHardeningBuildFlags
[2]: https://wiki.debian.org/HardeningWalkthrough
[3]: https://wiki.debian.org/Hardening
-- 
+ privacy is necessary
+ using gnupg http://gnupg.org
+ public key id: 0x92FEFDB7E44C32F9
Description: Pass CPPFLAGS to use hardening flags, fortify functions.
Forwarded: http://code.google.com/p/theunarchiver/issues/detail?id=529
Author: Julián Moreno Patiño <jul...@debian.org>
Last-Update: 2012-09-08
Index: unar-1.2/UniversalDetector/Makefile.linux
===================================================================
--- unar-1.2.orig/UniversalDetector/Makefile.linux	2012-09-06 14:02:39.000000000 +0200
+++ unar-1.2/UniversalDetector/Makefile.linux	2012-09-13 12:47:53.051756723 +0200
@@ -31,9 +31,9 @@
 
 AUTODEPENDENCY_CFLAGS=-MMD -MF$(@:.o=.d) -MT$@
 
-ALL_OBJCFLAGS = $(OBJC_OPTS) $(GCC_OPTS) $(GNUSTEP_OPTS) $(OBJCFLAGS)
-ALL_CFLAGS = $(C_OPTS) $(GCC_OPTS) $(CFLAGS)
-ALL_CXXFLAGS = $(CXX_OPTS) $(GCC_OPTS) $(CXXFLAGS)
+ALL_OBJCFLAGS = $(OBJC_OPTS) $(GCC_OPTS) $(GNUSTEP_OPTS) $(OBJCFLAGS) $(CPPFLAGS)
+ALL_CFLAGS = $(C_OPTS) $(GCC_OPTS) $(CFLAGS) $(CPPFLAGS)
+ALL_CXXFLAGS = $(CXX_OPTS) $(GCC_OPTS) $(CXXFLAGS) $(CPPFLAGS)
 
 # Options for linking
 
Index: unar-1.2/XADMaster/Makefile.linux
===================================================================
--- unar-1.2.orig/XADMaster/Makefile.linux	2012-09-13 12:40:06.000000000 +0200
+++ unar-1.2/XADMaster/Makefile.linux	2012-09-13 12:44:03.639747990 +0200
@@ -31,9 +31,9 @@
 
 AUTODEPENDENCY_CFLAGS=-MMD -MF$(@:.o=.d) -MT$@
 
-ALL_OBJCFLAGS = $(OBJC_OPTS) $(GCC_OPTS) $(GNUSTEP_OPTS) $(OBJCFLAGS)
-ALL_CFLAGS = $(C_OPTS) $(GCC_OPTS) $(CFLAGS)
-ALL_CXXFLAGS = $(CXX_OPTS) $(GCC_OPTS) $(CXXFLAGS)
+ALL_OBJCFLAGS = $(OBJC_OPTS) $(GCC_OPTS) $(GNUSTEP_OPTS) $(OBJCFLAGS) $(CPPFLAGS)
+ALL_CFLAGS = $(C_OPTS) $(GCC_OPTS) $(CFLAGS) $(CPPFLAGS)
+ALL_CXXFLAGS = $(CXX_OPTS) $(GCC_OPTS) $(CXXFLAGS) $(CPPFLAGS)
 
 # Options for linking
 

Attachment: signature.asc
Description: Digital signature

Reply via email to