This page contains links to notes and code snippets.
- Juice Shop CTF
- Juice Shop Hints
- Juice Shop Intro
- Password Cracking
- Automating sqlmap
- Installing .NET
- Clickjack
- SQL
- DNS
- TCP
- UDP
- IP
- ARP
- Networking
- Buffer Overflow
- Shellshock
- Reverse Shell
- Upgrade VM
- Setup Environment
- File Commands and Directory Navigation
- Permissions
- Networking
- Process commands
- Clone a website
Juice Shop CTF
- registration: http://cs335-juice-shop-scoreboard.eastus.cloudapp.azure.com:8000/
- team 1: http://ycpcs24-cs335-team1.eastus.azurecontainer.io:3000
- team 2: http://ycpcs24-cs335-team2.eastus.azurecontainer.io:3000
- team 3: http://ycpcs24-cs335-team3.eastus.azurecontainer.io:3000
- team 4: http://ycpcs24-cs335-team4.eastus.azurecontainer.io:3000
- Individual Users
- Local Environment:
docker run -d -e "CTF_KEY=M2ZjODVkZTM5Y2JhODVhNDViNmU2MjM0" -p 3000:3000 bkimminich/juice-shop
- Local Environment:
Juice Shop Hints
- Security by obscurity
- Review page source (hardcoded secrets or hidden links)
- robots.txt (hidden subdomains)
- Review .js source files (hidden or hardcoded)
- Input Validation
- CSRF
- XSS Cheat Sheet
- SQLi Cheat Sheet
- Enable HTML Elements
- API parameters
- Network Traffic
- Any identifiers
- Custom Headers
- Edit and Reply traffic
- Server Exceptions
Juice Shop Intro
- OWASP Juice Shop
docker pull bkimminich/juice-shopdocker run --rm -p 3000:3000 bkimminich/juice-shop- Navigate to http://localhost:3000
Password Cracking
- John The Ripper
git clone https://github.com/magnumripper/JohnTheRipper.gitcd ./JohnTheRipper/srcsudo apt-get install libssl-devcd src./configuremake -s clean && make -sj4pip install --user dpkt
- Wordlists
- rockyou.txt, extract with
tar -xvf rockyou.txt.tar.gz - https://www.openwall.com/wordlists/
- More under resources …
- rockyou.txt, extract with
- Crack me
Automating sqlmap
wget https://github.com/sqlmapproject/sqlmap/archive/master.zip --no-check-certificate- sqlmap usage
- SqlmapRequest: SqlmapRequest.cs
- Program: Program.cs
- SqlmapApi: SqlmapApi.cs
- SqlmapLog: SqlmapLog.cs
Installing .NET
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh --no-check-certificatechmod +x ./dotnet-install.sh./dotnet-install.sh --version latest- Add the following to
~/.bashrcexport DOTNET_ROOT=$HOME/.dotnetexport PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
- JSON serialization framework: Json.NET
dotnet add package Newtonsoft.Json --version 13.0.3
Clickjack
- iframe Demo: index.html
- Labsetup: Labsetup.zip
SQL
- Create Table: create-table.sql
- Insert Into: insert-into.sql
DNS
- Send DNS query: send_dns_query.py
- DNS server: dns-server.py
- RFC
- DNS Cache
- Dump:
rndc dumpdb -cache - View:
cat /var/cache/bind/dump.db - Flush:
rndc flush
- Dump:
- Potential Traffic Issues
- Delay by 100ms:
tc qdisc add dev eth0 root netem delay 100ms - Delete the tc entry:
tc qdisc del dev eth0 root netem - Show all tc entries:
tc qdisc show dev eth0
- Delay by 100ms:
TCP
- Client: client.py
- Server: server.py
- Multi Server: server2.py
- Docker Compose: docker-compose.yml
- Synflood (python): synflood.py
- Synflood (C): synflood.c
- Reset: reset.py
- Auto Reset: auto_reset.py
- Hijack Session: hijack.py
UDP
- Server: udp_server.py
- Attack: udp_attack.py
IP
- Fragment: fragment.py
- ICMP: icmp.py
- Docker Compose: docker-compose.yml
- ICMP Redirect: icmp_redirect.py
- Ping: ping.py
- Traceroute: traceroute.py
sysctl net.ipv4.conf.all.accept_redirects=1
ARP
- Docker Compose: docker-compose.yml
- arp_request: arp_request.py
- arp poisoning: arp.py
- arp mitm: mitm.py
sysctl -w net.ipv4.ip_forward=0
Networking
- udp_client: udp_client.py
- udp_server: udp_server.py
- Docker Compose: docker-compose.yml
- Scapy:
- sniff: sniff.py
- icmp_spoof: icmp_spoof.py
- udp_spoof: udp_spoof.py
- sniff_spoof: sniff_spoof.py
Buffer Overflow
- Buffer Overflow Example: buffer.c
- Memory Layout: layout.c
- Launching shell: launch_shell.c
- ASCII vs binary: print_zero.c
- Print esp: sp.c
- ASLR: aslr.c
Shellshock
- Set-UID Example: vul.c
Reverse Shell
- File Descriptors Intro: fd.c
- Redirection: redirect.c
- Duplicate a file descriptor: dup.c and dup2.c
- Redirecting IO to TCP Connections: tcp_in.c and tcp_out.c
Upgrade VM
sudo apt update- downloads package information from all configured sources.sudo apt upgrade- will upgrade all installed packages to their latest versions.sudo apt-get autoremove- deletes orphaned packages, or dependencies that remain installed after you have installed an application and then deleted it.sudo apt-get clean- removes all packages from the cache.
Setup Environment
- Sublime:
sudo snap install sublime-text --classic - Visual Studio Code:
sudo snap install --classic code - clion:
sudo snap install clion --classic
File Commands and Directory Navigation
cdgo to $HOME directory.cd ...go one level up the directory tree.cd /etcto change to the /etc directory.lslist all files.- Use
-Rto list all-subdirectories as well -awill list hidden files as well- Use the
-alargument to view details
- Use
pwdlists the present working directory.mkdir directorycreated a directory.rm -r directoryremoves the directory and its contents recursively. Use thefargument to forcefully remove, re:rm -rf directory.touch filewill create an empty file.rm fileremoves a flle.cp file file2will copy file to file2.mv file file2renames or moves file to file2.cat filenamewill display the contests of filename.cat > filenamecreates a new file with filename.
Permissions

