{"id":409,"date":"2023-03-06T21:51:18","date_gmt":"2023-03-06T13:51:18","guid":{"rendered":"https:\/\/shangwendada.co\/?p=409"},"modified":"2023-05-19T22:53:30","modified_gmt":"2023-05-19T14:53:30","slug":"%e8%99%9a%e6%8b%9f%e6%9c%ba%e9%80%86%e5%90%91unctf-2019-easyvm","status":"publish","type":"post","link":"https:\/\/blog.shangwendada.top\/index.php\/2023\/03\/06\/%e8%99%9a%e6%8b%9f%e6%9c%ba%e9%80%86%e5%90%91unctf-2019-easyvm\/","title":{"rendered":"[\u865a\u62df\u673a\u9006\u5411]UNCTF &#8211; 2019 EasyVm"},"content":{"rendered":"<h1>[\u865a\u62df\u673a\u9006\u5411]UNCTF &#8211; 2019 EasyVm<\/h1>\n<h2>\u524d\u8a00<\/h2>\n<p>\u865a\u62df\u673a\u9006\u5411\u5728Hgame2023\u4e2d\u9047\u89c1\u8fc7\uff0c\u8fd9\u6b21\u5237\u9898\u4e2d\u53c8\u9047\u89c1\u4e86\uff0c\u5199\u4e00\u7bc7\u6587\u7ae0\u603b\u7ed3\u4e00\u4e0b<\/p>\n<h2>\u4ec0\u4e48\u662f\u865a\u62df\u673a\u9006\u5411<\/h2>\n<p>\u865a\u62df\u673a\u9006\u5411\u662f\u6307\u5bf9\u4e00\u4e2a\u8fd0\u884c\u5728\u865a\u62df\u673a\u4e0a\u7684\u7a0b\u5e8f\u8fdb\u884c\u9006\u5411\u5de5\u7a0b\u3002\u865a\u62df\u673a\u662f\u4e00\u79cd\u8f6f\u4ef6\u5c42\uff0c\u5b83\u6a21\u62df\u4e86\u4e00\u79cd\u8ba1\u7b97\u673a\u67b6\u6784\uff0c\u5141\u8bb8\u7a0b\u5e8f\u5728\u4e0d\u540c\u7684\u5e73\u53f0\u4e0a\u8fd0\u884c\u3002\u5728\u865a\u62df\u673a\u4e0a\u8fd0\u884c\u7684\u7a0b\u5e8f\u901a\u5e38\u4f7f\u7528\u4e00\u79cd\u7279\u5b9a\u7684\u6307\u4ee4\u96c6\uff0c\u8fd9\u4e2a\u6307\u4ee4\u96c6\u4e0d\u540c\u4e8e\u5728\u7269\u7406\u673a\u5668\u4e0a\u8fd0\u884c\u7684\u6307\u4ee4\u96c6\u3002<\/p>\n<p>\u865a\u62df\u673a\u9006\u5411\u5305\u62ec\u5bf9\u865a\u62df\u673a\u672c\u8eab\u7684\u5206\u6790\uff0c\u4ee5\u53ca\u5bf9\u5728\u865a\u62df\u673a\u4e0a\u8fd0\u884c\u7684\u7a0b\u5e8f\u7684\u5206\u6790\u3002\u5bf9\u4e8e\u865a\u62df\u673a\u672c\u8eab\u7684\u5206\u6790\uff0c\u53ef\u4ee5\u63a2\u7a76\u865a\u62df\u673a\u7684\u6307\u4ee4\u96c6\u3001\u5185\u5b58\u5e03\u5c40\u3001\u4ee3\u7801\u6267\u884c\u6d41\u7a0b\u7b49\u65b9\u9762\u3002\u5bf9\u4e8e\u5728\u865a\u62df\u673a\u4e0a\u8fd0\u884c\u7684\u7a0b\u5e8f\u7684\u5206\u6790\uff0c\u53ef\u4ee5\u901a\u8fc7\u53cd\u7f16\u8bd1\u3001\u52a8\u6001\u8c03\u8bd5\u7b49\u624b\u6bb5\u83b7\u53d6\u7a0b\u5e8f\u7684\u6e90\u4ee3\u7801\u3001\u8c03\u7528\u6808\u4fe1\u606f\u3001\u5185\u5b58\u6620\u5c04\u7b49\u4fe1\u606f\uff0c\u4ee5\u6b64\u6765\u7406\u89e3\u7a0b\u5e8f\u7684\u884c\u4e3a\u548c\u5de5\u4f5c\u539f\u7406\u3002<\/p>\n<p>\u865a\u62df\u673a\u9006\u5411\u5e38\u7528\u4e8e\u8f6f\u4ef6\u9006\u5411\u5de5\u7a0b\u3001\u6f0f\u6d1e\u6316\u6398\u548c\u5b89\u5168\u8bc4\u4f30\u7b49\u9886\u57df\u3002<\/p>\n<h2>\u524d\u671f\u51c6\u5907<\/h2>\n<p>\u8981\u8fdb\u884c\u865a\u62df\u673a\u9006\u5411\uff0c\u9700\u8981\u5177\u5907\u4ee5\u4e0b\u51e0\u70b9\u51c6\u5907\uff1a<\/p>\n<ol>\n<li>\u8ba1\u7b97\u673a\u57fa\u7840\u77e5\u8bc6\uff1a\u9006\u5411\u662f\u8ba1\u7b97\u673a\u9886\u57df\u7684\u9ad8\u7ea7\u6280\u672f\uff0c\u9700\u8981\u5bf9\u8ba1\u7b97\u673a\u7684\u7ed3\u6784\u548c\u539f\u7406\u6709\u4e00\u5b9a\u7684\u4e86\u89e3\u3002<\/li>\n<li>\u64cd\u4f5c\u7cfb\u7edf\u548c\u7f16\u7a0b\u8bed\u8a00\u7684\u57fa\u7840\uff1a\u8981\u9006\u5411\u865a\u62df\u673a\uff0c\u638c\u63e1\u4e00\u79cd\u6216\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u975e\u5e38\u6709\u5e2e\u52a9\u3002\u540c\u65f6\u719f\u6089\u64cd\u4f5c\u7cfb\u7edf\u7684\u57fa\u7840\u77e5\u8bc6\u4e5f\u662f\u5fc5\u8981\u7684\uff0c\u4ee5\u4fbf\u80fd\u591f\u5728\u4e0d\u540c\u7684\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u8fdb\u884c\u865a\u62df\u673a\u9006\u5411\u3002<\/li>\n<li>\u8c03\u8bd5\u5de5\u5177\u7684\u4f7f\u7528\uff1a\u5728\u865a\u62df\u673a\u9006\u5411\u8fc7\u7a0b\u4e2d\uff0c\u9700\u8981\u4f7f\u7528\u5404\u79cd\u8c03\u8bd5\u5668\u548c\u5206\u6790\u5de5\u5177\uff0c\u4f8b\u5982IDA\u3001OllyDbg\u7b49\uff0c\u8fd9\u9700\u8981\u5bf9\u8fd9\u4e9b\u5de5\u5177\u7684\u4f7f\u7528\u65b9\u6cd5\u6709\u4e00\u5b9a\u7684\u638c\u63e1\u3002<\/li>\n<li>\u719f\u6089\u6c47\u7f16\u8bed\u8a00\uff1a\u865a\u62df\u673a\u7684\u5b9e\u73b0\u5e38\u5e38\u4f1a\u6d89\u53ca\u5230\u6c47\u7f16\u8bed\u8a00\uff0c\u56e0\u6b64\u719f\u6089\u6c47\u7f16\u8bed\u8a00\u662f\u8fdb\u884c\u865a\u62df\u673a\u9006\u5411\u7684\u5fc5\u8981\u6761\u4ef6\u3002<\/li>\n<li>\u62e5\u6709\u8c03\u8bd5\u865a\u62df\u673a\u7684\u5b9e\u8df5\u7ecf\u9a8c\uff1a\u865a\u62df\u673a\u9006\u5411\u9700\u8981\u5177\u6709\u4e00\u5b9a\u7684\u5b9e\u8df5\u7ecf\u9a8c\uff0c\u4e86\u89e3\u865a\u62df\u673a\u7684\u5b9e\u73b0\u539f\u7406\u548c\u9006\u5411\u6280\u5de7\uff0c\u9700\u8981\u8fdb\u884c\u5927\u91cf\u7684\u5b9e\u8df5\u64cd\u4f5c\u624d\u80fd\u719f\u7ec3\u638c\u63e1\u3002<\/li>\n<\/ol>\n<h2>\u9898\u89e3<\/h2>\n<h3>\u4e3b\u51fd\u6570<\/h3>\n<pre><code class=\"language-c\">__int64 __fastcall main(int a1, char **a2, char **a3)\n{\n  unsigned int (__fastcall ***v3)(_QWORD, void *, void *, char *); \/\/ rbx\n  char s[96]; \/\/ [rsp+10h] [rbp-80h] BYREF\n  int v6; \/\/ [rsp+70h] [rbp-20h]\n  unsigned __int64 v7; \/\/ [rsp+78h] [rbp-18h]\n\n  v7 = __readfsqword(0x28u);\n  memset(s, 0, sizeof(s));\n  v6 = 0;\n  v3 = (unsigned int (__fastcall ***)(_QWORD, void *, void *, char *))operator new(0x28uLL);\n  sub_400C1E(v3, a2);\n  puts(&quot;please input your flag:&quot;);\n  scanf(&quot;%s&quot;, s);\n  if ( strlen(s) != 32 )\n  {\n    puts(&quot;The length of flag is wrong!&quot;);\n    puts(&quot;Please try it again!&quot;);\n  }\n  if ( (**v3)(v3, &amp;unk_602080, &amp;unk_6020A0, s) )\n  {\n    puts(&quot;Congratulations!&quot;);\n    printf(&quot;The flag is UNCTF{%s}&quot;, s);\n  }\n  return 1LL;\n}<\/code><\/pre>\n<p>\u53ef\u4ee5\u53d1\u73b0\u4e3b\u51fd\u6570\u975e\u5e38\u7684\u7b80\u6d01\u5c31\u662f\u505a\u4e86\u957f\u5ea6\u7684\u5224\u65ad\uff0c\u7136\u540e\u8fd8\u6709\u4e00\u4e2av3\u4f5c\u4e3a\u4e00\u4e2a\u51fd\u6570\u6307\u9488\u7136\u540e\u5c06\u8f93\u5165\u7684\u51fd\u6570\u4f5c\u4e3a\u4f20\u5165\u53c2\u6570\u8fdb\u884c\u4e86\u4e00\u4e9b\u5224\u65ad<\/p>\n<p>\u5206\u6790\u5b8c\u6bd5\uff0c\u6211\u4eec\u4e3b\u8981\u76ee\u6807\u5c31\u662f\u8ddf\u8fdb\u8fd9\u4e2a\u51fd\u6570\u6307\u9488\uff0c\u67e5\u770b\u5bf9\u4f20\u5165\u7684\u5b57\u7b26\u4e32\u505a\u4e86\u4e00\u4e9b\u4ec0\u4e48\u64cd\u4f5c\u3002<\/p>\n<p>\u9996\u5148\u6211\u4eec\u770b\u5230sub_400C1E\u8fd9\u4e2a\u51fd\u6570\u662f\u5bf9v3\u8fdb\u884c\u4e86\u64cd\u4f5c\u7684\u7136\u540e\u4f20\u5165\u53c2\u6570\u4e3aa2,\u6211\u4eec\u5148\u5206\u6790\u8be5\u51fd\u6570\u5bf9v3\u6307\u9488\u505a\u4e86\u4e00\u4e9b\u4ec0\u4e48\u64cd\u4f5c<\/p>\n<h3>sub_400C1E<\/h3>\n<pre><code class=\"language-c\">__int64 __fastcall sub_400C1E(__int64 a1)\n{\n  __int64 result; \/\/ rax\n\n  *(_QWORD *)a1 = off_4010A8;\n  *(_QWORD *)(a1 + 8) = 0LL;\n  *(_BYTE *)(a1 + 16) = 0;\n  *(_BYTE *)(a1 + 17) = 0;\n  *(_BYTE *)(a1 + 18) = 0;\n  *(_DWORD *)(a1 + 20) = 0;\n  *(_QWORD *)(a1 + 24) = 0LL;\n  result = a1;\n  *(_QWORD *)(a1 + 32) = 0LL;\n  return result;\n}<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\u8fd9\u4e2a\u5c31\u662f\u4ee5a1\u4e3a\u57fa\u5730\u5740\uff0c\u7136\u540e\u5bf9\u4e00\u4e9b\u504f\u79fb\u91cf\u8fdb\u884c\u4e86\u8d4b\u503c\u64cd\u4f5c\uff0c\u6211\u4eec\u70b9\u5f00\u8fd9\u4e2aoff_4010A8\u770b\u770b\u91cc\u9762\u662f\u4e00\u4e9b\u4ec0\u4e48\u4e1c\u897f<\/p>\n<pre><code class=\"language-assembly\">.rodata:00000000004010A8 06 08 40 00 00 00 00 00       off_4010A8 dq offset sub_400806         ; DATA XREF: sub_400C1E+8\u2191o\n.rodata:00000000004010B0 7C 0C 40 00 00 00 00 00       dq offset sub_400C7C\n.rodata:00000000004010B8 9A 0C 40 00 00 00 00 00       dq offset sub_400C9A\n.rodata:00000000004010C0 B8 0C 40 00 00 00 00 00       dq offset sub_400CB8\n.rodata:00000000004010C8 D6 0C 40 00 00 00 00 00       dq offset sub_400CD6\n.rodata:00000000004010D0 FA 0C 40 00 00 00 00 00       dq offset sub_400CFA\n.rodata:00000000004010D8 1E 0D 40 00 00 00 00 00       dq offset sub_400D1E\n.rodata:00000000004010E0 42 0D 40 00 00 00 00 00       dq offset sub_400D42\n.rodata:00000000004010E8 56 0D 40 00 00 00 00 00       dq offset sub_400D56\n.rodata:00000000004010F0 70 0D 40 00 00 00 00 00       dq offset sub_400D70\n.rodata:00000000004010F8 84 0D 40 00 00 00 00 00       dq offset sub_400D84\n.rodata:0000000000401100 B0 0D 40 00 00 00 00 00       dq offset sub_400DB0\n.rodata:0000000000401108 DC 0D 40 00 00 00 00 00       dq offset sub_400DDC\n.rodata:0000000000401110 56 0E 40 00 00 00 00 00       dq offset sub_400E56\n.rodata:0000000000401118 D0 0E 40 00 00 00 00 00       dq offset sub_400ED0<\/code><\/pre>\n<p>\u662f\u4e00\u5806\u51fd\u6570\u7684\u5730\u5740\u8868\uff0c\u90a3\u4e48\u663e\u7136\uff0c\u8be5\u865a\u62df\u673a\u5c31\u662f\u901a\u8fc7a1\u8fdb\u884c\u53d6\u5740\u7136\u540e\u8c03\u7528\u51fd\u6570\uff0c\u5bf9\u6808\u7a7a\u95f4\uff0c\u5bc4\u5b58\u5668\u4e4b\u7c7b\u7684\u4e1c\u897f\u8fdb\u884c\u64cd\u63a7\uff0c\u6211\u4eec\u9996\u5148\u770b\u5230\u7b2c\u4e00\u4e2a\u51fd\u6570<\/p>\n<h3>sub_400806<\/h3>\n<pre><code class=\"language-c\">__int64 __fastcall sub_400806(__int64 a1, __int64 a2, __int64 a3, __int64 a4)\n{\n  *(a1 + 8) = a2 + 9;\n  *(a1 + 24) = a3;\n  *(a1 + 32) = a4;\n  while ( 2 )\n  {\n    switch ( **(a1 + 8) )\n    {\n      case 0xA0:\n        (*(*a1 + 8LL))(a1);\n        continue;\n      case 0xA1:\n        (*(*a1 + 16LL))(a1);\n        continue;\n      case 0xA2:\n        (*(*a1 + 24LL))(a1);\n        *(a1 + 8) += 11LL;\n        continue;\n      case 0xA3:\n        (*(*a1 + 32LL))(a1);\n        *(a1 + 8) += 2LL;\n        continue;\n      case 0xA4:\n        (*(*a1 + 40LL))(a1);\n        *(a1 + 8) += 7LL;\n        continue;\n      case 0xA5:\n        (*(*a1 + 48LL))(a1);\n        ++*(a1 + 8);\n        continue;\n      case 0xA6:\n        (*(*a1 + 56LL))(a1);\n        *(a1 + 8) -= 2LL;\n        continue;\n      case 0xA7:\n        (*(*a1 + 64LL))(a1);\n        *(a1 + 8) += 7LL;\n        continue;\n      case 0xA8:\n        (*(*a1 + 72LL))(a1);\n        continue;\n      case 0xA9:\n        (*(*a1 + 80LL))(a1);\n        *(a1 + 8) -= 6LL;\n        continue;\n      case 0xAA:\n        (*(*a1 + 88LL))(a1);\n        continue;\n      case 0xAB:\n        (*(*a1 + 96LL))(a1);\n        *(a1 + 8) -= 4LL;\n        continue;\n      case 0xAC:\n        (*(*a1 + 104LL))(a1);\n        continue;\n      case 0xAD:\n        (*(*a1 + 112LL))(a1);\n        *(a1 + 8) += 2LL;\n        continue;\n      case 0xAE:\n        if ( *(a1 + 20) )\n          return 0LL;\n        *(a1 + 8) -= 12LL;\n        continue;\n      case 0xAF:\n        if ( *(a1 + 20) != 1 )\n        {\n          *(a1 + 8) -= 6LL;\n          continue;\n        }\n        return 1LL;\n      default:\n        puts(&quot;cmd execute error&quot;);\n        return 0LL;\n    }\n  }\n}<\/code><\/pre>\n<p>\u5206\u6790\u4e4b\u540e\u53d1\u73b0\u662f\u4e00\u4e2a\u5178\u578b\u7684while+switch,\u5229\u7528\u4f20\u5165\u7684\u53c2\u6570\u8fdb\u884c\u5bfb\u5740\u3002\u6211\u4eec\u901a\u8fc7\u52a8\u6001\u8c03\u8bd5\u6765\u67e5\u770b\u6307\u4ee4\u8fd0\u884c\u7684\u5148\u540e\u987a\u5e8f\u3002\u7136\u540e\u628a\u8868\u6284\u4e0b\u6765,\u53d1\u73b0\u662f\u5982\u4e0b\u7ed3\u679c<\/p>\n<p><strong>0xA9u 0xA3u 0xA5u 0xA6u 0xA4u 0xABu 0xA7u 0xAEu 0xA2u 0xADu 0xAFu<\/strong><\/p>\n<p>\u7136\u540e\u6211\u4eec\u518d\u5206\u6790\u5982\u4f55\u5f97\u51fa\u6bcf\u4e00\u4e2a\u8bed\u53e5\u662f\u5e72\u5565\u7684<\/p>\n<p>\u8fd9\u91cc\u6211\u53ea\u4e3e\u4f8b\u4e00\u70b9\uff0c\u5176\u4ed6\u7684\u90fd\u662f\u7c7b\u4f3c\u64cd\u4f5c\u3002<\/p>\n<p>\u6211\u4eec\u9996\u5148\u8f93\u516532\u4e2a\u5b57\u7b26\u8eb2\u907f\u957f\u5ea6\u5224\u65ad,\u901a\u8fc7\u65ad\u70b9\u8df3\u8f6c\u6765\u5230\u8be5\u51fd\u6570<\/p>\n<p>\u6211\u4eec\u5206\u67900xA0\u6307\u4ee4\u7684\u64cd\u4f5c\u65b9\u5f0f<\/p>\n<p>\u9996\u5148\u6211\u4eec\u9700\u8981\u770b\u5230a1\u4e2d\u5b58\u50a8\u7684\u5230\u5e95\u662f\u4ec0\u4e48\u4e1c\u897f\u3002<\/p>\n<p>unsigned char ida_chars[] =<\/p>\n<p>{<\/p>\n<p>0xA8, 0x10, 0x40<\/p>\n<p>};<\/p>\n<p>\u901a\u8fc7\u7ecf\u9a8c\u5c31\u53ef\u4ee5\u53d1\u73b0\u8fd9\u662f\u5c0f\u7aef\u5e8f\u5b58\u50a8\u7684\u4e00\u6bb5\u5730\u5740\u4e3a0x4010A8,\u90a3\u4e48\u6211\u4eec\u5c31\u8981\u77e5\u9053\u8be5\u865a\u62df\u673a\u7684\u57fa\u5730\u5740\u4e3a0x4010A8\uff0c\u770b\u52300xA0<\/p>\n<p>\u504f\u79fb\u91cf\u4e3a8\u4e5f\u5c31\u662f0x4010b0\u6211\u4eec\u8df3\u8f6c\u5230\u8be5\u5730\u5740<\/p>\n<pre><code class=\"language-ass\">.rodata:00000000004010B0 dq offset sub_400C7C<\/code><\/pre>\n<p>\u6b64\u5904\u5c31\u662f\u8c03\u7528\u4e86sub_400C7C\u51fd\u6570\uff0c\u8fdb\u53bb\u770b\u770b<\/p>\n<pre><code class=\"language-c\">__int64 __fastcall sub_400C7C(__int64 a1)\n{\n  __int64 result; \/\/ rax\n\n  result = a1;\n  ++*(a1 + 16);\n  return result;\n}<\/code><\/pre>\n<p>\u5bf9a1\u5730\u5740\u504f\u79fb16\u8fdb\u884c\u4e86\u4e00\u4e2a++\u64cd\u4f5c<\/p>\n<pre><code class=\"language-ass\">[heap]:00000000013BFEC0 db    0<\/code><\/pre>\n<p>\u672c\u8eab\u8be5\u5904\u662f0\uff0c\u90a3\u4e48\u4e4b\u524d\u53ef\u4ee5\u770b\u5230sub_400C1E\u51fd\u6570\u5bf9\u4e00\u5806\u504f\u79fb\u91cf\u8fdb\u884c\u4e86\u7f6e0\u64cd\u4f5c\uff0c\u8fd9\u91cc\u731c\u6d4b\u4ed6\u4eec\u90fd\u662f\u5bc4\u5b58\u5668<\/p>\n<p>\u90a3\u4e48a1+16\u4e5f\u5c31\u662f\u5bc4\u5b58\u5668r1,a1+17\u5c31\u662f\u5bc4\u5b58\u5668r2<\/p>\n<p>\u90a3\u4e48\u7ed3\u5408\u4e0a\u9762\u5728\u603b\u7ed3\u4e00\u4e0b\u5c31\u53ef\u4ee5\u5f97\u5230\u5982\u4e0b\u6307\u4ee4\u8868<\/p>\n<table>\n<thead>\n<tr>\n<th style=\"text-align: center;\">\u64cd\u4f5c\u7801<\/th>\n<th style=\"text-align: center;\">\u5bf9\u5e94\u6307\u4ee4\u96c6\u5408<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"text-align: center;\">*(a1+16)<\/td>\n<td style=\"text-align: center;\">\u5bc4\u5b58\u5668r1(\u53601\u5b57\u8282)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">*(a1+17)<\/td>\n<td style=\"text-align: center;\">\u5bc4\u5b58\u5668r2(\u53601\u5b57\u8282)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">*(a1+18)<\/td>\n<td style=\"text-align: center;\">\u5bc4\u5b58\u5668r3(\u53601\u5b57\u8282)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">*(a1+19)<\/td>\n<td style=\"text-align: center;\">\u5bc4\u5b58\u5668r4(\u53601\u5b57\u8282)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">*(a1+20)<\/td>\n<td style=\"text-align: center;\">\u5bc4\u5b58\u5668r5(\u53604\u5b57\u8282)<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA0<\/td>\n<td style=\"text-align: center;\">r1++<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA1<\/td>\n<td style=\"text-align: center;\">r2++<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA2<\/td>\n<td style=\"text-align: center;\">r3++<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA3<\/td>\n<td style=\"text-align: center;\">r1 -= r3<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA4<\/td>\n<td style=\"text-align: center;\">r1 ^= r2<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA5<\/td>\n<td style=\"text-align: center;\">r2 ^= r1<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA6<\/td>\n<td style=\"text-align: center;\">r1 = 0xCD<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA7<\/td>\n<td style=\"text-align: center;\">r2 = r1<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA8<\/td>\n<td style=\"text-align: center;\">r3 = 0xCD<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xA9<\/td>\n<td style=\"text-align: center;\">r1 = input[r3]<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xAA<\/td>\n<td style=\"text-align: center;\">r2 = input[r3]<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xAB<\/td>\n<td style=\"text-align: center;\">func1()<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xAC<\/td>\n<td style=\"text-align: center;\">func2()<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xAD<\/td>\n<td style=\"text-align: center;\">func3()<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xAE<\/td>\n<td style=\"text-align: center;\">\u5224\u65adr5\u7684\u503c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align: center;\">0xAF<\/td>\n<td style=\"text-align: center;\">\u5224\u65adr5\u7684\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u7136\u540e\u6211\u4eec\u770b\u5230\u51fd\u6570\u4e2d\u7684a4\u5c31\u662f\u6211\u4eec\u8f93\u5165\u7684\u503c\uff0c\u7136\u540e\u518d\u770b\u5230\u51fd\u6570\u4e2d\u7684a3\u6709\u4e00\u4e32\u5b57\u7b26\u548c\u6211\u4eec\u8f93\u5165\u7684\u5b57\u7b26\u957f\u5ea6\u4e00\u6837\uff0c\u90a3\u4e48\u80af\u5b9a\u662f\u6211\u4eec\u7684check\u5b57\u7b26<\/p>\n<h3>exp<\/h3>\n<p>\u7136\u540e\u6211\u4eec\u5199\u4e00\u4e2a\u53cd\u7f16\u8bd1\u4ee3\u7801\uff0c\u5c31\u662f\u901a\u8fc7\u4e4b\u524d\u7684\u6307\u4ee4\u64cd\u4f5c\uff0c\u8fdb\u884c\u53cd\u7f16\u8bd1<\/p>\n<pre><code class=\"language-python\"> opcode = [0xa9, 0xa3, 0xa5, 0xa6, 0xa4, 0xab, 0xa7, 0xae, 0xa2, 0xad, 0xaf]\n\n for i in opcode:\n     if i == 0xa0:\n         print(&quot;r1++&quot;)\n     if i == 0xa1:\n         print(&quot;r2++&quot;)\n     if i == 0xa2:\n         print(&quot;r3++&quot;)\n     if i == 0xa3:\n         print(&quot;r1 -= r3&quot;)\n     if i == 0xa4:\n        print(&quot;r1 ^= r2&quot;)\n     if i == 0xa5:\n        print(&quot;r2 ^= r1&quot;)\n     if i == 0xa6:\n        print(&quot;r1 = 0xcd&quot;)\n     if i == 0xa7:\n        print(&quot;r2 = r1&quot;)\n     if i == 0xa8:\n        print(&quot;r3 = 0xcd&quot;)\n     if i == 0xa9:\n        print(&quot;r1 = input[r3]&quot;)\n     if i == 0xaa:\n        print(&quot;r2 = input[r3]&quot;)\n     if i == 0xab:\n        print(&quot;fun1()&quot;)\n     if i == 0xac:\n        print(&quot;func2()&quot;)\n     if i == 0xad:\n        print(&quot;func3()&quot;)\n     if i == 0xae:\n        print(&quot;if(r5==0)&quot;)\n     if i == 0xaf:\n        print(&quot;if(r5!=1)&quot;)<\/code><\/pre>\n<p>\u8f93\u51fa\u7ed3\u679c\u4e3a:<\/p>\n<pre><code class=\"language-python\">r1 = input[r3] \nr1 -= r3\nr2 ^= r1\nr1 = 0xcd\nr1 ^= r2\nfun1()\nr2 = r1\nif(r5!=0)\nr3++\nfunc3()\nif(r5!=1)<\/code><\/pre>\n<p>\u7136\u540e\u6211\u4eec\u6839\u636e\u8be5\u903b\u8f91\u5199\u4e00\u4e2a\u89e3\u5bc6exp<\/p>\n<pre><code class=\"language-python\">res = [0xF4, 0x0A, 0xF7, 0x64, 0x99, 0x78, 0x9E, 0x7D, 0xEA, 0x7B, 0x9E, 0x7B, 0x9F, 0x7E, 0xEB, 0x71, 0xE8, 0x00, 0xE8, 0x07, 0x98, 0x19, 0xF4, 0x25, 0xF3, 0x21, 0xA4, 0x2F, 0xF4, 0x2F, 0xA6, 0x7C]\nflag = &#039;&#039;\ntemp = 0\nfor i in range(0,32):\n    flag += chr((temp ^ res[i] ^ 0xcd) + i)\n    temp = res[i]\n\nprint(flag)<\/code><\/pre>\n<p>\u5f97\u5230flag:942a4115be2359ffd675fa6338ba23b6<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[\u865a\u62df\u673a\u9006\u5411]UNCTF &#8211; 2019 EasyVm \u524d\u8a00 \u865a\u62df\u673a\u9006\u5411\u5728Hgame2023\u4e2d\u9047\u89c1\u8fc7 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":157,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-409","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/posts\/409","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/comments?post=409"}],"version-history":[{"count":2,"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/posts\/409\/revisions"}],"predecessor-version":[{"id":424,"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/posts\/409\/revisions\/424"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/media\/157"}],"wp:attachment":[{"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/media?parent=409"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/categories?post=409"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.shangwendada.top\/index.php\/wp-json\/wp\/v2\/tags?post=409"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}