hi,
der Fehler bekam ich mit suse 11.2.Als ich suse 12.1 installiert habe,kam ich auf das gleiche Problem.
Der code möchte ich gerne untersuch mit gdb
Mein Terminal:
der Versuch debuginfo zu installiert.
der Fehler bekam ich mit suse 11.2.Als ich suse 12.1 installiert habe,kam ich auf das gleiche Problem.
Der code möchte ich gerne untersuch mit gdb
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int check_authentication(char *password) {
int auth_flag = 0;
char password_buffer[16];
strcpy(password_buffer, password);
if(strcmp(password_buffer, "brillig") == 0)
auth_flag = 1;
if(strcmp(password_buffer, "outgrabe") == 0)
auth_flag = 1;
return auth_flag;
}
int main(int argc, char *argv[]) {
if(argc < 2) {
printf("Usage: %s <password>\n", argv[0]);
exit(0);
}
if(check_authentication(argv[1])) {
printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
printf(" Access Granted.\n");
printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
} else {
printf("\nAccess Denied.\n");
}
}
Mein Terminal:
tomycat@linux-m07o:~/hacking> gcc -g3 -z execstack -fno-stack-protector -o auth_overflow
tomycat@linux-m07o:~/hacking> gdb -q ./auth_overflow
Reading symbols from /home/tomycat/hacking/auth_overflow...done.
(gdb) list 1
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4
5 int check_authentication(char *password) {
6 int auth_flag = 0;
7 char password_buffer[16];
8
9 strcpy(password_buffer, password);
10
(gdb)
11 if(strcmp(password_buffer, "brillig") == 0)
12 auth_flag = 1;
13 if(strcmp(password_buffer, "outgrabe") == 0)
14 auth_flag = 1;
15
16 return auth_flag;
17 }
18
19 int main(int argc, char *argv[]) {
20 if(argc < 2) {
(gdb)
21 printf("Usage: %s <password>\n", argv[0]);
22 exit(0);
23 }
24 if(check_authentication(argv[1])) {
25 printf("\n-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
26 printf(" Access Granted.\n");
27 printf("-=-=-=-=-=-=-=-=-=-=-=-=-=-\n");
28 } else {
29 printf("\nAccess Denied.\n");
30 }
(gdb)
31 }
32
(gdb) break 9
Breakpoint 1 at 0x8048501: file auth_overflow.c, line 9.
(gdb) break 16
Breakpoint 2 at 0x804854f: file auth_overflow.c, line 16.
(gdb) run AAAAAAAAAAAAAAAAAAAAAAA
Starting program: /home/tomycat/hacking/auth_overflow AAAAAAAAAAAAAAAAAAAAAAA
Missing separate debuginfo for /lib/ld-linux.so.2
Try: zypper install -C "debuginfo(build-id)=22e2b3718e8271a0d899156a796b0a90bc4dc391"
Missing separate debuginfo for /lib/libc.so.6
Try: zypper install -C "debuginfo(build-id)=62a8bfd7732322fa6b9c39d39a830a8028804534"
Breakpoint 1, check_authentication (password=0xbffff293 'A' <repeats 23 times>) at auth_overflow.c:9
9 strcpy(password_buffer, password);
(gdb)
der Versuch debuginfo zu installiert.
tomycat@linux-a4gd:~/hacking> zypper install -C "debuginfo(build-id)=39c1043d2fcf5b72a2199cfb765d020b1faeb863"
Zum Installieren oder Deinstallieren von Paketen werden Root-Rechte benötigt.
tomycat@linux-a4gd:~/hacking> sudo zypper install -C "debuginfo(build-id)=39c1043d2fcf5b72a2199cfb765d020b1faeb863"
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
root's password:
Daten des Repositories laden ...
Installierte Pakete lesen ...
Keine Anbieter von 'debuginfo(build-id) = 39c1043d2fcf5b72a2199cfb765d020b1faeb863' gefunden.
Paketabhängigkeiten auflösen ...
Keine auszuführenden Aktionen.
tomycat@linux-a4gd:~/hacking>