High impactSecurityNo patch yet

grammy-tools 1.36.3 on npm plants an SSH key when a bot is constructed

A trojanized copy of the grammY Telegram bot framework runs its payload at bot construction, not install time, and leaves an SSH backdoor that survives uninstalling the package.

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

grammy-tools@1.36.3 is malware, and no patched version exists. Any Linux host that constructed a grammY Bot from this package may have an attacker-controlled SSH key in ~/.ssh/authorized_keys, and that key stays after the package is removed. Remove the dependency, then audit authorized_keys for an entry tagged 'sshconf' on every machine that ran the code.

What happened

The GitHub Advisory Database published GHSA-7v82-5337-jwh5 on 3 December 2026. It flags the npm package grammy-tools version 1.36.3 as malware. The advisory is rated critical with CWE-506 (Embedded Malicious Code). The finding is credited to Amazon Inspector via the OpenSSF malicious-packages entry MAL-2026-21079.

According to the advisory:

  • What the package is. grammy-tools@1.36.3 is a copy of the grammY Telegram bot framework with code injected into out/bot.js.
  • How it triggers. An internal function, addBotId(), runs unconditionally from the Bot constructor. Constructing a bot is enough to trigger it.
  • What it does on Linux. It creates ~/.ssh if it is missing. It then appends a hardcoded attacker-controlled ssh-rsa public key, with the comment sshconf, to ~/.ssh/authorized_keys. This grants persistent remote SSH login.
  • What it sends. It looks up the host's public IP via ipinfo.io. It then sends the IP, the OS username and the platform string over HTTPS to grammy.validator.blog on Linux, or to grammy.validator.icu on other platforms. Errors are silently swallowed.
  • How it disguises itself. Its metadata copies the legitimate project's description, author and homepage (grammy.dev).
  • Fix status. No patched version exists. The advisory states that the package is malware and has no patched versions.

Why it matters

Two details change the remediation for this package.

The payload runs at runtime, not at install. The trigger is the Bot constructor, not a preinstall or postinstall script. That means npm install --ignore-scripts, install-hook scanners and sandboxed install steps give no protection. The code runs wherever the application runs:

  • developer laptops;
  • CI jobs that run tests constructing a bot;
  • staging environments;
  • production.

It leaves persistence behind. The SSH key is written to disk. Removing grammy-tools from package.json and the lockfile stops future runs, but it does nothing about a key that has already been appended. Where a malicious package acts only at install time or leaves no persistence, removal can be enough; here it is only the first step.

The disguise is aimed at grammY users. Because the metadata mirrors grammy.dev, a developer skimming a package page could mistake it for an official add-on. The teams at risk are those building Telegram bots in Node.js, including internal ops and notification bots, which may receive less review than customer-facing services.

What the advisory does not say. It does not report how many people installed the package, or whether the planted key has been used against anyone.

Engineering assessment

Our assessment: for affected teams this is a host-compromise incident, not a dependency bump. The severity is justified; real exposure depends on whether the code ran on Linux hosts with reachable, key-accepting SSH, and install counts are not reported.

What the planted key does and does not give the attacker. The key lands in the home directory of whichever user runs the Node process. It gives the attacker access only if three things are true:

  • that host runs an SSH server;
  • the server is reachable by the attacker;
  • the server accepts public-key login for that user.

That combination is common on cloud VMs and self-managed Linux servers. It is less common on developer laptops and short-lived containers.

Containers are not automatically safe. Ephemeral containers without SSH limit the persistence. However, the exfiltration request still tells the attacker which hosts, users and public IPs ran the code. And if a home directory is mounted from a persistent volume, the key survives the container being recycled.

If the process ran as root, assume the worst. The key would land in root's authorized_keys. Treat that host as fully compromised.

Signals to look for. The advisory and the OpenSSF record give defenders concrete markers:

  • the sshconf key comment;
  • two attacker domains;
  • the ipinfo.io lookup;
  • file hashes for out/bot.js and the tarball, published in the OpenSSF record.

