Is it possible to impersonate a user without logging him on?

北慕城南 提交于 2020-01-12 15:19:19

问题


Is it possible to impersonate a user without supplying user name/password? Basically, I'd like to get the CSIDL_LOCAL_APPDATA for a user (not the current one) using the ShGetFolderPath() function. All I currently have is a SID for that user.


回答1:


No, you have to call Win32 API LogonUser function to get windows account token back so you can then impersonate.




回答2:


You can impersonate a user without supplying password by calling ZwCreateToken. See the CreatePureUserToken function in this article: GUI-Based RunAsEx You must be running as an admin (or LocalSystem) for this to work.

Another technique is to use Windows Subauthentication Packages. This allows you to override windows built-in authentication and allow a LogonUser to succeed even if no password was supplied. See this KB article.



来源:https://stackoverflow.com/questions/137254/is-it-possible-to-impersonate-a-user-without-logging-him-on

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!