TODO: Need to pull web notes out of the OS Agnostic section (and then rename that to something better!)
Hack Responsibly.
Always ensure you have explicit permission to access any computer system before using any of the techniques contained in these documents. You accept full responsibility for your actions by applying any knowledge gained here.
Checklist
HTTP Response Codes
#Informational Response Codes (1xx)
100 - Continue
101 - Switching Protocols
102 - Processing
#Success Response Codes (2xx)
200 - OK 206 - Partial Content
201 - Created 207 - Multi-status
202 - Accepted 208 - Already Reported
203 - Non-authoritative Info 226 - IM Used
204 - No Content 250 - Low Storage Space
205 - Reset Content
#Redirection Response Codes (3xx)
300 - Multiple Choices 304 - Not Modified
301 - Moved Permanently 305 - Use Proxy
302 - Found 307 - Temporary Redirect
303 - See Other 308 - Permanent Redirect
#Client Error Response Codes (4xx)
400 - Multiple Choices 410 - Not Modified
401 - Moved Permanently 411 - Use Proxy
402 - Found 412 - Temporary Redirect
403 - See Other 413 - Permanent Redirect
404 - Multiple Choices 414 - Not Modified
405 - Moved Permanently 415 - Use Proxy
406 - Found 416 - Temporary Redirect
407 - See Other 417 - Permanent Redirect
408 - Found 418 - Temporary Redirect
409 - See Other
#Server Error Response Codes (5xx)
500 - Internal Server Error 508 - Loop Detected
501 - Not Implemented 509 - Bandwidth Limited
502 - Bad Gateway 510 - Not Extended
503 - Service Unavailable 511 - Network Auth Requried
504 - Gateway Timeout 550 - Permission Denied
505 - HTTP Ver Not Supported 551 - Option Not Supported
506 - Variant Also Negotiates 598 - Nework Read Timeout Error
507 - Insufficient Storage 599 - Network Connect Timeout Error
# Use HTTP::Cookie library <https://github.com/sparklemotion/http-cookie>
# Following examples were taken from the readme.md from above repository
## One cookie
cookie = HTTP::Cookie.new("uid", "u12345", domain: 'example.org',
for_domain: true,
path: '/',
max_age: 7 * 86400)
header['Set-Cookie'] = cookie.set_cookie_value
## Several cookies
jar = HTTP::CookieJar.new
jar.load(filename) if File.exist?(filename)
header["Set-Cookie"].each { |value| jar.parse(value, uri) }
header["Cookie"] = HTTP::Cookie.cookie_value(jar.cookies(uri))
Python2
# python has a cookie library!
# Following example taken from the python documentation
import cookielib, urllib2
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
r = opener.open("http://example.com/")
Edit cookies in chrome
Settings -> Advanced Settings -> Privacy -> Content -> Cookies
or "Edit This Cookie" plugin
Edit cookies in firefox
Preferences -> Privacy -> Show Cookies
or "Cookies Manager+" addon
Local File Inclusion (LFI) / Remote File Inclusion (RFI)
# POST file
curl -X POST -F "file=@/file/location/rev.php" http://$ip/upload.php --cookie "cookie"
# POST binary data to web form
curl -F "field=<rev.zip" http://$ip/upload.php -F 'k=v' --cookie "k=v;" -F "submit=true" -L -v
OpenVAS Vulnerability Scanner
#Install openvas
apt update
apt install openvas
#Run the setup script
openvas-setup
#Check that it is running on port 939
netstat -tulpn
#Login by using a browser and navigating to: https://127.0.0.1:939
fe80::/10 - febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff Unique Link Local 169.254.x.x APIPA
(built from MAC address on Linux, 7th bit flips, adds ff:fe in the center)
fc00::/7 - fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff Unique Local Unicast 10.x.x.x, 172.16.x.x, 192.168.x.x
2000::/3 - Global Unicast routable
ff02::1 - Multicast All Nodes
ff02::2 Multicast ROUTER nodes
ip6tables - iptables for ipv6
HTTP Authentication Types
Digest Authentication (uses htdigest)
-->susceptible to MITM attack!
Integrated Windows Authentication
-->will not function over proxy
Form-Based Authentication
-->not inherently encrypted, often poor implimentation
Web site "flyover" surveillance: Aquatone "is a tool for visual inspection of websites across a large amount of hosts and is convenient for quickly gaining an overview of HTTP-based attack surface" - from the author (see link). Visual dirbuster?
Crawl web pages for keywords - useful for password/vhost enumeration lists
# To spider a site and write all found words to a file
cewl -w <file> <url>
# To spider a site and follow links to other sites
cewl -o <url>
# To spider a site using a given user-agent
cewl -u <user-agent> <url>
# To spider a site for a given depth and minimum word length
cewl -d <depth> -m <min word length> <url>
# To spider a site and include a count for each word
cewl -c <url>
# To spider a site inluding meta data and separate the meta_data words
cewl -a -meta_file <file> <url>
# To spider a site and store email adresses in a separate file
cewl -e -email_file <file> <url>
Common checks
# robots.txt
curl http://example.com/robots.txt
# headers
wget --save-headers http://www.example.com/
# Strict-Transport-Security (HSTS)
# X-Frame-Options: SAMEORIGIN
# X-XSS-Protection: 1; mode=block
# X-Content-Type-Options: nosniff
# Cookies
# Check Secure and HttpOnly flag in session cookie
# If you find a BIG-IP cookie, app is behind a load balancer
# SSL Ciphers
nmap --script ssl-enum-ciphers -p 443 www.example.com
# HTTP Methods
nmap -p 443 --script http-methods www.example.com
# Cross Domain Policy
curl http://example.com/crossdomain.xml
# allow-access-from domain="*"
IP conversion
Injecting IPs when '.' is disallowed: convert the standard "dotted decimal" format to decimal, or hex value using -ip2dh. The sending or receiving computer will usually automatically convert it to a format that it can use. This is a great way to bypass WAF, IDS, or other tools that filter on IPs.
If you like this content and would like to see more, please consider buying me a coffee!