Web Hacking

Today's Challenges

  • Beginner-Intermediate: Natas
    • Wargame. More structured. Better for trying out and learning.
  • Intermediate:
    • w3challs - Standalone challenges. More like CTF competitions.
    • Cylab - Standalone challenges. More like CTF competitions.
  • Advanced: AFNOM CTFd

If you are doing Natas, then read the respective homepage, which tells you how to get started. Each level has a password you need to enter it, so make sure to write them down as you find them!

Each challenge on w3challs has its own page that links to the challenge. If you want to submit flags and earn points then you will need to make an account. Remember, generally, less solves = harder challenge!

Challenge resources

Here's a few resources for each of the attack types talked about today

General resources

  • OWASP and PortSwigger (makers of ZAP and BurpSuite respectively) both have great wikis/articles on all types of web attacks that you might encounter
  • Inspect element is always a great to way to start working out a web challenge!
  • Remember to use your search engine, looking stuff up is a great way to learn

SQL Injection

  • w3schools has a good guide with examples you can play with

Cookies 🍪

User Agents

  • You can edit this as part of a request in ZAP
  • Alternatively download a user-agent switcher extension for your browser

Cross Site Scripting (XSS)

Local File Inclusion

  • This article provides some good examples and explanations for different types of file inclusion vulnerabilities
  • Hacktricks provides more examples relevant to PHP

Web proxies

Some web challenges are easier to solve if you have a proxy to capture and edit web requests. We recommend ZAP (a free and open source tool). Alternatively, you can install Burp Suite which is a proprietary tool with similar features. For this session, you probably won't need a proxy but if you want to install one, here are instructions for recent versions of Ubuntu (the process is similar for other Linux distros):

ZAP

  • On some systems, you can install ZAP with your package manager by installing the zaproxy package but if it isn't available (like on Ubuntu), follow the instructions below
  • First, you'll need to install Java, to do this on Ubuntu, run the following:
sudo apt install default-jre
  • Then, download the ZAP installer from https://www.zaproxy.org/download/, select the "Linux Installer" option
  • Once the file has downloaded, open the terminal, navigate to the directory you downloaded the file in and run
chmod +x ZAP_*_unix.sh
sudo ./ZAP_*_unix.sh
  • You can run the above commands with the exact name of the file you downloaded, the example above uses the wildcard (*) so it works regardless of the version of the installer
  • Go through the setup wizard and leave all options as their defaults
  • Launch ZAP as you would launch any other app, select 'no' when asked if you would like to persist your session
  • Click 'Manual explore' and type in the URL of the challenge's website, click 'Launch Browser'
  • If it works, you're done! On Ubuntu, however, it's likely you'll get an error saying it can't find the browser
  • To fix this, click on 'Tools' in the toolbar, find 'Options', select 'Selenium' and change the geckodriver path to /snap/bin/firefox.geckodriver, the browser should now be able to launch
  • ZAP should now be working

If you are struggling then talk to your friends and the people around you! Remember you can always look stuff up too.
We want everyone to have fun and have a good time learning something new!

Happy Web hacking!