eslint-scope 3.7.2 and eslint-config-eslint 5.0.2 on npm ran code from a website and sent npm tokens to an attacker on 12 July 2018.
The bad versions were live from 9:49 UTC to 12:37 UTC, about three hours. Version 3.7.1 was clean.
What happened
An attacker used the npm account of an ESLint maintainer. The maintainer had reused the npm password and had no two-factor authentication.
- The attacker found the password in a third-party breach and created an authentication token.
- The attacker published both packages with a malicious
postinstallscript. - The script downloaded code from pastebin.com and ran it.
- That code sent the contents of the user's
.npmrcfile to the attacker. - The GitHub advisory says it sent tokens to two remote servers.
npm revoked all tokens issued before 12:30 UTC on 12 July 2018. Version 3.7.3 of eslint-scope replaced the bad release.
Affected versions
eslint-scope3.7.2 (patched: 3.7.3).eslint-config-eslint5.0.2 (patched: 6.0.0), and earlier according to the advisory.- A machine is exposed if it fetched 3.7.2 in the three-hour window.
Indicators of compromise
- A
postinstallscript in thepackage.jsonofeslint-scope3.7.2. - A
lib/build.jsfile that fetches code from pastebin.com. - A read of
~/.npmrcduring install. - An install between 9:49 and 12:37 UTC on 12 July 2018.
How to check
List the installed version.
npm ls eslint-scope eslint-config-eslint
Search lockfiles for the bad version.
grep -rn -A1 '"eslint-scope"' package-lock.json | grep 3.7.2
What to do now
- Update
eslint-scopeto 3.7.3 andeslint-config-eslintto 6.0.0 or later. - Revoke all npm tokens that were on any machine that installed the bad version, and create new ones.
- Check the packages you publish for versions you did not release.
- Use a unique password and turn on two-factor authentication for npm.
What Vigilance would show
These examples show an install hold and the corresponding owner report.
Example install message
Vigilance blocked `eslint-scope` 3.7.2. This version is too new or changed in a way Vigilance must check first.
Example owner report
Bad update
eslint-scope 3.7.2
Installing it now reached out to a website, ran whatever code it found there, and mailed off publishing keys.
No security team? See who reads the alert.
Frequently asked questions
Which eslint-scope version was malicious?
Version 3.7.2, along with eslint-config-eslint 5.0.2. Version 3.7.3 is the clean replacement.
How did the eslint-scope attack happen?
An attacker used a maintainer's reused password, found in another breach, to publish packages with a postinstall script that stole npm tokens.
Sources
Send this page to the person who looks after AI at your company.