what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

Foritfy Arbitrary Memory Address Space

Foritfy Arbitrary Memory Address Space
Posted Apr 28, 2010
Authored by Dan Rosenberg

Fortify (FORTIFY_SOURCE as used with gdb) suffers from a little trick that allows for reading of arbitrary address space.

tags | paper, arbitrary
SHA-256 | 5592ed45c719808d090e4002892c4abedb9388b403958b3feadde04a23960930

Foritfy Arbitrary Memory Address Space

Change Mirror Download
I wanted to share a neat little trick I discovered while playing with
gcc's FORTIFY_SOURCE feature. For those who don't know, this feature
attempts to prevent exploitation of a subset of buffer overflows by
inserting a set of checks at compile-time, including stack canaries
for some functions. It's enabled by default in many cases. In
particular, when FORTIFY_SOURCE detects an overflow, it aborts
execution and prints an error message that might look similar to the
following:

*** stack smashing detected ***: ./strcpy terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x40)[0x502b30]
/lib/libc.so.6(__fortify_fail+0x0)[0x502af0]
./strcpy[0x80484d5]
[0x41414141]
======= Memory map: ========
...
Aborted

Notice that this error message contains a reference to the
application's name, which is obtained by simply relying on argv[0].
Assuming the application was aborted because of a controllable
stack-based buffer overflow, in some cases an attacker may be able to
continue overflowing past the vulnerable buffer, overwriting the
argv[0] pointer, causing the error message to print arbitrary memory
addresses, as in the following contrived example:

$ ./strcpy `perl -e 'print "\xa0\x85\x04\x08"x80'`

*** stack smashing detected ***: THIS IS A SECRET terminated
======= Backtrace: =========
/lib/libc.so.6(__fortify_fail+0x40)[0x1f3b30]
/lib/libc.so.6(__fortify_fail+0x0)[0x1f3af0]
THIS IS A SECRET[0x80484d5]
THIS IS A SECRET[0x80485a0]
======= Memory map: ========
...
Aborted

If an attacker ever stumbles upon a setuid application with an
overflow that's caught by FORTIFY_SOURCE, this may be used to read the
application's address space (which may contain sensitive information),
even if code execution is mitigated. Because it relies on the
existence of another vulnerability, I wouldn't consider this a serious
issue by any means, but it's probably something that's worth fixing
eventually.

Happy hacking,
Dan Rosenberg

Login or Register to add favorites

File Archive:

April 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Apr 1st
    10 Files
  • 2
    Apr 2nd
    26 Files
  • 3
    Apr 3rd
    40 Files
  • 4
    Apr 4th
    6 Files
  • 5
    Apr 5th
    26 Files
  • 6
    Apr 6th
    0 Files
  • 7
    Apr 7th
    0 Files
  • 8
    Apr 8th
    22 Files
  • 9
    Apr 9th
    14 Files
  • 10
    Apr 10th
    10 Files
  • 11
    Apr 11th
    13 Files
  • 12
    Apr 12th
    14 Files
  • 13
    Apr 13th
    0 Files
  • 14
    Apr 14th
    0 Files
  • 15
    Apr 15th
    30 Files
  • 16
    Apr 16th
    10 Files
  • 17
    Apr 17th
    22 Files
  • 18
    Apr 18th
    45 Files
  • 19
    Apr 19th
    8 Files
  • 20
    Apr 20th
    0 Files
  • 21
    Apr 21st
    0 Files
  • 22
    Apr 22nd
    11 Files
  • 23
    Apr 23rd
    68 Files
  • 24
    Apr 24th
    23 Files
  • 25
    Apr 25th
    0 Files
  • 26
    Apr 26th
    0 Files
  • 27
    Apr 27th
    0 Files
  • 28
    Apr 28th
    0 Files
  • 29
    Apr 29th
    0 Files
  • 30
    Apr 30th
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close