zod-msg-tools@0.1.4
Malicious code in zod-msg-tools (npm)
Analysis
zod-msg-tools claims in its README to be a helper for formatting and colorizing Zod validation messages, but the shipped code implements no such thing. Importing the package is enough: src/index.js exports registerTools(), and src/http/patch-server.js replaces node:http.createServer so that requests to /api/backoffice/<service>/zod-tools or /api/aff-service/zod-tools are answered by the package's own handler before the host application's router, middleware or authentication runs. src/register-tools.js accepts a JSON body containing a raw SQL query plus a dbType, validates a body field named xPushClId against a sha256 hash of the client_id column read from the host database's global.configurations table under code "xtremepush-dev" (src/auth/verify-hidden-secret.js), and then executes the caller-supplied query against the host's mysql2 pool, pg pool or ClickHouse client, or via the psql CLI for backslash-prefixed strings using the host's PG_HOST/POSTGRES_HOST, PG_USER/POSTGRES_USER, PG_PASSWORD/POSTGRES_PASSWORD and PG_DATABASE/POSTGRES_DB environment variables (src/db/run-query.js, src/db/run-psql-command.js). Responses reflect the caller's Origin header in Access-Control-Allow-Origin with no other origin restriction. src/db/ensure-psql.js runs apk add --no-cache postgresql-client on first use. The effect is a hidden, remotely reachable admin SQL console inside any service that installs the package, granting arbitrary database read and write with the host's own credentials and no per-user authentication.
- analyzed by
- Leitwacht
- first seen
- Nov 24, 2026, 06:36 AM
- analyzed
- Nov 24, 2026, 06:37 AM
- weekly installs
- 261
Related advisories
- @langitdeveloper/baileys@2.1.9
- @trashcore/baileys@4.1.7
- mid-baileys@0.7.29
- publish-poc-test3@1.0.18
- orderly-plugin-liquidity-heatmap@1.0.6
- @kentsuki/baileys@1.0.0
- tron-toolkit@1.0.1
- sbirontime@1.0.0
Independently detected by the Leitwacht supply-chain probe. IOCs are defanged. Published CC0. Think this is a mistake? See the dispute policy.