$ chmod +x pwn $ checksec pwn Arch: amd64-64-little RELRO: Full RELRO Stack: No canary found NX: NX enabled PIE: PIE enabled
64位仅关闭Canary保护
用64位IDA打开查看main函数(按F5进入反汇编或者Tab键)
int __fastcall main(int argc, constchar **argv, constchar **envp) { setvbuf(_bss_start, 0, 2, 0); setvbuf(stdin, 0, 2, 0); puts(s); puts(asc_950); puts(asc_9D0); puts(asc_A60); puts(asc_AF0); puts(asc_B78); puts(asc_C10); puts(" * ************************************* "); puts(aClassifyCtfsho); puts(" * Type : Test "); puts(" * Site : https://ctf.show/ "); puts(" * Hint : You only need to connect to the remote address with NC to get the flag!"); puts(" * ************************************* "); puts("I think now it is necessary to test whether your NC is useful! "); system("cat /ctfshow_flag"); return0; }
程序直接执行了后门函数
程序中执行的system函数里面的命令就是在shell中执行了此命令,因此
当远程环境的根目录中存在此文件就会直接将其读出来
$ ./pwn * ************************************* * Classify: CTFshow --- PWN --- 入门 * Type : Test * Site : https://ctf.show/ * Hint : You only need to connect to the remote address with NC to get the flag! * ************************************* I think now it is necessary to test whether your NC is useful! cat: /ctfshow_flag: No such file or directory
$ ./pwn * ************************************* * Classify: CTFshow --- PWN --- 入门 * Type : Test * Site : https://ctf.show/ * Hint : You only need to connect to the remote address with NC to get the flag! * ************************************* I think now it is necessary to test whether your NC is useful! flag{just_test_my_process}
pwn2
Hint:给你一个shell,这次需要你自己去获得flag
远程: nc ip 端口
本地:
checksec检查保护
$ chmod +x pwn $ checksec pwn Arch: amd64-64-little RELRO: Full RELRO Stack: No canary found NX: NX enabled PIE: PIE enabled
64位仅关闭Canary保护
用64位IDA打开查看main函数(按F5进入反汇编或者Tab键)
int __fastcall main(int argc, constchar **argv, constchar **envp) { setvbuf(_bss_start, 0, 2, 0); setvbuf(stdin, 0, 2, 0); logo(); puts(" Now, you can use 'cat /ctfshow_flag' to get flag! "); system("/bin/sh"); return0; }
$ ./pwn * ************************************* * Classify: CTFshow --- PWN --- 入门 * Type : Test * Site : https://ctf.show/ * Hint : To give you a shell! * ************************************* Now, you can use 'cat /ctfshow_flag' to get flag! $ id uid=1000(helloctfos) gid=1000(helloctfos) groups=1000(helloctfos),4(adm),20(dialout),24(cdrom),25(floppy),27(sudo),29(audio),30(dip),44(video),46(plugdev),116(netdev),999(docker) $ whoami helloctfos $ ls $ cat /ctfshow_flag
$ ./pwn * ************************************* * Classify: CTFshow --- PWN --- 入门 * Type : Test * Site : https://ctf.show/ * Hint : Choice the right backdoor ! * ************************************* [*] level up ! Let's go ! You can call the following function: 1._start 2.main 3.hello_ctfshow 4.ctfshow('echo /ctfshow_flag') 5.print('/ctfshow_flag') 6.system('cat /ctfshow_flag') 7.puts('/ctfshow_flag') 8.exit Your choice is : 6 flag{just_test_my_process}