Discord-Stealing Malware Invades npm Packages

cursedgrabber discord malware npm

The CursedGrabber malware has infiltrated the open-source software code repository.

UPDATE

Three malicious software packages have been published to npm, a code repository for JavaScript developers to share and reuse code blocks. The packages represent a supply-chain threat given that they may be used as building blocks in various web applications; any applications corrupted by the code can steal tokens and other information from Discord users, researchers said.

Discord is designed for creating communities on the web, called “servers,” either as standalone forums or as part of another website. Users communicate with voice calls, video calls, text messaging, media and files. Discord “bots” are central to its function; these are AIs that can be programmed to moderate discussion forums, welcome and guide new members, police rule-breakers and perform community outreach. They’re also used to add features to the server, such as music, games, polls, prizes and more.

Discord tokens are used inside bot code to send commands back and forth to the Discord API, which in turn controls bot actions. If a Discord token is stolen, it would allow an attacker to hack the server.

2020 Reader Survey: Share Your Feedback to Help Us Improve

The packages (named an0n-chat-lib, discord-fix and sonatype, all published by “scp173-deleted”) have been taken down, though it’s unknown how many developers used them before they were removed. Sonatype told Threatpost that the user’s profile has been deleted and all packages have been replaced with placeholders, to ensure bad actors cannot resurface malware under those names.

While “an0n-chat-lib” had no legitimate “twin” package, the other two made use of brandjacking and typosquatting to lure developers into thinking they’re legitimate.

The “discord-fix” malicious component is similarly named to the legitimate “discord-XP,” an XP framework for Discord bots, and uses MongoDB. The “sonatype” package is meanwhile made use of pure brandjacking.

There is also “clear evidence that the malware campaign was using a Discord bot to generate fake download counts for the packages to make them appear more popular to potential users,” according to researchers at Sonatype.

The authors are the same operators behind the CursedGrabber Discord malware,  the researchers said, and the packages share DNA with that threat. “The malware is similar, but with slight variations added to attempt avoiding detection,” Sonatype told Threatpost.

The CursedGrabber Discord malware family, discovered in November, targets Windows hosts. It contains two .exe files which are invoked and executed via ‘postinstall’ scripts from the manifest file, ‘package.json’. One of the .exe files scans user profiles from multiple web browsers along with Discord leveldb files, steals Discord tokens, steals credit-card information, and sends user data via a webhook to the attacker. The second unpacks additional code with multiple capabilities, including privilege escalation, keylogging, taking screenshots, planting backdoors, accessing webcams and so on.

In the case of the three npm packages, these “contain variations of Discord token-stealing code from the Discord malware discovered by Sonatype on numerous occasions,” said Sonatype security researcher Ax Sharma, in a Friday blog posting.

Open-Source Software Repository Malware

Uploading malicious packages to code repositories is an increasingly common tactic used by malware operators. In December for instance, RubyGems, an open-source package repository and manager for the Ruby web programming language, had to take two of its software packages offline after they were found to be laced with malware.

The gems contained malware that ran itself persistently on infected Windows machines and replaced any Bitcoin or cryptocurrency wallet address it found on the user’s clipboard with the attacker’s. So, if a user of a corrupted web app built using the gems were to copy-paste a Bitcoin recipient wallet address somewhere on their system, the address would be replaced with that of the attacker.

“We have repeatedly seen…open-source malware striking GitHubnpm and RubyGems, attackers can exploit trust within the open-source community to deliver pretty much anything malicious, from sophisticated spying trojans like njRAT, to…CursedGrabber,” Sharma told Threatpost.

The latest findings reiterate that software supply-chain attacks will only become more common and underscore how crucial it is for organizations that protect against such attacks and continuously improve their strategies against them, according to Sonatype.

This post was updated to reflect that the packages are no longer available for download.

Download our exclusive FREE Threatpost Insider eBook Healthcare Security Woes Balloon in a Covid-Era World, sponsored by ZeroNorth, to learn more about what these security risks mean for hospitals at the day-to-day level and how healthcare security teams can implement best practices to protect providers and patients. Get the whole story and DOWNLOAD the eBook now – on us!

 

Suggested articles

Discussion

  • Darryl Miles on

    Not a single comment in article on how to disable npm postinstall hooks. Like the issues with Java runtime forcing a browser plugin on its users by default back in the nougthies. NPM should seriously rework that feature to notify the user when a package requests its use, explan why it needs it, what it's going to run and at the very least require user confirmation.

Leave A Comment

 

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Subscribe to our newsletter, Threatpost Today!

Get the latest breaking news delivered daily to your inbox.