Malicious NPM packages target Amazon, Slack with new dependency attacks

Posted by & filed under Security Alerts.

Threat actors are targeting Amazon, Zillow, Lyft, and Slack NodeJS apps using a new ‘Dependency Confusion’ vulnerability to steal Linux/Unix password files and open reverse shells back to the attackers.

Last month, BleepingComputer reported that security researcher Alex Birsan earned bug bounties from 35 companies by utilizing a new flaw in open-source development tools.

This flaw works by attackers creating packages utilizing the same names as a company’s internal repositories or components. When hosted on public repositories, including npm, PyPI, and RubyGems, dependency managers would use the packages on the public repo rather than the company’s internal packages when building the application.

This “dependency confusion” would allow an attacker to inject their own malicious code into an internal application in a supply-chain attack.

Threat actors begin using dependency confusion

Since our report, BleepingComputer has been waiting for malicious actors to utilize this new vulnerability to deliver malicious packages.

While we have seen numerous security researchers impersonate Birsan’s work by creating harmless PoCs to earn bug bounties, we had not seen any malicious activities.

That is until today when open-source security firm Sonatype discovered malicious packages targeting applications related to Amazon, Zillow, Lyft, and Slack to steal passwords and open remote shells.

“I was starting to wonder when we were going to see a malicious actor take advantage of the current situation. Finally, we’ve spotted one.”

“There is no scenario I can imagine where I’m going to submit a PoC for a bug bounty program that actually harms the organization. Taking their /etc/shadow file is definitely harmful,” said Sonatype security researcher Juan Aguirre in a new report.

These malicious packages are named ‘amzn’, ‘zg-rentals’, ‘lyft-dataset-sdk’, ‘serverless-slack-app’ and utilize similar names as known repositories on GitHub [12] and other projects.

When the threat actors created their malicious NPMs, they used Birsan’s original PoCs as a template but added malicious code.

“They start out with pretty much the same code base as the PoC released by researcher Alex Birsan and they gradually start getting creative,” Aguirre explains.

For example, the ‘amzn’ and ‘zg-rentals’ NPM packages will not only steal the /etc/shadows password file (line 5 below) and send it back to the attackers (line 42) but also open up a remote shell (line 26), giving the threat actors full access to the system.

Malicious amzn package


The ‘lyft-dataset-sdk’ and ‘serverless-slack-app’ appear to be from a different author, and instead steal a Linux profiles .bash_history file and sends it to a remote host under the attacker’s control.


serverless-slack-app stealing .bash_history file


You may be wondering why an attacker would want to steal a .bash_history file?

As the history file contains a list of all the commands you typed in the shell, including passwords passed as arguments, stealing the .bash_history file is a known technique used by attackers to harvest credentials.

With the open and public nature of repositories and the ease of creating dependency confusion attacks, we should expect to see this type of attack continue until application developers secure their configuration files.

Microsoft has created a white paper titled “3 Ways to Mitigate Risk When Using Private Package Feeds” that provides tips on preventing these types of supply-chain attacks.

Sonatype also created a script that Nexus Repository Manager users can use to check if their private dependencies are named after existing packages on public repositories.


The information contained in this website is for general information purposes only. The information is gathered from BLEEPING COMPUTER, while we endeavour to keep the information up to date and correct, we make no representations or warranties of any kind, express or implied, about the completeness, accuracy, reliability, suitability or availability with respect to the website or the information, products, services, or related graphics contained on the website for any purpose. Any reliance you place on such information is therefore strictly at your own risk. Through this website, you are able to link to other websites which are not under the control of CSIRT-CY. We have no control over the nature, content and availability of those sites. The inclusion of any links does not necessarily imply a recommendation or endorse the views expressed within them. Every effort is made to keep the website up and running smoothly. However, CSIRT-CY takes no responsibility for, and will not be liable for, the website being temporarily unavailable due to technical issues beyond our control.