MAL-2026-21079: Malicious code in grammy-tools (npm)
--- -= Per source details. Do not edit below this line.=-
Source: amazon-inspector (d5870674dd6e0d3e174cc4f50ab60ae364830b6a08a9bfd9387f1977529dbec9) grammy-tools@1.36.3 is a copy of the grammY Telegram bot framework with injected code in out/bot.js. An internal function addBotId() is invoked unconditionally from the Bot constructor, so merely constructing a bot triggers it. On Linux it creates ~/.ssh if missing and appends a hardcoded attacker-controlled ssh-rsa public key (comment 'sshconf') to ~/.ssh/authorizedkeys, granting persistent remote SSH login to the installer's host. The same function retrieves the host's public IP from ipinfo.io and then issues an HTTPS request carrying the IP address, the OS username from os.userInfo() and the platform string to grammy.validator.blog (Linux) or grammy.validator.icu (other platforms), with errors silently swallowed. Package metadata copies the legitimate project's description, author and homepage (grammy.dev) while the shipped code differs, presenting the trojanized library as the real framework.
Affected Software
Event History
Frequently Asked Questions
What systems are most directly exposed to persistent access?
Linux hosts where an application constructs a bot using grammy-tools@1.36.3 are most directly exposed. The injected code creates ~/.ssh if needed and adds an attacker-controlled public key to ~/.ssh/authorized_keys for the account running the application.
Does exploitation require a bot to connect to Telegram or process messages?
No. The malicious addBotId() function is invoked unconditionally by the Bot constructor, so constructing a bot is sufficient to trigger it.
What should be checked if this package may have run?
Inspect the running account's ~/.ssh/authorized_keys for an unexpected ssh-rsa key with the comment "sshconf". Also treat the host's public IP address, OS username, and platform information as potentially disclosed to the listed validator domains.
What can be done if the affected package cannot be removed immediately?
Prevent code paths from constructing a Bot instance on affected hosts, because construction triggers the malicious function. Remove the unauthorized SSH key from the relevant account's authorized_keys and review access to the host.