{"id":147,"date":"2019-04-28T21:26:00","date_gmt":"2019-04-28T13:26:00","guid":{"rendered":"https:\/\/0x.mk\/?p=147"},"modified":"2019-04-28T21:26:56","modified_gmt":"2019-04-28T13:26:56","slug":"bugku-mountain-climbing-writeup","status":"publish","type":"post","link":"https:\/\/0x.mk\/?p=147","title":{"rendered":"Bugku &#8211; Mountain Climbing WriteUp"},"content":{"rendered":"\n<p>\u521a\u624d\u770b\u5230\u7684\u8fd9\u9053\u633a\u6709\u610f\u601d\u7684\u9898<\/p>\n\n\n\n<p>\u5230\u624b\u76f4\u63a5\u4e22\u8fdbIDA\uff0cemmm\u5148\u8131\u4e2aUPX\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1092\" height=\"220\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428202212.png\" alt=\"\" class=\"wp-image-148\"\/><figcaption>Ctrl + S \u67e5\u770bSegment<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1367\" height=\"1103\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428202624.png\" alt=\"\" class=\"wp-image-149\"\/><figcaption>\u7a0b\u5e8f\u4e3b\u4f53<\/figcaption><\/figure>\n\n\n\n<p> \u8131\u58f3\u4ee5\u540e\u518d\u6b21\u4e22\u8fdbIDA\uff0c\u53ef\u89c1\u7a0b\u5e8f\u903b\u8f91\u633a\u7b80\u5355\u7684\uff0c\u770b\u8d77\u6765\u53ea\u8981\u8f93\u516519\u4e2a\u201cL\u201d\u6216\u8005\u201cR\u201d\u7ec4\u6210\u7684\u5b57\u7b26\u4e32\u5c31\u4f1a\u8ba1\u7b97\u5206\u6570\uff0c\u4e8e\u662f\u6211\u4eec\u5c1d\u8bd5\u4e00\u4e0b :<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"783\" height=\"169\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428202934.png\" alt=\"\" class=\"wp-image-150\"\/><\/figure>\n\n\n\n<p>\u3093\uff1f\uff08\u5bdf\u89c9<\/p>\n\n\n\n<p>\u7136\u540e\u518d\u4ed4\u7ec6\u770b\u4e86\u4e00\u773c\uff0c<code>sub_41114F<\/code>\u8fd9\u4e2a\u51fd\u6570\u5341\u5206\u53ef\u7591\uff0c\u8ddf\u8fdb\u53bb\u770b\u4e00\u773c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"780\" height=\"141\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428203054.png\" alt=\"\" class=\"wp-image-151\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"940\" height=\"416\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428203110.png\" alt=\"\" class=\"wp-image-152\"\/><\/figure>\n\n\n\n<p><code>VirtualQuery<\/code>\u548c<code>VirtualProtect<\/code>\u90fd\u662fsmjb\uff1f<\/p>\n\n\n\n<p>\u5413\u5f97\u6211\u8d76\u7d27\u6253\u5f00Google\u95ee\u4e00\u4e0b\u8c37\u6b4c\u5a18<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1247\" height=\"1170\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428203343.png\" alt=\"\" class=\"wp-image-153\"\/><figcaption> VirtualProtect <\/figcaption><\/figure>\n\n\n\n<p>\u770b\u8d77\u6765\u662f\u4f7f\u5185\u5b58\u53ef\u5199\u5165\u3002\u8fd9\u65f6\u5019\u6211\u5c31\u5728\u6495\u70e4\u7740\u5230\u5e95\u662f\u4e0d\u662f\u4ec0\u4e48\u7f16\u8bd1\u5668\u5e26\u8fdb\u53bb\u7684\u7cfb\u7edf\u51fd\u6570\u3002Google\u4e86\u4e00\u4e0b\u8be5\u9898\u7684writeup\uff0c\u53d1\u73b0\u5168\u90fd\u662f\u8fd9\u4e48\u8bf4\u7684\uff1a<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\"><p>\u800c\u5f53\u6211\u8c03\u8bd5\u7ecf\u8fc7004114F\u8fd9\u4e2a\u51fd\u6570\u8fc7\u540e\uff0c\u6211\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u53d1\u751f\u4e86\u6709\u89c4\u5f8b\u7684\u6539\u53d8\uff1a \u518d\u8bd5\u9a8c\u51e0\u4e2a\u7531\u201cH\u201d\u548c\u201cV\u201d\u6784\u6210\u7684\u5b57\u7b26\u4e32\u540e\u53d1\u73b0\uff0c004114F\u8fd9\u4e2a\u52a0\u5bc6\u51fd\u6570\u662f\u5c06\u5076\u6570\u4f4d\u7684L\u4e0eH\u4e92\u6362\uff0c\u5076\u6570\u4f4d\u7684R\u4e0eV\u4e92\u6362\u3002\u4e8e\u662f\u5c06\u539f\u6765\u6df1\u641c\u7684\u7ed3\u679c\u8fdb\u884c\u76f8\u5e94\u7684\u8f6c\u6362\uff0c\u4fbf\u662fflag\u4e2d\u62ec\u53f7\u91cc\u7684\u5185\u5bb9\u4e86\u3002<\/p><\/blockquote>\n\n\n\n<p>\u8349\uff08\u65e5\u672c\u8bed\uff09\uff0c\u8bf4\u4e86\u8ddf\u6ca1\u8bf4\u4e00\u6837\u3002<\/p>\n\n\n\n<p>\u4e8e\u662f\u51b3\u5b9a\u81ea\u5df1\u7528IDA\u7684<strong>Remote Windows Debugger<\/strong>\u8c03\u4e00\u4e0b\u3002\u6ce8\u610f\u8fd9\u91cc\u4e0d\u7528Local\u662f\u56e0\u4e3a\u4e0d\u77e5\u9053\u4e3a\u4ec0\u4e48\uff0c\u6cc4\u9732\u7248\u7684IDA 7.0\u65e0\u6cd5\u6b63\u5e38\u8c03\u8bd5exe\uff0c\u4e00\u8fd0\u884c\u5c31\u5d29\u3002\u3002<\/p>\n\n\n\n<p>\u4e8e\u662f\u6211\u4eec\u5728<code>sub_411750<\/code>\u8fd9\u91cc\u4e0b\u65ad\u70b9\uff0c\u7136\u540e\u6267\u884c\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1826\" height=\"1178\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428204535.png\" alt=\"\" class=\"wp-image-154\"\/><\/figure>\n\n\n\n<p>\u55ef\uff1f\uff1f\uff1fEAX\u6307\u5411\u4e86\u4e00\u4e2anullsub\uff0c\u7136\u540e\u5bf9\u51fd\u6570\u4f53\u5f02\u6216\uff1f<\/p>\n\n\n\n<p>\u4e8e\u662f\u6211\u4eec\u5728\u8fd9\u4e2a\u51fd\u6570return\u4e4b\u524d\u4e0b\u4e2a\u65ad\u70b9\uff0c\u770b\u4e00\u4e0b\u4e4b\u540e\u8fd9\u4e2anullsub\u53d8\u6210\u4ec0\u4e48\u6837\u4e86<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"904\" height=\"282\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428205931.png\" alt=\"\" class=\"wp-image-155\"\/><figcaption>\u5f02\u6216\u524d<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1040\" height=\"864\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428210037.png\" alt=\"\" class=\"wp-image-156\"\/><figcaption>\u5f02\u6216\u540e<\/figcaption><\/figure>\n\n\n\n<p>\u770b\u8d77\u6765\u3002\u3002\u8fd9\u7a0b\u5e8f\u662f\u628a\u8fd9\u4e2a\u51fd\u6570\u52a0\u5bc6\u4e86\u3002\u6211\u4eec\u628a\u539f\u6765\u7684nullsub_1 \u6309U undefine\u6389\uff0c\u7136\u540e\u6309p\u91cd\u65b0parse\u51fd\u6570\uff0c\u518dF5\uff0c\u5c31\u83b7\u5f97\u4e86\u8fd9\u6837\u7684\u4e1c\u897f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"898\" height=\"258\" src=\"https:\/\/0x.mk\/wp-content\/uploads\/2019\/04\/TIM\u622a\u56fe20190428210443.png\" alt=\"\" class=\"wp-image-157\"\/><\/figure>\n\n\n\n<p>\u55ef\uff0c\u8fd9\u5c31\u662f\u628a\u8f93\u5165\u5b57\u7b26\u4e32\u5076\u6570\u4f4d\u8ddf4\u5f02\u6216\uff0c\u83b7\u5f97\u7ed3\u679c\u7684\u51fd\u6570\u4e86\u3002<\/p>\n\n\n\n<p>\u6700\u540e\u6211\u4eec\u6765\u6574\u7406\u4e0b\uff1a<\/p>\n\n\n\n<p><code>sub_41114F<\/code>\u8c03\u7528<code>sub_411900<\/code>\uff0c\u8c03\u7528<code>sub_4110A5<\/code>\uff0c\u4f20\u9012\u53c2\u6570\u4e3a\u88ab\u52a0\u5bc6\u7684\u51fd\u6570\u7684\u6307\u9488\u548c\u51fd\u6570\u4f53\u957f\u5ea6\uff080x411994-0x411953\uff09\uff0c\u4ee5\u53ca\u5f02\u6216\u7684\u6570\u503c\uff084\uff09\uff0c<code>sub_4110A5<\/code>\u628a<code>nullsub_1<\/code>\u51fd\u6570\u89e3\u5bc6\u5b8c\u6210\u4ee5\u540e\uff0c\u8c03\u7528\u4ed6\uff0c\u8fdb\u884c\u771f\u6b63\u7684\u5b57\u7b26\u4e32\u5904\u7406\u3002<\/p>\n\n\n\n<p>\u518d\u5f80\u540e\uff0c\u5c31\u662f\u5206\u6790\u7a0b\u5e8f\u540e\u9762\u7684\u8ba1\u7b97\u5206\u6570\u8fc7\u7a0b\u4e86\u3002\u9996\u5148\u6211\u4eec\u9700\u8981\u83b7\u5f97\u968f\u673a\u6570\u8868\u3002\u770b\u4e86\u4e0bImport\u8868\uff0c\u5176\u8c03\u7528\u7684\u662f<code>VCRUNTIME140D<\/code>\uff0c\u4e8e\u662f\u6211\u4eec\u7528VS 2017\u751f\u6210\u5bf9\u5e94\u7684\u968f\u673a\u6570\u8868\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#include &lt;stdio.h>\n#include &lt;stdlib.h>\n\nint main() {\n\tsrand(0xCu);\n\tfor (int i = 1; i &lt;= 20; ++i) {\n\t\tprintf(\"[\");\n\t\tfor (int j = 1; j &lt;= i; ++j) {\n\t\t\tprintf(\"%d, \", rand() % 100000);\n\t\t}\n\t\tprintf(\"\\b\\b],\\n\");\n\t}\n\treturn 0;\n}<\/code><\/pre>\n\n\n\n<p>\u83b7\u5f97\u968f\u673a\u6570\u8868\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>[77],\n[5628, 6232],\n[29052, 1558, 26150],\n[12947, 29926, 11981, 22371],\n[4078, 28629, 4665, 2229, 24699],\n[27370, 3081, 18012, 24965, 2064, 26890],\n[21054, 5225, 11777, 29853, 2956, 22439, 3341],\n[31337, 14755, 5689, 24855, 4173, 32304, 292, 5344],\n[15512, 12952, 1868, 10888, 19581, 13463, 32652, 3409, 28353],\n[26151, 14598, 12455, 26295, 25763, 26040, 8285, 27502, 15148, 4945],\n[26170, 1833, 5196, 9794, 26804, 2831, 11993, 2839, 9979, 27428, 6684],\n[4616, 30265, 5752, 32051, 10443, 9240, 8095, 28084, 26285, 8838, 18784, 6547],\n[7905, 8373, 19377, 18502, 27928, 13669, 25828, 30502, 28754, 32357, 2843, 5401, 10227],\n[22871, 20993, 8558, 10009, 6581, 22716, 12808, 4653, 24593, 21533, 9407, 6840, 30369, 2330],\n[3, 28024, 22266, 19327, 18114, 18100, 15644, 21728, 17292, 8396, 27567, 2002, 3830, 12564, 1420],\n[29531, 21820, 9954, 8319, 10918, 7978, 24806, 30027, 17659, 8764, 3258, 20719, 6639, 23556, 25786, 11048],\n[3544, 31948, 22, 1591, 644, 25981, 26918, 31716, 16427, 15551, 28157, 7107, 27297, 24418, 24384, 32438, 22224],\n[12285, 12601, 13235, 21606, 2516, 13095, 27080, 16331, 23295, 20696, 31580, 28758, 10697, 4730, 16055, 22208, 2391, 20143],\n[16325, 24537, 16778, 17119, 18198, 28537, 11813, 1490, 21034, 1978, 6451, 2174, 24812, 28772, 5283, 6429, 15484, 29353, 5942],\n[7299, 6961, 32019, 24731, 29103, 17887, 17338, 26840, 13216, 8789, 12474, 24299, 19818, 18218, 14564, 31409, 5256, 31930, 26804, 9736],<\/code><\/pre>\n\n\n\n<p>\u7136\u540e\u518d\u6c42\u6700\u5927\u8def\u5f84\uff0c<a href=\"https:\/\/www.cnblogs.com\/zhengjim\/p\/10002657.html#mountain-climbing\">\u53ef\u4ee5\u6233\u8fd9\u91cc<\/a>\u8fd9\u91cc\u81ea\u884c\u53c2\u8003\uff0c<del>\u6211\u5c31\u4e0d\u8d34\u4e86<\/del><\/p>\n\n\n\n<p>\u6700\u540e\u5f97\u5230\u6700\u4f73\u8def\u5f84 <code>RRRRRLLRRRLRLRRRLRL<\/code>\uff0c\u518d\u6839\u636e\u4e0a\u6587\u63d0\u793a\u5c06\u8be5\u8def\u5f84\u5076\u6570\u4f4d\u8ddf4\u5f02\u6216\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>inp = bytearray(b\"RRRRRLLRRRLRLRRRLRL\")\n\nfor i in range(1, len(inp), 2):\n    inp[i] ^= 4\n\nprint(inp)<\/code><\/pre>\n\n\n\n<p>\u83b7\u5f97flag\uff1a<code>RVRVRHLVRVLVLVRVLVL<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u521a\u624d\u770b\u5230\u7684\u8fd9\u9053\u633a\u6709\u610f\u601d\u7684\u9898 \u5230\u624b\u76f4\u63a5\u4e22\u8fdbIDA\uff0cemmm\u5148\u8131\u4e2aUPX\u3002 \u8131\u58f3\u4ee5\u540e\u518d\u6b21\u4e22\u8fdbIDA\uff0c\u53ef\u89c1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[10],"class_list":["post-147","post","type-post","status-publish","format-standard","hentry","category-11","tag-10"],"_links":{"self":[{"href":"https:\/\/0x.mk\/index.php?rest_route=\/wp\/v2\/posts\/147","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/0x.mk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/0x.mk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/0x.mk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/0x.mk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=147"}],"version-history":[{"count":1,"href":"https:\/\/0x.mk\/index.php?rest_route=\/wp\/v2\/posts\/147\/revisions"}],"predecessor-version":[{"id":158,"href":"https:\/\/0x.mk\/index.php?rest_route=\/wp\/v2\/posts\/147\/revisions\/158"}],"wp:attachment":[{"href":"https:\/\/0x.mk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=147"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/0x.mk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=147"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/0x.mk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=147"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}