{"id":937,"date":"2023-10-07T00:23:25","date_gmt":"2023-10-06T15:23:25","guid":{"rendered":"https:\/\/h4ck.kr\/?p=937"},"modified":"2024-05-22T16:45:40","modified_gmt":"2024-05-22T07:45:40","slug":"%ec%9c%88%eb%8f%84%ec%9a%b0%ec%97%90%ec%84%9c-cff-explorer-%ec%9d%b4%ec%9a%a9%ed%95%98%ec%97%ac-exe-%ec%8b%a4%ed%96%89%ed%8c%8c%ec%9d%bc%ec%97%90-dll-%ec%b6%94%ea%b0%80","status":"publish","type":"post","link":"https:\/\/h4ck.kr\/?p=937","title":{"rendered":"\uc708\ub3c4\uc6b0\uc5d0\uc11c CFF Explorer \uc774\uc6a9\ud558\uc5ec .exe \uc2e4\ud589\ud30c\uc77c\uc5d0 DLL \ucd94\uac00"},"content":{"rendered":"\n<p>\ub9ac\ub205\uc2a4\uc5d0\uc11c\ub294 patchelf, \ub9e5\uc5d0\uc11c\ub294 optool\uc744 \uc774\uc6a9\ud574\uc11c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \ucd94\uac00\ub85c \ub85c\ub4dc\uc2dc\ud0a4\ub3c4\ub85d,<br>\ubc14\uc774\ub108\ub9ac \uc2e4\ud589 \ud30c\uc77c\uc744 \ud328\uce58\uc2dc\ud0ac \uc218 \uc788\uc5c8\ub2e4.<\/p>\n\n\n\n<p>\uadf8\ub7fc \uc708\ub3c4\uc6b0\ub294 \uc5c6\uc744\uae4c?<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\uad6c\uae00\uc5d0\uc11c \ucc3e\uc544\ubcf4\ub2c8 CFF Explorer \ud234\ub85c DLL\uc744 \ucd94\uac00\uc2dc\ud0a4\ub294 \ubc29\ubc95\uc774 \uc788\uc5c8\ub2e4.<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/ko4life-net\/KOHook\">https:\/\/github.com\/ko4life-net\/KOHook<\/a><\/p>\n\n\n\n<p>Use&nbsp;<a href=\"https:\/\/ntcore.com\/?page_id=388\">CFF Explorer<\/a>&nbsp;for each executable (<code>AIServer.exe<\/code>,&nbsp;<code>Ebenezer.exe<\/code>&nbsp;and&nbsp;<code>KnightOnLine.exe<\/code>) to add the exported functions of the custom DLLs into the executables&#8217;&nbsp;<code>Import Table<\/code>&nbsp;by following these steps:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Open CFF Explorer.<\/li>\n\n\n\n<li>Drag the target executable into the GUI.<\/li>\n\n\n\n<li>Click on&nbsp;<code>Import Addr<\/code>&nbsp;on the left pane and then click&nbsp;<code>Add<\/code>&nbsp;for adding a new module\/dll.<\/li>\n\n\n\n<li>Select the corresponding DLL for the loaded executable. e.g.&nbsp;<code>AIServer.exe<\/code>&nbsp;needs&nbsp;<code>AIServer.dll<\/code>.<\/li>\n\n\n\n<li>In the&nbsp;<code>Exported Functions<\/code>&nbsp;pane select all of them and&nbsp;<code>Import by Oridinal<\/code>.<\/li>\n\n\n\n<li>Final step is to click&nbsp;<code>Rebuild Import Table<\/code>&nbsp;and then&nbsp;<code>Save<\/code>.<\/li>\n<\/ol>\n\n\n\n<p>If everything is done correctly, the modified executable should automatically load the custom DLL.<\/p>\n\n\n\n<p>\uc704 \ubc29\ubc95 \uadf8\ub300\ub85c \uc9c4\ud589\ud558\uba74 \ub41c\ub2e4. <br>\ub2e4\ub9cc, \ucd5c\uc18c \ud558\ub098 \uc774\uc0c1\uc740 dll\uc5d0\uc11c export\ub41c \ud568\uc218\uac00 \uc788\uc5b4\uc57c \ub418\ub294 \uac83 \uac19\ub354\ub77c&#8230;<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\uc2e4\uc81c\ub85c \uc798 \uc791\ub3d9\ud558\ub294\uc9c0,<br>puts \ud568\uc218\ub97c \ud6c4\ud0b9\ud558\ub294 dll \ub77c\uc774\ube0c\ub7ec\ub9ac \ud30c\uc77c\uc774 \ub85c\ub4dc\ub418\ub3c4\ub85d \ud328\uce58\uc2dc\ucf1c\ubcf4\uc558\ub2e4.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"865\" height=\"752\" src=\"https:\/\/h4ck.kr\/wp-content\/uploads\/2023\/10\/image-3.png\" alt=\"\" class=\"wp-image-938\" srcset=\"https:\/\/h4ck.kr\/wp-content\/uploads\/2023\/10\/image-3.png 865w, https:\/\/h4ck.kr\/wp-content\/uploads\/2023\/10\/image-3-300x261.png 300w, https:\/\/h4ck.kr\/wp-content\/uploads\/2023\/10\/image-3-768x668.png 768w\" sizes=\"auto, (max-width: 865px) 100vw, 865px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">\uc798\ub41c\ub2e4!<\/h2>\n\n\n\n<h4 class=\"wp-block-heading\">MyProcess.exe<\/h4>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#include &lt;stdio.h>\n#include &lt;stdlib.h>\n#include &lt;stdarg.h>\n\nint main() {\n\tprintf(\"Hello, This is MyProcess!\\n\");\n\tputs(\"Is hook working?\");\n\treturn 0;\n}<\/pre>\n<\/div>\n<\/div>\n\n\n\n<h4 class=\"wp-block-heading\">MyProcessHooker.exe<\/h4>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-9d6595d7 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"c\" data-enlighter-theme=\"dracula\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">#include \"framework.h\"\n#include \"MinHook.h\"\n\n#include &lt;stdio.h>\n#include &lt;stdarg.h>\n#include &lt;stdlib.h>\n\nstatic int (*orig_puts)(const char* str);\n\nint hook_puts(const char* str) {\n\tprintf(\"[+] hook_puts str: %s\\n\", str);\n\treturn orig_puts(str);\n}\n\n__declspec(dllexport) BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)\n{\n\n\tswitch (ul_reason_for_call)\n\t{\n\t\tcase DLL_PROCESS_ATTACH:\n\t\t{\n\t\t\tprintf(\"[i] Loaded MyProcessHooker!!!\\n\");\n\n\t\t\tif (MH_Initialize() != MH_OK) return false; \n\n\t\t\tHMODULE ucrtModule = GetModuleHandleA(\"ucrtbased.dll\");\n\n\t\t\tLPVOID puts_func = GetProcAddress(ucrtModule, \"puts\");\n\n\t\t\tif (MH_CreateHook(puts_func, &amp;hook_puts, reinterpret_cast&lt;void**>((LPVOID)&amp;orig_puts)) != MH_OK) return false;\n\n\t\t\tif (MH_EnableHook(puts_func) != MH_OK) return false;\n\t\t}\n\t\tbreak;\n\tcase DLL_THREAD_ATTACH:\n\tcase DLL_THREAD_DETACH:\n\t\tbreak;\n\tcase DLL_PROCESS_DETACH:\n\t\tbreak;\n\t}\n\treturn TRUE;\n}<\/pre>\n<\/div>\n<\/div>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\ub9ac\ub205\uc2a4\uc5d0\uc11c\ub294 patchelf, \ub9e5\uc5d0\uc11c\ub294 optool\uc744 \uc774\uc6a9\ud574\uc11c \ub77c\uc774\ube0c\ub7ec\ub9ac\ub97c \ucd94\uac00\ub85c \ub85c\ub4dc\uc2dc\ud0a4\ub3c4\ub85d,\ubc14\uc774\ub108\ub9ac \uc2e4\ud589 \ud30c\uc77c\uc744 \ud328\uce58\uc2dc\ud0ac \uc218 \uc788\uc5c8\ub2e4. \uadf8\ub7fc \uc708\ub3c4\uc6b0\ub294 \uc5c6\uc744\uae4c? \uad6c\uae00\uc5d0\uc11c \ucc3e\uc544\ubcf4\ub2c8 CFF Explorer \ud234\ub85c DLL\uc744 \ucd94\uac00\uc2dc\ud0a4\ub294 \ubc29\ubc95\uc774 \uc788\uc5c8\ub2e4. https:\/\/github.com\/ko4life-net\/KOHook Use&nbsp;CFF Explorer&nbsp;for each executable (AIServer.exe,&nbsp;Ebenezer.exe&nbsp;and&nbsp;KnightOnLine.exe) to add the exported functions of the custom DLLs into the executables&#8217;&nbsp;Import Table&nbsp;by following these steps: If everything is done correctly, the modified executable&hellip;&nbsp;<a href=\"https:\/\/h4ck.kr\/?p=937\" rel=\"bookmark\">\ub354 \ubcf4\uae30 &raquo;<span class=\"screen-reader-text\">\uc708\ub3c4\uc6b0\uc5d0\uc11c CFF Explorer \uc774\uc6a9\ud558\uc5ec .exe \uc2e4\ud589\ud30c\uc77c\uc5d0 DLL \ucd94\uac00<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[1],"tags":[40],"class_list":["post-937","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-windows"],"_links":{"self":[{"href":"https:\/\/h4ck.kr\/index.php?rest_route=\/wp\/v2\/posts\/937","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/h4ck.kr\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/h4ck.kr\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/h4ck.kr\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/h4ck.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=937"}],"version-history":[{"count":2,"href":"https:\/\/h4ck.kr\/index.php?rest_route=\/wp\/v2\/posts\/937\/revisions"}],"predecessor-version":[{"id":940,"href":"https:\/\/h4ck.kr\/index.php?rest_route=\/wp\/v2\/posts\/937\/revisions\/940"}],"wp:attachment":[{"href":"https:\/\/h4ck.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=937"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/h4ck.kr\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=937"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/h4ck.kr\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=937"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}