Next.js Discord

Discord Forum

Next.js listening on random ports

Unanswered
Thrianta posted this in #help-forum
Open in Discord
ThriantaOP
Hello all. I am currently hosting several websites on my hosting provider using the PM2 process manager. When starting the websites using a PM2 ecosystem file, there are multiple "internal" processes within the Next.js server that are also listening on random ports. I've attached a photo of my netstat output showing these random ports listening on the 0.0.0.0 interface. All of my Next.js servers are configured to only listen on 127.0.0.1, so these should not be here. Does anyone know what is going on?

1 Reply

ThriantaOP
Using ps -fp <ID> on the process reveals a little more about how it spawned.

UID          PID    PPID  C STIME TTY          TIME CMD
root        2350    2308  0 23:51 ?        00:00:01 /root/.nvm/versions/node/v16.19.1/bin/node /root/mcstatus.io/website/node_modules/next/dist/compiled/jest-worker/processChild.js


I am also able to use my public IP address and visit the website using one of the ports on the list, which tells me that this is a huge security problem.