1 |
-----BEGIN PGP SIGNED MESSAGE----- |
2 |
Hash: SHA1 |
3 |
|
4 |
Dear Mr. Etoh, |
5 |
|
6 |
i am asking myself the question whether compiling some object code of |
7 |
glibc makes sense with SSP being instrumented on some high level user |
8 |
visible glibc functions. |
9 |
|
10 |
As far as my understanding goes, a user that is attacking an executable |
11 |
with malformed overflow data cannot get this "overflow" data into glibc |
12 |
functions directly anyway. |
13 |
|
14 |
When a user is abusing a size restriction on the commandline arguments |
15 |
for example, the very long commandline argument argv[1] for example is |
16 |
put on the stack by the operating system kernel during launching the ELF |
17 |
binary. |
18 |
|
19 |
Then the argument sits there for the badly written program with a |
20 |
vulnerable function to strcpy() it into a too small buf[]. |
21 |
|
22 |
The strcpy() function inside glibc is not vulnerable to this attack |
23 |
itself because it is receiving a pointer to the data that has to be |
24 |
copied as well as a pointer to the space in memory where it has to be |
25 |
stored. It's just doing the work. |
26 |
|
27 |
So, strcpy() begins happily copying the massive amount of rubbish from |
28 |
the long commandline argument upwards into the space on the stack, which |
29 |
is too small, thus overwriting room above the stack, which happens to be |
30 |
the frame pointer or return address of the function inside the |
31 |
executable that called strcpy() in glibc and the function stack frame of |
32 |
the function "above" on the stack. |
33 |
|
34 |
But there is the __guard instrumented in the function of the executable |
35 |
compiled with SSP and all goes well because the guard is destroyed and |
36 |
the attack unveiled. |
37 |
|
38 |
|
39 |
|
40 |
Now for theory, if there would be one or more glibc functions, for |
41 |
example one called glibc_vulnerable_func_with_buffer() that takes data |
42 |
as a pointer and copies it from the pointer into a local buffer before |
43 |
processing. The buffer is too small and the copying of the data |
44 |
overwrites the stack frame of the glibc internal function upwards. |
45 |
|
46 |
To protect our said glibc function from overwriting the local buffer and |
47 |
overwriting the stack frame of itself we would be forced to instrument |
48 |
SSP on these internal glibc functions too, right? |
49 |
|
50 |
And if yes, i would need to search explicitly for glibc functions taking |
51 |
data from user programs and copying the data around inside their own |
52 |
local buffers in the glibc using unsafe and overflow-possible strcpy() |
53 |
instead of length-limited versions like strncpy(), right? |
54 |
|
55 |
|
56 |
Perhaps, can you shed some light on these thoughts, am i right or is |
57 |
there a technical mistake i have not recognized? |
58 |
|
59 |
Regards and thanks for your work, |
60 |
|
61 |
|
62 |
Alex |
63 |
-----BEGIN PGP SIGNATURE----- |
64 |
Version: GnuPG v1.4.5 (GNU/Linux) |
65 |
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org |
66 |
|
67 |
iD8DBQFFF2SylpSgoWRXlxURAgDCAJ9wdrnf4/z9AuPG+ZYuQbRXFBvEKACgg8QP |
68 |
BivJ0m7N4jRhfCvw24tkkHc= |
69 |
=2131 |
70 |
-----END PGP SIGNATURE----- |
71 |
-- |
72 |
gentoo-hardened@g.o mailing list |