- Legend
- User or Owner
U - Group
G - World (Other Users)
W
- User or Owner
- Permission Classes
- Read
r - Write
w - Execute
x
- Read
- File Type
-regular fileddirectory
- Examples
- file desktop.ini:
-rwxrwxrwx 1 seed seed 282 Dec 27 10:10 desktop.ini - directory host:
drwxrwxrwx 1 seed seed 4096 Jan 20 13:22 host
Number Permission Type Symbol 0 No Permission — 1 Execute –x 2 Write -w- 3 Execute + Write -wx 4 Read r– 5 Read + Execute r-x 6 Read +Write rw- 7 Read + Write +Execute rwx - file desktop.ini:
- Permission Examples
chmod 777 filename: rwx rwx rwxchmod 775 filename: rwx rwx r-xchmod 755 filename: rwx r-x r-xchmod 664 filename: rw- rw- r–chmod 644 filename: rw- r– r–
Networking
ifconfig -adisplays all network interfaces and IP address.hostname -Idisplays the IP addresses of the host (all local IP addresses).host domaindisplays IP address for domain.ping hostsends ICMP echo request to host.whois domaindisplays whois records for domain.dig domaindisplays DNS information for domain.dig -x IPdoes reverse lookup of IP address.nslookupquery Internet name servers interactively.- To display the IP/kernel routing table:
netstat -rnip routeroute -n
Process commands
bgsends a process to the background.fgruns a stopped process in the foreground.topshows details on all active processes.psgives the status of processes running for a user.pidofgives the process id (PID) of a process.ps PIDgets the status of a particular process.kill PIDkills a process with PID .nicestarts a process with a given priority.
Clone a website
wget --mirror --convert-links --adjust-extension --page-requisites --no-check-certificate --no-parent https://site-to-copy.com
--mirrormake the download recursive.--no-parentdo not crawl the parent/top directory.--convert-linksmakes all the links work properly with the offline copy.--page-requisitesdownload JS/CSS files.--adjust-extensionadd the appropriate extensions (e.g. html, css, js) to files.--no-check-certificateignores SSL certificate errors To top