Outbound DNS or proxy logs showing grammy.validator.blog or grammy.validator.icu are a strong signal that the code executed on that host.

What the advisory leaves out. It contains no remediation guidance beyond the absence of a fixed version. It says nothing about removing the key, rotating credentials, or what else an attacker with SSH access might have touched.

Once an attacker has shell access through that key, anything readable by that user should be treated as exposed, including environment files, Telegram bot tokens and cloud credentials. The advisory does not say this happened. It is the reasonable assumption for any host where the key was present and SSH was reachable.

What this changes in standing practice. In the desk's view, --ignore-scripts is useful supply-chain hardening but not sufficient. Runtime-triggered malware like this needs dependency allow-listing and egress controls as well as install-time controls.

Is this you?

  • Does any package.json or lockfile in your organisation reference grammy-tools? Version 1.36.3 is the only version listed as affected.
  • Did any code construct a grammY Bot from that package — in tests, CI, local development or production?
  • Did that code run on Linux? If so, the SSH-key step applies. On other platforms the advisory describes only the data-sending request.
  • Does that Linux host run an SSH server that accepts key-based login and is reachable from outside?
  • Did the Node process run as root, or as a user whose home directory persists across deployments?
  • Do your DNS, proxy or firewall logs show requests to grammy.validator.blog, grammy.validator.icu, or unexpected ipinfo.io lookups from application hosts?

What to do

There is no version to upgrade to. None of the following steps come from the advisory, which contains no remediation guidance. Not vendor guidance.

1. Find every reference.

  • Run npm ls grammy-tools in each Node project.
  • Search repositories and lockfiles for grammy-tools.
  • Also search lockfiles for the tarball integrity value published in the OpenSSF record: sha512-04GZMoVjc9FbZmG9fFx9A/dQ7uUJWrdHx9X/yyxLBzqEDiN4emUSFiPU37YCGFPcr01M7FH8UX0pHegDsgxh1A==.

2. Remove the package.

  • Remove grammy-tools and regenerate lockfiles.
  • If you need grammY, take it from the project documented at grammy.dev, and check the package name against that documentation rather than npm metadata, which this package copied.

3. Audit SSH keys on every host that ran the code.

  • Check ~/.ssh/authorized_keys for every account that ran the Node process, including root. For example: grep -n sshconf ~/.ssh/authorized_keys.
  • Remove any unrecognised ssh-rsa entry, especially one tagged sshconf.
  • Check whether ~/.ssh was created recently on accounts that never had it.

4. Check for evidence of SSH access.

  • Review SSH authentication logs on affected hosts for logins using unfamiliar keys.
  • If access is found, or cannot be ruled out, handle it as an incident and rebuild the host from a known-good image.

5. Rotate secrets readable by the affected user on hosts where the key was present and SSH was reachable: Telegram bot tokens, API keys, database and cloud credentials.

6. Block the attacker domains. Block grammy.validator.blog and grammy.validator.icu at egress, and search historical logs for both to find hosts that executed the payload.

7. Plan longer-term controls. Technical leads should treat install-script blocking as insufficient on its own and add:

  • review gates for new dependencies;
  • default-deny egress for build and application hosts;
  • a policy that application processes never run as root.

What we don't know yet

  • How many times grammy-tools@1.36.3 was installed, and whether it is still available on npm.
  • Whether the code does anything on non-Linux platforms beyond the HTTPS request to grammy.validator.icu.
  • Whether the injected key has been used against any host. The evidence gives no exploitation status.
  • Whether the same actor published other versions or other packages.
  • Whether any official remediation guidance will follow, such as key removal or credential rotation.

The desk will track the advisory and the OpenSSF record for added versions or related packages, and will report material changes on the Engineering Desk news page.

Sources

Latest engineering analysis