Nessus Through a Transparent Proxy
Atlan Team
There are, on occasions, times when you will need to proxy Nessus (Netsparker or similar tools) through a VPS or an ec2 instance in the cloud if your originating IP is blocked when trying to scan a web app.
There are a number of ways to do this, however if you are struggling to get the inbuilt Nessus proxy to work, and tools like TinyProxy and similar are giving you SSL issues, then this solution, albeit long winded, may save you some time.
What we are going to do is set up an ec2 instance, point our domain at it, install Nginx and set up a transparent proxy using proxy-pass without SSL verification.
Once this is set up, you can then simply scan port 443 of your ec2 instance, and the HTTPS traffic will be proxied through to the application you are targeting.
So let's get an ec2 instance set up using the free Tier. You can follow the steps here to initiate an ec2 instance.
Firstly login and select your region based on your preferences.
Next you will want to launch an instance.
Once you have selected this you will want to choose and Amazon Machine Image - we will be using an Ubuntu 18.04 image.
Next choose the free tier eligable - selecting this will allow you to launch the instance and run it for the length of the time of your engagement, and likely not result in any expense.
Next you will need to configure instance details, storage and tags, for all of which the default configuration is fine.
Next comes Security Groups. Here you should allow port 80 from anywhere (we will need this for Letsencrypt), port 22 and port 443 only from the IPs of your box and your Nessus instance.
Next comes the Review, where you can create your AWS Key pair - name it accordingly and download it.
Once this is done, go to your domain name provider, and point an A record at the IP address of your ec2 instance.
AWS will give you this information or alternavitely you can SSH into your ec2 instance and type:
And the output will be the public IP address of your ec2 instance.
Once the DNS records have propogated, you can begin to install Nginx and get your Letsencrypt certification in the following steps
First update:
Next install nginx:
Next add the certbot repository:
You’ll need to press ENTER
to accept.
Install Certbot’s Nginx package with apt
:
Next you will want to get the SSL certificate for your domain using certbot:
Once this has run, and you have selected a further option or two, you should see the following message:
Now you will want to edit the relevant Nginx conf file for your site:
vim /etc/nginx/sites-enabled/Default
Replace the conf file with the following, using your own domain and certitifcates in lines that Letsencrypt generated and changing YOUR_TARGET_IP_HERE to the box you want to scan:
Then restart Nginx:
If at this point you have done everything right you should be able to cURL your own domain and recieve the index page of the application sitting behind the proxy.
Final step is to firewall Port 80, and only allow connections to port 22 & 443 from your working machine and Nessus IP.
Now you should be able to scan transparently through the ec2 instance if you have a blocked IP from your Nessus or other toolsets. Note, you will also be able to any other tools that generate HTTPS traffic to enumerate through the proxy.
Should you be blocked again, then you can assign a new Elastic IP (docs here) and simply change the A record of your domain to the new IP address.