Introduction - Opty-Forks/SSof GitHub Wiki

Lab - Introduction

The goal of this lab is to setup the course's laboratory environment and learn how to interact with a server using pwntools and requests modules from Python. Do not forget that in order to access our servers you should be connected to IST VPN.

1. Setup

  1. Donwload a VM
    • Either the one we provide you here or your favourite one
  2. Install the VM (VirtualBox or VMWare Fusion)
  3. Update the VM
    • sudo apt update; sudo apt upgrade
  4. Register yourself in our scoreboard and start playing.

2. Learn how to use sockets with pwntools

During the course you will need to interact with our servers and a good way to do it is using package pwntools for Python.

pip install pwntools (or pip3 install pwntools)

To practice we have prepared challenge PwnTools Sockets in the scoreboard. The goal is simple: you are given a target number and you should send MORE to get more numbers (randomly positive or negative) until the sum of all numbers is equal to target. Once you reach this value, you should send FINISH to get the flag.

You can see here a snippet on how to use sockets in pwntools.

3. Learn how to use Python Requests

Exercise Python requests is the same game as before but now over http. Instead of sending the command MORE you should access endpoint /more, and instead of sending FINISH you should access endpoint /finish.

You can see here a snippet on how to use module requests.

Notice that

  • a) the start of the game is endpoint hello.
  • b) the state is preserved using cookies so do not forget to send in a request the cookie that was received in the previous response.

Hints:

  • Are you being redirected to /hello when you request /more? See b) above.

4. Learn how to play with cookies

Exercise Python requests Again is equal to the previous one but we only give you a chance to reach target. Can you do it?

5. Learn to use ZAP/Burp

To finalize this lab you can also use the previous exercise to learn how to use a Web Security Tool. You can chose between OWASP ZAP (Zed Attack Proxy) and Burp Suite (Community Edition).

In either case you will need to install a certificate in your browser so that these proxies can intercept and analyse your traffic. There are several tutorials available on how to do it (for ZAP)

Remarks: If you use the VM we provide, you should have to update the certificate. Take this change and also update ZAP to its latest version.


Troubleshooting

  • If you have problems installing pwntools with pip3 just update pip3

    sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall