能力值:
(RANK:520 )
|
-
-
2 楼
|
能力值:
( LV2,RANK:10 )
|
-
-
3 楼
咨询一下,第67和68行为什么要对2进行两次编辑呢? 我试着改成一行Edit(2,p64(puts_plt)+'1'*0x10 + p64(free_got) + p64(1) + p64(atoi_got)+ "\n"),会报错 还有第71行atoi_addr = u64(p.recv(8)) & 0xffffffffffff 这里为什么要和12个f作与运算呢? 多谢
|
能力值:
( LV12,RANK:219 )
在线值:

|
-
-
4 楼
lishua
咨询一下,第67和68行为什么要对2进行两次编辑呢? 我试着改成一行Edit(2,p64(puts_plt)+'1'*0x10 + p64(free_got) + p64(1) + p64(atoi_ ...
第一个问题 第一次修改是因为需要绕过unlink的判断 于是将指针指向p-0x18 第二次修改就能够任意地址写了 第二个好像是调试的时候发现这样获取的地址才是正确的,于是就这样写了
|
能力值:
( LV2,RANK:10 )
|
-
-
5 楼
|
能力值:
( LV2,RANK:10 )
|
-
-
6 楼
回去想了一下,实在是想不通 我写了一个小程序,为了测试自己的想法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
long int a[1];
long int d;
#define unlink(P,BK,FD){\
\
d=( long int )a;\
FD=( struct s*)(d-0x18);\
BK=( struct s*)(d-0x10);\
if (__builtin_expect (FD->bk != P || BK->fd != P, 0))\
printf ( "corrupted double-linked list\n" );\
else {\
FD->bk = BK;\
\
BK->fd = FD;\
}\
}
struct s
{
long int b;
long int c;
struct s *fd;
struct s *bk;
};
main ()
{
struct s *FD;
struct s *BK;
struct s *p1 = malloc ( sizeof ( struct s));
p1->b = 1;
struct s *p2 = malloc ( sizeof ( struct s));
p2->b = 2;
struct s *p3 = malloc ( sizeof ( struct s));
p3->b = 3;
a[0] = ( long int )p3;
struct s *p4 = malloc ( sizeof ( struct s));
p4->b = 4;
struct s *p5 = malloc ( sizeof ( struct s));
p5->b = 5;
p1->fd = p2;
p2->fd = p3;
p3->fd = p4;
p4->fd = p5;
p5->bk = p4;
p4->bk = p3;
p3->bk = p2;
p2->bk = p1;
struct s *p;
p = p1;
while (p != NULL)
{
printf ( "%d->" , p->b);
p = p->fd;
}
printf ( "\n" );
printf ( "[1]:%x\n" ,a[0]);
unlink (p3, FD, BK);
printf ( "[2]:%x\n" ,a[0]);
printf ( "[3]:%x\n" ,p3);
char m[]= "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHH" ;
memcpy (p3,m,32);
printf ( "[4]:%x\n" ,a[0]);
p = p1;
while (p != NULL)
{
printf ( "%d->" , p->b);
p = p->fd;
}
free (p1);
free (p2);
free (p3);
free (p4);
free (p5);
}
|
运行结果如下: [admin@bogon 4-ReeHY-main]$ ./3 1->2->3->4->5-> [1]:2210070 [2]:601058 [3]:2210070 [4]:601058 Segmentation fault (core dumped) 说明unlink后,a[0]的值确实变化了,但是我把p3的内容修改了,并没有覆盖到a[0],这是为什么呢?
|
能力值:
( LV2,RANK:10 )
|
-
-
7 楼
哎,脑子不太好用,我死记住了
|
|
-
-
8 楼
free_got = elf.got['free'] atoi_got = elf.got['atoi'] puts_plt = elf.plt['puts'] 您好,我想请问下,什么时候用plt地址什么时候用got地址呢?
|
|
|