High impactSecurityNo patch yet

zod-msg-tools 0.1.4: npm malware hides an auth-bypassing SQL backdoor

A fake Zod helper on npm patches Node's HTTP server at runtime and adds a hidden endpoint that sits in front of your router and auth, runs queries on your database pools and, where the psql client is present, can reach OS command execution on Postgres deployments.

Khalid Aboubakr Engineering DeskPublished

Automated engineering analysis by the Khalid Aboubakr Engineering Desk, from the primary sources listed below. Not reviewed by a person before publication. About the desk

Bottom line

zod-msg-tools 0.1.4 is malware, and GitHub lists no patched versions, so there is nothing to upgrade to. Any Node service that imported it and called registerTools() with live MySQL, Postgres or ClickHouse pools should be treated as compromised. Remove the package, rotate the database credentials it could reach, and rebuild affected hosts and images, especially Alpine-based ones.

What happened

GitHub published advisory GHSA-4xcm-r7xm-qrwh, which classifies the npm package zod-msg-tools version 0.1.4 as malware. The package presents itself as a helper for Zod validation messages, but the advisory says its real code is malicious.

The advisory describes this behaviour:

  • The code monkey-patches Node's http.createServer. Every HTTP server the host process creates afterwards serves a hidden POST endpoint.
  • Requests to that endpoint are handled before the application's router and middleware, so they bypass application authentication.
  • Those requests run attacker-supplied queries against the MySQL, Postgres or ClickHouse pools that the host application passed to registerTools().
  • On Postgres, the backdoor escalates to OS command execution as the user running the Node process. It does this by passing input to the psql command-line client.
  • When registerTools() is called, it installs a Postgres client at library init on Alpine-based hosts, silently modifying the host.
  • The package.json description admits to a hidden admin SQL console, while the README describes something else. This mismatch hides the backdoor from developers browsing the package page.

GitHub states the package has no patched versions and does not accept edits to the advisory. The advisory is based on the OpenSSF malicious-packages record (MAL-2026-20426), which credits Amazon Inspector as the finder.

Why it matters

Unlike packages that act only at install time, this one changes how the running service behaves.

The hidden endpoint is attached at the http.createServer level, beneath Express, Fastify, Nest or whatever framework you use. Several common controls will not see it:

  • Route inventories and OpenAPI specs.
  • Authentication middleware.
  • Most framework-level request logging.

An API gateway or WAF in front of the service will forward the request if it allows the path prefix. The example paths in the advisory (/api/aff-service/zod-tools, /api/backoffice/<service>/zod-tools) would fall inside any rule that allows /api/*.

The impact is direct access to production databases through the application's own pooled credentials, limited only by the privileges of the database role those pools use. On Postgres it can extend to shell access as the Node process user. That path relies on the psql client being available, which the package installs itself on Alpine. On other hosts, whether psql is present decides whether the shell path is reachable, so treat it as possible rather than certain.

The Alpine side effect matters for cleanup. The package changes the host or container image, not just node_modules.

Engineering assessment

Our assessment: for any service that actually wired this package up, this is a full compromise of the data tier. On Postgres deployments where psql is available, it is also a compromise of the host. It is not a vulnerability to patch.

The practical dividing line is registerTools():

  • Called with live DB pools. The advisory describes a working, unauthenticated path to those databases. Assume data was read or altered unless you can prove otherwise from network or proxy logs.
  • Installed or imported but never called. Exposure is less clear. Everything the advisory describes is tied to registerTools(), but it does not say whether importing alone activates the server patch. The desk would not rely on that distinction without a code review. Remove the package either way.

Three points the announcement leaves under-stated:

  1. Removing the dependency is not cleanup. On Alpine hosts, calling registerTools() installs the Postgres client at library init. If a container ran the package and was then committed, snapshotted or reused, that change persists. Rebuild from a clean base image rather than editing in place.
  2. The blast radius is the Node process's privileges. Command execution runs as the Node process user. Services running as root, with mounted secrets, cloud instance credentials or network reach into internal systems should be scoped accordingly.
  3. Application logs may show nothing. Requests are intercepted before your middleware. Evidence, if any exists, is more likely in load balancer, ingress, reverse proxy or gateway access logs.

The advisory says only "paths like" the two examples, so matching on those exact strings may miss variants. Searching for zod-tools in access logs is a reasonable starting point, but a clean result is not proof of non-use.

The advisory does not state whether the backdoor has been used against anyone, and gives no download or dependent counts.

Is this you?

  • npm ls zod-msg-tools (or the pnpm/yarn equivalent) returns any result in any repository, monorepo package or service.
  • A lockfile references zod-msg-tools or zod-msg-tools-0.1.4.tgz. The OpenSSF record lists the tarball integrity as sha512-G5W5fw1Nhl2eSx+xYas674op0oiL9z+gw5rLJT1exEIaMYgB044spS7emOFjHMvz2QzMKmItD1C3mGOsR+cBbQ==.
  • Your code calls registerTools() and passes MySQL, Postgres or ClickHouse pools. This is the highest-risk case.
  • The service runs on Alpine and apk info -e postgresql-client shows the package present, although nothing in your Dockerfile installs it.
  • A Postgres-backed service has psql available on its host or image (check with which psql).
  • Edge, proxy or gateway logs contain POST requests to paths containing zod-tools.
  • Built container images or artefacts were produced while the package was in the dependency tree.

What to do

No fixed version exists, so upgrading is not an option. In priority order:

  1. Inventory now. Run npm ls zod-msg-tools across all repositories and CI caches, and search lockfiles for the name and the integrity hash above.
  2. Remove the package and any code calling registerTools(). Redeploy from a rebuilt image based on a clean base, not a patched running container.
  3. If registerTools() was called with live pools, treat it as an incident:
    • Rotate the credentials for every database pool passed to it.
    • Rotate any secrets readable by the Node process user.
    • Review database audit logs and edge access logs for the period the package was deployed.
  4. On Postgres-backed services, scope host compromise. Check whether psql was present. If it was, review what the Node process user could reach: files, mounted secrets, cloud metadata credentials and internal network. Rebuild the hosts or nodes if command execution cannot be ruled out.
  5. Block the package in your internal registry, proxy or dependency policy so it cannot return through a transitive path.
  6. Not vendor guidance: add a temporary edge or gateway rule that denies and alerts on any path containing zod-tools. Treat it as a tripwire, not a fix.
  7. Not vendor guidance: for technical leads, require review of new direct dependencies with low adoption, and run Node services as non-root with least-privilege database roles. This limits what a runtime backdoor of this kind can reach.

For wider coverage, see the Engineering Desk news.

What we don't know yet

  • How many projects installed or depend on 0.1.4. The evidence gives no download or dependent counts.
  • Whether the package has been removed from npm.
  • Whether there is any evidence the backdoor has been used against anyone. None is stated.
  • Whether importing the package alone activates the http.createServer patch, or only calling registerTools().
  • Whether removing the package reverses any host changes. The advisory does not say.
  • The full set of hidden endpoint paths. The advisory gives examples only.
  • Whether other versions or packages from the same publisher are affected. Only 0.1.4 is listed.

The desk will check for registry removal, publisher-level advisories and any updated OpenSSF record.

Sources

Latest engineering analysis