简体   繁体   English

用户更改密码时调用哪个 Windows API? 钩这个 API 的好方法是什么?

[英]Which windows API call when the user change password? what the good way to hook this API?

I want to know when user try to change his password, and even hook this function.我想知道用户何时尝试更改他的密码,甚至挂钩此功能。

I know there is GINA option, and that was replaced from Vista to ICredentialProvider .我知道有GINA选项,它已从 Vista 替换为ICredentialProvider But at these two, I didn't find a specific API that will called anyway, or one function for every method, that will called when the user change his password.但是在这两个中,我没有找到一个无论如何都会调用的特定 API,或者每个方法都有一个函数,当用户更改密码时会调用该函数。 I think implement DLL proxy for the specific API (after I will find it), there is any better way to implement this hook, to catch the change password user and modify it?我想为特定的API实现DLL代理(我会找到它之后),有没有更好的方法来实现这个钩子,捕获更改密码用户并修改它?

In Addition, at my research I found the function ChangeAccountPassword .此外,在我的研究中,我发现了函数ChangeAccountPassword

And also reference to SpInitialize function with maybe relevant parameter:还可以参考带有相关参数的SpInitialize函数:

typedef struct SECPKG_FUNCTION_TABLE {
...
SpSetExtendedInformationFn       *SpChangeAccountPasswordFn;
...
};

Any advice?有什么建议吗?

Thanks谢谢

yes, SpChangeAccountPasswordFn really called in LSASS.EXE .是的, SpChangeAccountPasswordFn 确实在 LSASS.EXE 中调用。 this routine usually call这个程序通常调用

NTSTATUS
NTAPI
SamChangePasswordUser2(IN PUNICODE_STRING ServerName,
                       IN PUNICODE_STRING UserName,
                       IN PUNICODE_STRING OldPassword,
                       IN PUNICODE_STRING NewPassword);

from samlib.dll (this is exported function).来自 samlib.dll(这是导出函数)。 but most common and interesting point to hook :但最常见和有趣的一点是 hook :

BOOLEAN NTAPI LsaINotifyPasswordChanged(
  IN PVOID OPTIONAL, 
  IN PUNICODE_STRING ServerName,
  IN PUNICODE_STRING UserName,
  PVOID OPTIONAL,
  PVOID OPTIONAL,
  IN PUNICODE_STRING OldPassword,
  IN PUNICODE_STRING NewPassword);

this function is exported from lsasrv.dll and usually called from SpChangeAccountPasswordFn.此函数从 lsasrv.dll 导出,通常从 SpChangeAccountPasswordFn 调用。 it present from xp up to latest win10.它从 xp 到最新的 win10。 but signature in xp another than in later versions (1 param shifted to 7 place)但是 xp 中的签名不同于更高版本中的签名(1 个参数移至第 7 个位置)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM