You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.9 KiB

  1. # virt-lab
  2. VM lab environment for doing network stuff
  3. ### Requirements
  4. * Virtualbox (5.2 or older)
  5. * Vagrant 2.2.x
  6. ### Setup base virtual network
  7. 1. Start all 6 VMs (3 routers and 3 edge nodes): `./boot_all.sh`
  8. 2. Go do something else cause its gonna take a while..
  9. 3. (Optional) ssh to some machine:
  10. * ssh by port: `ssh -l vagrant localhost -p 22111`
  11. * ssh with vagrant: `cd edgers/vpn-server/ && vagrant ssh` or `cd <path-to-vagrantfile> && vagrant ssh`
  12. 4. Restart all the machines to make network changes take effect: `./stop_all.sh` then `./start_all.sh`
  13. 4. Build VPN server and add VPN client config file to client node: `cd virt-lab/configs; ./configure_vpn.sh`
  14. ![picture](diagrams/virtlab-setup.jpg)
  15. #### Connect client to VPN server
  16. 1. Ssh to the client VM: `cd virt-lab/edgers/client && vagrant ssh`
  17. 2. Connect to the local vpn server: `./connect.sh`
  18. ## Client-Side Attack
  19. #### Configure client side attack environment
  20. 1. Navigate to configuration folder: `cd virt-lab/configs`
  21. 2. Run setup script to build gateway attacker node: `./setup_cliside_env.sh`
  22. #### Test client side attack
  23. 1. ssh to victim client VM (base host): `cd virt-lab/edgers/client && vagrant ssh`
  24. 2. Connect client to VPN (in client vm): `./connect.sh`
  25. 3. Open another shell to ssh to web server node (base host): `cd virt-lab/edgers/web-server && vagrant ssh`
  26. 4. Open another shell to ssh to gateway attacker node (base host): `cd virt-lab/routers/gateway && vagrant ssh`
  27. 5. On web-server vm, open a netcat connection for the client to connect to: `nc -l 8080`
  28. 6. On the client vm, connect to the web server: `nc 192.168.3.2 8080 -p 40404`
  29. 7. On the attacker vm, navigate to the attack folder: `cd vpn-attacks/client-side-attack`
  30. 8. Rebuild all the attack scripts (attacker): `./rebuild_all.sh`
  31. 9. Navigate to full attack folder (attacker): `cd complete_attack`
  32. 10. Start full attack script (attacker): `./attack.sh`
  33. 11. Wait for script to infer private tun IP, port in use, exact sequence number, and in-window ack number needed to inject TCP
  34. ## Server-Side Attack
  35. #### Configure server side attack environment
  36. 1. Navigate to configuration folder: `cd virt-lab/configs`
  37. 2. Run setup script to build gateway attacker node: `./setup_servside_env.sh.sh`
  38. #### Test server side DNS attack
  39. 1. ssh to victim client VM (base host): `cd virt-lab/edgers/client && vagrant ssh`
  40. 2. Connect client to VPN (in client vm): `./connect.sh`
  41. 3. Open another shell to ssh to router1 attacker node (base host): `cd virt-lab/routers/router1 && vagrant ssh`
  42. 4. On the attack router vm navigate to dns inject folder: `cd vpn-attacks/server-side-attack/dns-sside/full_scan/`
  43. 5. Compile full attack script (attacker): `make`
  44. 6. Issue DNS lookup from client vm: `nslookup test.com 192.168.3.2`
  45. 7. Start inject script from attacker node: `./inject_test.sh`
  46. ## Teardown
  47. 1. Stop all the VMs: `./stop_all.sh`
  48. 2. Destroii all VMs in our path: `./destroy_all.sh`