1 / 54

Pass-The-Hash: Gaining Root Access to Your Network

Pass-The-Hash: Gaining Root Access to Your Network. June 24, 2014. Tim Slaybaugh. Cyber Incident Analyst Northrop Grumman Information Systems. What is Pass-The-Hash?.

Télécharger la présentation

Pass-The-Hash: Gaining Root Access to Your Network

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Pass-The-Hash: Gaining Root Access to Your Network June 24, 2014 Tim Slaybaugh Cyber Incident Analyst Northrop Grumman Information Systems

  2. What is Pass-The-Hash? “Attackers using PtH completely compromise just about every network they hit. Pretty much every APT attack team uses them.” – Roger Grimes, InfoWorld

  3. What is Pass-The-Hash? • First published in 1997 by Paul Ashton • Allows the use of LM and NTLM hashes to authenticate to a remote host • Passwords do not need to be cracked • Hashes can be harvested from the physical disk or memory

  4. How does Pass-The-Hash work? • Requires admin privileges, therefore an exploit has to be run to gain access • Injects into the Local Security Authority Subsystem Service (LSASS) process to access hashes in memory • Grabs locally stored hashes from SAM registry hive. • Smartcard credentials and Kerberos tickets can be harvested also!

  5. Pass-The-Hash and Smartcards • Smart card credentials are cached in an identical manner as passwords. • Systems that allow both Smartcard or password logons store smartcard credentials for a very long time • Systems that require smartcard only logon will periodically change the hash.

  6. Pass-The-Hash Tools: PWDump • Latest version is PWDump 7.1 • Author: Andres TarascoAcuna • Dumps the local SAM hive • Uses syskey key from SYSTEM hive to dump LM and NTLM hashes • Statically links the OpenSSL library, libeay32.dll • PWDump 6 links lsremora.dll

  7. PWDump PWDump runs from the command line and dumps LM and NTLM hashes from the local SAM hive.

  8. PWDump PWDump with dependency, libeay32.dll in $LogFile

  9. PWDump PWDump in AV signature database

  10. PWDump Keywords used to identify PWDump activity: • Error reading hive root key • Andres Tarasco Acuna • savedump.dat • Error opening sam hive • raw password extractor

  11. Pass-The-Hash Tools: Mimikatz • Author: Benjamin Delpy • Support for both x86 and 64bit systems • Requires sekurLSA.dll to run • Extracts hashes and cleartext passwords

  12. Mimikatz Unlike most PTH tools, Mimikatz will run from the root of Windows.

  13. Mimikatz Mimikatz hooks the System Service Descriptor Table (SSDT) similar to rootkit activity.

  14. Mimikatz Looking at mimikatz.exe using Volatility plugin ‘handles’ Hooks lsass.exe Runs from across the network via PSEXECSVC

  15. Mimikatz ‘Handles’ will also identify this hook into the Local Security Authority Subsystem Service (lsass.exe).

  16. Mimikatz Mimikatz.exe and conhost.exe start up at the same time indicating that mimikatz is likely being controlled through an interactive console.

  17. Mimikatz Console activity can be recovered from memory.

  18. Mimikatz Mimikatz is logged in the Windows power configuration file, ‘energy-ntkl.etl’. From Memory

  19. Mimikatz Keywords used to identify Mimikatz activity: • Benjamin DELPY • gentilkiwi • sekurlsa • kiwissp.log • Pass-the-Ticket

  20. Pass-The-Hash Tools: gsecdump • Johannes Gumbel, Truesec • Freeware • Latest version is 2.0b5 • Extracts hashes from SAM, Active Directory and active logon sessions • Works with both x86 and 64bit systems

  21. Gsecdump Keywords used to identify gsecdump activity: • Johannes Gumbel • Truesec • dump_usedhashes • crap! • gsecdump

  22. Pass-The-Hash Tools: PSHToolkit • Author: Hernan Ochoa, Core Labs • Latest version, 1.4 • Toolkit contains three tools: iam.exe, whosthere.exe and genhash.exe • Iam.exe is used to change/modify NTLM credentials in memory • Whosthere.exe is used to list logon sessions that are using NTLM credentials • Genhash.exe used to test iam.exe

  23. PSH Toolkit Iam.dll requires a dependent library, iamdll.dll Strings extracted from the iamdll.dll indicate that it is capable of changing NTLM credentials.

  24. PSH Toolkit Indicators of the PSH Toolkit can be found in several Windows metadata files like $LogFile seen above.

  25. PSH Toolkit Keywords used to identify PSH Toolkit activity: • Hernan Ochoa • ChangeCreds • GenHash • iamdll.dll • pth.dll

  26. Pass-The-Hash Tools: Windows Credential Editor • Author: Hernan Ochoa, Amplia Security • Latest release is 1.42 beta • Support for both x86 and 64bit systems • Extracts NTLM credentials from memory as well as Kerberos tickets and cleartext passwords

  27. Windows Credential Editor • RecentFileCache.bcf is part of Windows Application Experience and Compatibility feature. Library called by WCE.exe Windows Time Stamp

  28. Windows Credential Editor Wceaux.dll is dropped in the user’s AppData\Local\Temp directory.

  29. Windows Credential Editor BootCKCL.etl located at %System32%\WDI\LogFiles generates a boot trace each time a profile logs on. WCE.EXE shows up if it is set for persistence.

  30. Windows Credential Editor Windows Credential Editor set for persistence with the –r switch.

  31. Windows Credential Editor WCE injects into the lsass.exe process every five seconds to dump user credentials.

  32. Windows Credential Editor • WCE.EXE will also generate output files for password hashes (credentials.txt) and Kerberos tickets (wce_krbtkts).

  33. Windows Credential Editor Keywords used to identify WCE.EXE activity: • Hernan Ochoa • \\.\pipe\WCEServicePipe • Dump Kerberos tickets to file • Getlsasrvaddr.exe

  34. APIs Associated with Pass-The-Hash • SamLookupDomainInSamServer • NlpGetPrimaryCredential • LsaEnumerateLogonSessions • SamrOpenDomain • SamrOpenUser • SamIGetPrivateData • SamrQueryInformationUser • SamIConnect • SamRidToSid

  35. They have my hash. Where do they go from here? Scenarios for Pass-The-Hash: • Dump all hashes on local system looking for admin privileges. • Remote Admin support • Local Admin • Help Desk support • Patches and updates • Database logons

  36. Was Pass-The-Hash used on your system? • Grep \:[0-9,A-F,a-f]{32,32}\:[0-9,A-F,a-f]{32,32} • Grep \:[0-9,A-W,a-f,\*,\x00]{32,32}\:[0-9,A-F,a-f]{32,32}

  37. Was Pass-The-Hash used on your system? Grep for hashes in memory also!

  38. Was Pass-The-Hash used on your network? • SMB connections over ports 139/445 to a writeable share (e.g. C$, admin$) • Client then accesses svcctl named pipe through SMB • Malware files are transferred, usually an EXE and a DLL • Connection to Windows Service Control Manager (SCM) remote protocol • SCM will run under services.exe

  39. Network Activity Call stack of a server side RPC call. This connection was initiated from a remote system. Data was recovered from ‘pagefile.sys’.

  40. Named Pipes as Attack Vectors Remote connection from mimikatz.exe via named pipe Security = Impersonation Dynamic False – User has full privileges pipe\svcctl – access to all processes running

  41. Named Pipes as Attack Vectors The lsarpc interface is used to communicate with the Local Security Authority

  42. Named Pipes as Attack Vectors Output from the Volatility plugin, ‘handles’ give clear indication of mimikatz being executed across the network via a PSEXESVC named pipe.

  43. Named Pipes as Attack Vectors Require SMB Security Signatures HKLM_Local_Machine\SYSTEM\CurrentControlSet\Services\LanManServer\Parameters\RequireSecuritySignature"0"

  44. Proprietary services and Named Pipes Windows Credential Editor connects using a named pipe for its own proprietary service.

  45. Event Logs Connections can often be correlated through local system event logs

  46. Event Logs Access to the share with System level privileges Access to all services running on the system

  47. Pass-The-Hash and Windows 8.1 • Domain Accounts do not store plaintext passwords in Memory • Restricted Admin RDP uses only network authentication – No credentials left on the remote box • Protected users using Kerberos authentication cannot be delegated • Authentication silos introduced

  48. Pass-The-Hash and Windows 8.1 • LSASS runs as a protected process • LM Hashes are not stored in memory • New SIDs for the “Local Account”

  49. Mitigation • Use Kerberos authentication package • Enforce a password policy of a 14 character minimum • Remove or limit access to Windows shares • Disable the remote registry service • Limit the possibility of DLL injection by removing users and groups from the ‘Debug Programs’ policy setting (SeDebugPrivilege)

  50. Mitigation • Protected Users Group • NTLM is not used. Kerberos or third party SSP is required • Kerberos tickets have a shorter life span • Windows Digest is not cached • Use NTLMv2 over NTLM if you cannot use Kerberos • Use console tools like Tivoli for remote administration • Use two factor authentication

More Related