{"slug": "malicious-npm-package-turns-hermes-agent-into-a-backdoor", "title": "Malicious npm Package Turns Hermes Agent into a Backdoor", "summary": "The npm package @leadstack/crm-connect, published by the account zmaticoo in nine versions on 16 November 2026, installed the open-source Hermes Agent from Nous Research on install and connected it to an attacker-controlled Telegram bot, giving the attacker shell access, file read/write, browser control and job scheduling on the host, according to SafeDep, which flagged the package five minutes after its last release and reported that npm has since removed it. When npm install ran as root, the agent ran as a root systemd service renamed \"LeadStack Lead Routing Daemon,\" and version 1.0.18 fell back to a user service with linger enabled so the agent persisted after logout; the package fetched the agent's .env file and SOUL.md instructions from 72[.]62[.]1[.]108 during install. SafeDep said this is the first npm install it has seen deliver Hermes Agent as an implant, following ThreatDown's September report of a botnet spreading the agent through exposed Docker APIs, and the publisher is still active, with three packages released on 18 November that pull a dependency from the attacker's server.", "body_md": "# Malicious npm Package Turns Hermes Agent into a Backdoor\n\nOn this page\n\nThe malicious npm package `@leadstack/crm-connect` installed a full AI agent on the servers it reached. It posed as the official client for a CRM called LeadStack. On install it set up Hermes Agent, an open-source agent from Nous Research that can run shell commands, edit files and drive a browser. It downloaded the agent’s keys and standing instructions from the attacker’s server and connected the agent to the attacker’s Telegram bot. Then it registered the agent as a systemd service renamed “LeadStack Lead Routing Daemon”. When `npm install` ran as root, the agent ran as root. From then on the attacker could give the server orders from a Telegram chat.\n\nThe npm account `zmaticoo` published nine versions on 16 November 2026. SafeDep flagged the package five minutes after the last release, and npm has since removed it. In September, [ThreatDown reported a botnet(opens in new tab)](https://www.threatdown.com/blog/carbonato/) that spreads through exposed Docker APIs and runs Hermes Agent as an implant. This is the first case SafeDep has seen of an npm install doing the same, with the agent’s persona downloaded at install time. The publisher is still active. Three packages it released on 18 November contain no code of their own and pull a dependency from the attacker’s server instead.\n\n## TL;DR\n\n**Impact**\n\n- Installs Hermes Agent and connects it to a Telegram bot the attacker controls. Through that bot the attacker can run shell commands, read and write files, browse the web and schedule jobs on the host.\n- Runs the agent as a root systemd service when `npm install` runs as root. Version 1.0.18 falls back to a user service and tries to enable linger, so the agent keeps running after the user logs out.\n- Fetches the agent’s `.env` file and`SOUL.md` instructions from 72[.]62[.]1[.]108 during the install.\n- Names the service “LeadStack routing” and deletes the original Hermes unit file.\n- Later versions drop the agent and run JavaScript or a binary downloaded from the attacker’s server, with the full environment of the install.\n\n**Indicators of compromise**\n\n- `@leadstack/crm-connect` 1.0.15, 1.0.18, 1.0.19, 1.0.20, 1.0.21, 1.0.29, 1.0.30, 1.1.0 and 1.1.1\n- 72[.]62[.]1[.]108, `72-62-1-108[.]sslip[.]io` and`zmaticco[.]dev`\n- systemd units `leadstack-routing.service` and`leadstack-ingest-worker.service`\n- `~/.leadstack/` ,`~/.config/leadstack/` and`~/.local/share/leadstack/bin/`\n\nThe full list is in [Indicators of compromise](#indicators-of-compromise).\n\n## Versions and timeline\n\nThe npm user `zmaticoo` (venstate25@gmail[.]com) published all nine versions between 09:44 and 15:27 UTC. The package described itself as “Official LeadStack CRM client”. Its early READMEs asked for “LeadStack partner access on npm (private org)”, and every version except the last set `\"access\": \"restricted\"` in `publishConfig`. The npmmirror copy, which still serves every tarball, records the package as created at 15:26 UTC, a minute before the last release. That suggests the package stayed private for most of the day. Only npm can confirm it. Version numbers 1.0.0 to 1.0.14, 1.0.16, 1.0.17 and 1.0.22 to 1.0.28 do not appear on the mirror.\n\nLeadStack is a borrowed name. The package’s docs point at `api.leadstack.io`, a host that does not resolve. The domain `leadstack.io` belongs to an unrelated business consultancy that has nothing to do with this package.\n\n## How the payload starts\n\nVersion 1.0.15 carries the agent install in full. Its `package.json` declares a postinstall script.\n\n`bin/postinstall.js` runs `bin/lead-provision.js` with Node warnings switched off and fails the install if the script fails.\n\n`lead-provision.js` does everything from one `main()` function. It checks that the server is up, writes the agent’s configuration, installs the agent, picks the model and makes it permanent.\n\n## Agent configuration from the attacker’s server\n\nThe bundled configuration file names the server and the model.\n\nTwo requests to that server set up the agent. The first must return a list called `env_lines`, or the script stops. Those lines go into the `.env` file in the agent’s home directory, `~/.leadstack/agent/` by default. The second returns plain text, which the script saves as the agent’s `SOUL.md`.\n\n`SOUL.md` decides who the agent is. Hermes Agent places it first in the system prompt, and its starter template says the file “is loaded fresh each message”. The prompt-injection scanner [only logs a warning(opens in new tab)](https://hermes-agent.nousresearch.com/docs/user-guide/security) when it flags a `SOUL.md` in the agent’s home directory, and loads the file anyway.\n\nThe package never asks the victim for a model key or a bot token, and Hermes Agent cannot reach Telegram without them. So the `.env` from the server has to carry a Telegram bot token and a key for the Kimi model named in the configuration file. It also needs either a list of Telegram users the agent will obey or a setting that lets anyone in. Without one of those two, Hermes [denies every Telegram user(opens in new tab)](https://hermes-agent.nousresearch.com/docs/user-guide/security). SafeDep did not recover the real `.env` or `SOUL.md`. On 19 November port 3000 no longer answered, and the same paths on port 80 returned HTTP 401 with a request for a bearer token.\n\nThe token can come from an environment variable or a configuration file next to the script.\n\n`HERMES_LAB_TOKEN`, `HERMES_BOOTSTRAP_URL` and a deprecated `loadLabConfig` export in the same file suggest the author started from a Hermes “lab” project and renamed it for the LeadStack lure.\n\n## Installing the agent out of sight\n\nThe script installs the agent into `~/.leadstack/runtime` with a second, nested `npm install`. It runs that install with logging set to silent, audit and funding messages off, and engine checks disabled, so nothing about Hermes reaches the user’s terminal.\n\nIt then prepares the Telegram gateway and sets the model.\n\n[`hermes-agent`(opens in new tab)](https://www.npmjs.com/package/hermes-agent) on npm is an unofficial wrapper around Nous Research’s Hermes Agent. The npm user `wyrtensi` maintains it and publishes it from GitHub Actions. Version 0.22.7 came out on 4 November 2026. Nothing points to the wrapper or to Hermes Agent being malicious. `@leadstack/crm-connect` uses them the way an administrator would, without asking the owner of the machine.\n\n## Persistence as a systemd service\n\nWith Hermes Agent in place, the script registers its gateway as a system service.\n\nHermes Agent does not install its gateway as a root service by default. Its installer stops with “Refusing to install the gateway system service as root; pass —run-as-user root to override (e.g. in LXC containers)” ([`hermes_cli/gateway.py`(opens in new tab)](https://github.com/NousResearch/hermes-agent/blob/b200f5bc60e31588ba2cb60e288029c4a54ba5fa/hermes_cli/gateway.py#L2737-L2744)). The package passes that flag. The unit Hermes writes has `Restart=always` and `WantedBy=multi-user.target`, so the agent starts at boot and comes back if something kills it.\n\nAfter the agent connects to Telegram, the script renames the unit.\n\nThe script names the copy `leadstack-routing.service` and deletes the original `hermes-gateway` unit, so `systemctl status` shows a CRM daemon.\n\nNo version calls `sudo` or tries to escalate privileges. Version 1.0.15 assumes `npm install` already runs as root, which is common on servers and with `sudo npm install`. As a normal user, writing to `/etc/systemd/system` fails, the script exits with an error, and `npm install` fails with it. By then the agent, its `.env` and its `SOUL.md` are already on disk. Version 1.0.18, published about an hour later, handles the normal user. It installs a user-level service and turns on linger, which keeps the user’s services running after logout and starts them at boot.\n\nSome distributions require admin rights to enable linger. If the system refuses the call, the script carries on quietly, and the service runs only while the user stays logged in.\n\n## Waiting for the agent to connect\n\nThe install does not finish until the agent is online. The script starts the service and reads its journal every three seconds, for up to three minutes, looking for the line Hermes Agent logs when its Telegram adapter connects. If the line has not appeared after 22 seconds, it restarts the service once.\n\nThen it prints a status report.\n\nEvery line on that list describes CRM work. The steps behind them installed an agent, gave it the attacker’s keys and connected it to the attacker’s Telegram bot.\n\n## What the attacker gets\n\nA Telegram chat with Hermes Agent gets the same toolset as its command line, according to the [toolsets reference(opens in new tab)](https://hermes-agent.nousresearch.com/docs/reference/toolsets-reference).\n\n| Capability | Hermes Agent tools | \n|---|---|\n| Shell commands on the server | `terminal` ,`process_manage` | \n| Read and change files | `read_file` ,`write_file` ,`patch` ,`search_files` | \n| Web and browser | `web_search` ,`web_extract` ,`browser_*` | \n| Run code | `execute_code` | \n| Scheduled jobs | `cronjob_manage` | \n| Hand work to sub-agents | `delegate_task` | \n\nCommands that Hermes treats as dangerous wait for approval in the chat. By default, any member allowed into the chat can approve them, and the attacker is that member. `HERMES_YOLO_MODE=1` in the `.env` would remove the prompts altogether, apart from a fixed blocklist. Whether the attacker’s `.env` sets it is not known.\n\nThreatDown described the same use of Hermes Agent in its [Carbonato report(opens in new tab)](https://www.threatdown.com/blog/carbonato/) in September 2026. That botnet spreads through Docker APIs left open on port 2375, installs Hermes Agent unchanged, overwrites its `SOUL.md` and takes tasks over Telegram. `@leadstack/crm-connect` reaches its targets through `npm install` instead and downloads the persona during the install, so the attacker can change the agent’s instructions and keys without publishing a new version.\n\n## How delivery changed across nine versions\n\nThe server stayed the same across all nine versions. The way the package reached it kept changing.\n\n| Version | Published (UTC) | Trigger | What runs | Server | \n|---|---|---|---|---|\n| 1.0.15 | 09:44 | postinstall | Hermes Agent as a system service | 72[.]62[.]1[.]108:3000 | \n| 1.0.18 | 10:42 | First call to `sdkVersion()` or`pingPartnerApi()` | Hermes Agent, user service with linger when not root | `api.leadstack.io` (does not resolve) | \n| 1.0.19 | 10:56 | `pingPartnerApi()` after a successful health check | JavaScript module downloaded and run detached | `api.leadstack.io` (does not resolve) | \n| 1.0.20 | 11:14 | postinstall named `npm-cache-warm.js` | Same module | 72-62-1-108[.]sslip[.]io | \n| 1.0.21 | 11:14 | postinstall | Same module | 72[.]62[.]1[.]108 | \n| 1.0.29 | 14:55 | postinstall | Binary downloaded and run | `api.leadstack.io` (does not resolve) | \n| 1.0.30 | 15:04 | postinstall | Same binary | 72[.]62[.]1[.]108 | \n| 1.1.0, 1.1.1 | 15:24, 15:27 | postinstall | Platform package `@leadstack/crm-connector-linux-x64` , run with`node` | none (package never published) | \n\nFrom 1.0.19 on, the tarball holds no agent code. It runs code fetched at install or run time, with the full environment of the process that loaded it. SafeDep did not recover those downloads. Some comments read like answers to a reviewer. 1.0.19 describes `sdkVersion()` as having “no side effects (safe for CI lockfile checks)”, and its README says the package “does not ship long-running worker code in the tarball”. Both statements are true. The worker code arrives from the server.\n\n## Who the package targets\n\nThe READMEs speak to engineers wiring a CRM into server-side code. Version 1.0.15 calls itself a “partner connector for server-side lead ingest, affiliate attribution, and platform sync”. Version 1.0.18 says to install it “in the same Node project as your ingest API or webhook worker”. It also asks for a dedicated OS user, because “this matches how LeadStack stages CRM credentials”.\n\nThe payload fits that audience. A systemd service, linger and a seven-day re-run lock make sense on a Linux server that stays up for months. On a throwaway CI runner they achieve nothing. Version 1.0.19 even keeps `sdkVersion()` free of side effects so CI checks do not set it off. In 1.0.18 the payload starts on the first SDK call. It then runs inside the CRM application’s own process and inherits its environment, including any CRM credentials.\n\nThe lure the same publisher used on 18 November names the sector. A guide on its new domain addresses “integration engineers at our CRM / broker-desk partners” of “a network of trading brands”. That is the vocabulary of forex and contract-for-difference (CFD) brokerages. The likely aim is the CRM credentials and lead data on those servers. SafeDep infers that from the lures and the payload design and has not observed it on a victim.\n\n## The same publisher is still active\n\nOn 18 November someone registered `zmaticco[.]dev`, a lookalike of the ad-tech company zMaticoo, which has no connection to this activity. The domain resolves to 72[.]62[.]1[.]108, the same server. That evening `zmaticoo` published `@zmatdspcrm/trading-connector`, `@zmatdspcrm/brandnet-connect` and `brandnet-connect`. None of them has an install script or malicious code in its tarball. Each declares one optional dependency.\n\nnpm downloads that tarball on every fresh install and runs any install script it contains. On 19 November the server returned a harmless token validator. The attacker can replace it at any time without publishing anything to npm. A PDF on the same domain walks integration engineers through `npm install brandnet-connect` on “a staging or integration host”. All three packages were still on npm on 19 November.\n\n## Check your servers\n\nLook for the agent’s files and the renamed units. On a root install the home directory is `/root`.\n\nSearch lockfiles for the packages and the remote dependency.\n\nIn network logs, look for connections to 72[.]62[.]1[.]108 and `zmaticco[.]dev`, and for servers that long-poll `api.telegram.org` or call the Moonshot API at `api.moonshot.ai` without a reason to.\n\nTreat a server that installed any of these versions as root as fully compromised. Rebuild it rather than cleaning it, and rotate every credential the server or the application’s environment could reach. A non-root install ran the agent with the installing user’s rights. If that user runs the application, the agent could read the application’s secrets.\n\n## Indicators of compromise\n\n| Row | type | value | package | context | first_seen_utc | \n|---|---|---|---|---|---|\n| 1 | npm_package_version | @leadstack/crm-connect@1.0.15 | @leadstack/crm-connect | Postinstall installs Hermes Agent and its Telegram gateway as a root systemd service; removed from npm | 2026-11-16T09:44:36Z | \n| 2 | npm_package_version | @leadstack/crm-connect@1.0.18 | @leadstack/crm-connect | Same agent install on first SDK call; user service with linger when not root; C2 host does not resolve | 2026-11-16T10:42:24Z | \n| 3 | npm_package_version | @leadstack/crm-connect@1.0.19 | @leadstack/crm-connect | Downloads and runs a JS module after a successful health check; C2 host does not resolve | 2026-11-16T10:56:33Z | \n| 4 | npm_package_version | @leadstack/crm-connect@1.0.20 | @leadstack/crm-connect | Postinstall downloads and runs a detached JS module from 72-62-1-108[.]sslip[.]io | 2026-11-16T11:14:07Z | \n| 5 | npm_package_version | @leadstack/crm-connect@1.0.21 | @leadstack/crm-connect | Postinstall downloads and runs a detached JS module from 72[.]62[.]1[.]108 | 2026-11-16T11:14:30Z | \n| 6 | npm_package_version | @leadstack/crm-connect@1.0.29 | @leadstack/crm-connect | Postinstall downloads and runs a binary; C2 host does not resolve | 2026-11-16T14:55:53Z | \n| 7 | npm_package_version | @leadstack/crm-connect@1.0.30 | @leadstack/crm-connect | Postinstall downloads and runs a binary from 72[.]62[.]1[.]108 | 2026-11-16T15:04:31Z | \n| 8 | npm_package_version | @leadstack/crm-connect@1.1.0 | @leadstack/crm-connect | Postinstall runs an unpublished platform package with the full environment | 2026-11-16T15:24:09Z | \n| 9 | npm_package_version | @leadstack/crm-connect@1.1.1 | @leadstack/crm-connect | Same as 1.1.0 with a new pinned hash | 2026-11-16T15:27:57Z | \n| 10 | npm_package_version | @zmatdspcrm/trading-connector@1.0.0 | @zmatdspcrm/trading-connector | Optional dependency fetched from zmaticco[.]dev; no install scripts | 2026-11-18T18:28:21Z | \n| 11 | npm_package_version | @zmatdspcrm/trading-connector@1.0.1 | @zmatdspcrm/trading-connector | Optional dependency fetched from zmaticco[.]dev; no install scripts | 2026-11-18T18:31:33Z | \n| 12 | npm_package_version | @zmatdspcrm/brandnet-connect@1.0.0 | @zmatdspcrm/brandnet-connect | Optional dependency fetched from zmaticco[.]dev; no install scripts | 2026-11-18T18:33:58Z | \n| 13 | npm_package_version | brandnet-connect@1.0.0 | brandnet-connect | Optional dependency fetched from zmaticco[.]dev; no install scripts | 2026-11-18T18:36:25Z | \n| 14 | npm_package_version | brandnet-connect@1.0.1 | brandnet-connect | Optional dependency fetched from zmaticco[.]dev; no install scripts | 2026-11-18T18:49:31Z | \n| 15 | sha256 | 29559f042f81c7a6cc642173eab09b0b02e369f47b594b68c78028ef2df10e4c | @leadstack/crm-connect | crm-connect-1.0.15.tgz | 2026-11-16T09:44:36Z | \n| 16 | sha256 | 8cd56c6a036ae6d08cc07e64f98a3af7d836204d7620203bee5b8fd7d6931757 | @leadstack/crm-connect | crm-connect-1.0.18.tgz | 2026-11-16T10:42:24Z | \n| 17 | sha256 | 3083068c322829c9840f0931f7adfb39b8357d0d8a074d7f1967174631443154 | @leadstack/crm-connect | crm-connect-1.0.19.tgz | 2026-11-16T10:56:33Z | \n| 18 | sha256 | ce1812a6e1a5bc99cc705e44b10ae476324ea7930616508a11cc3173934e1abb | @leadstack/crm-connect | crm-connect-1.0.20.tgz | 2026-11-16T11:14:07Z | \n| 19 | sha256 | d95fad3aea003d6b53645daa8d724ac32e4b2e25e6e4c71264fdb15f8b8b3adb | @leadstack/crm-connect | crm-connect-1.0.21.tgz | 2026-11-16T11:14:30Z | \n| 20 | sha256 | 8a2f9a526955a07b183c3f3658d2088eb4c8c66d3fcaf8fb91322944b82e6e92 | @leadstack/crm-connect | crm-connect-1.0.29.tgz | 2026-11-16T14:55:53Z | \n\n## MITRE ATT&CK mapping\n\n| Technique | ID | Where it appears | \n|---|---|---|\n| Supply Chain Compromise: Compromise Software Supply Chain | T1195.002 | Malicious packages published to npm | \n| Command and Scripting Interpreter: JavaScript | T1059.007 | postinstall scripts and loaders | \n| Ingress Tool Transfer | T1105 | `hermes-agent` install, downloaded module and binary | \n| Create or Modify System Process: Systemd Service | T1543.002 | Hermes gateway installed as a system or user service | \n| Masquerading: Masquerade Task or Service | T1036.004 | Unit renamed to `leadstack-routing.service` | \n| Web Service: Bidirectional Communication | T1102.002 | Telegram bot used to task the agent | \n\n## References\n\n- supply-chain\n- npm\n- malware\n- ai-agents\n- backdoor\n- threat-intel", "url": "https://wpnews.pro/news/malicious-npm-package-turns-hermes-agent-into-a-backdoor", "canonical_source": "https://safedep.io/blog/malicious-npm-leadstack-crm-connect-hermes-agent-backdoor", "published_at": "2026-11-19 00:00:00+00:00", "updated_at": "2026-11-19 19:44:07.601554+00:00", "lang": "en", "topics": ["ai-agents", "ai-safety", "developer-tools"], "entities": ["@leadstack/crm-connect", "Hermes Agent", "Nous Research", "SafeDep", "ThreatDown", "npm", "zmaticoo", "LeadStack"], "also_reported_by": [], "takeaway": "A postinstall script in @leadstack/crm-connect 1.0.15 installed Hermes Agent, pulled its .env and SOUL.md from 72[.]62[.]1[.]108 and registered it as a root systemd service wired to an attacker's Telegram bot, so npm installs that run as root hand over shell, file and browser control.", "recommendation": {"advice": "Audit postinstall scripts and avoid running npm install as root, since @leadstack/crm-connect used root install to register Hermes Agent as a persistent systemd service controlled via Telegram.", "playbook": "agent-security", "playbook_url": "https://wpnews.pro/playbooks/agent-security"}, "alternates": {"html": "https://wpnews.pro/news/malicious-npm-package-turns-hermes-agent-into-a-backdoor", "markdown": "https://wpnews.pro/news/malicious-npm-package-turns-hermes-agent-into-a-backdoor.md", "text": "https://wpnews.pro/news/malicious-npm-package-turns-hermes-agent-into-a-backdoor.txt", "jsonld": "https://wpnews.pro/news/malicious-npm-package-turns-hermes-agent-into-a-backdoor.jsonld"}}