Skip to content

CPU overload due to wrapper launching new Node processes when an unhandled error occurs #375

@jkomoda

Description

@jkomoda

Issue:

When running port scans on nodejs apps running via node-windows, the server CPU and memory is being overloaded to 100% due to node-windows continuously launching new processes when receiving the error:

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: read ECONNRESET
    at _errnoException (util.js:1022:11)
    at TCP.onread (net.js:615:25)

The scanner client connects to server, sends TCP packet data, then disconnects. Each time the disconnect happens, the wrapper catches this error and launches a new process here:

launch('warn', err.message);

How To Reproduce:

  1. Locally, use node-windows to install a node application that runs a simple http server listening on a specific port
  2. Install Nessus Expert trial version locally and run a scan that targets the application port
  3. Observe in task manager that multiple processes are being created from the wrapper each time the scanner TCP client disconnects

Expected Behavior:
The wrapper to handle the ECONNRESET error gracefully and not launch more processes without killing the previous one

Screenshots:

  1. Create the node server and run as node-windows service

Screenshot 2024-04-25 184934

  1. Run the Nessus scans targeting the port and observe the daemon logs showing the TCP clients connecting, sending data, then disconnecting. Then new processes try to start up but are unable to due to the original process running on the same port.

image

image

  1. In Event Viewer, observe the read ECONNRESET error being logged from wrapper.js

Screenshot 2024-04-25 183526

  1. Observe Node processes continuously being launched over and over

Screenshot 2024-04-25 183955

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