npm
Image: npm

Four JavaScript npm packages contained malicious code that collected user details and uploaded the information to a public GitHub page.

The four packages where this malicious code was identified included:

  • electorn: 255 downloads
  • lodashs: 78 downloads
  • loadyaml: 48 downloads
  • loadyml: 37 downloads

All four packages were developed by the same user (simplelive12) and uploaded on the npm portal in August. Two packages (lodashsloadyml) were removed by the author shortly after publication, but not before they infected some users.

The remainder packages, electorn and loadyaml, were removed last week, on October 1, by the npm security team following a report from Sonatype[1], a company that monitors public package repositories as part of its developer security operations (DevSecOps) services.

According to Sonatype security researcher Ax Sharma[2], the four malicious packages used a technique known as typosquatting[3] to get installs.

All four were misspellings of more popular packages, and they relied on users making mistakes when typing the name of a popular package in order to weasel their way inside someone's codebase.

But once a developer mistakenly included and installed one of the four malicious packages, the malicious code found inside would collect the developer's IP address, country, city, computer username, home directory path, and CPU model information and post this information as a new comment inside the "Issues" section of a GitHub repository.

npm-github-malware.png
Image: Sonatype

Sharma said the data wouldn't stay on GitHub for long and would be purged every 24 hours — most likely after being scraped and indexed inside another database.

While we may never know what was the end goal of this campaign, it is very likely that we're looking at a reconnaissance operation.

Information like

Read more from our friends at ZDNet