From package to postinstall payload: Inside the Mastra npm supply chain compromise
A compromised account published malicious versions of over 140 packages, which were removed after the attacker's access was revoked.
Overview
Microsoft Threat IntelligenceCollected evidence about attacker groups, their tools, and the servers or domains they use found a large-scale attack on the npm registryA central database of system settings on a computer or a public catalog that hosts software packages that affected more than 140 packages in the mastra and @mastra scopes. The attacker took over the ehindero npm account to publish poisoned versions of these packages. These versions included a malicious dependencyAn external code library or package that a software project relies on to do part of its work called easy-day-js, which is a fake version of the popular dayjs library. When developers installed the packages, the malicious code ran automatically and contacted attacker-controlled serversA computer or program on a network that stores data and responds to requests from client devices to download more harmful software. This attack put developer workstations and automated build systems at risk of losing credentialsThe login details, such as a username and password or key, that prove who an account belongs to and tokensA short-lived digital pass that a server gives a logged-in user or app. Any system that ran the install command after the bad versions were published was potentially exposed.
Terms in this story
- threat intelligence
- Collected evidence about attacker groups, their tools, and the servers or domains they use. Security teams share threat intelligence such as known malicious IP addresses and file hashes so other organizations can block the same attack before it hits them. Security+ objective 4.3 lists the term
- registry
- A central database of system settings on a computer or a public catalog that hosts software packages. In security news, the registry means either the operating system settings database where malware adds startup entries or a public package registry where developers download code libraries.
- dependency
- An external code library or package that a software project relies on to do part of its work. When a popular open-source dependency has a security bug or gets hijacked by an attacker, every application that imports that package inherits the risk.
- server
- A computer or program on a network that stores data and responds to requests from client devices. Online stores, email systems, and multiplayer games all run on servers in data centers or the cloud, making unpatched servers a primary target for intruders.
- credentials
- The login details, such as a username and password or key, that prove who an account belongs to. Many breaches begin when attackers steal an employee's login credentials through a fake website and sign in to the company network as if they belonged there. Security+ objective 4.6 lists the term
- tokens
- A short-lived digital pass that a server gives a logged-in user or app. After you sign in once, your browser or app presents a token on each request, and if malware steals that token the attacker can act as you without knowing your password. Security+ objective 4.6 lists the term
- payload
- The part of an attack or malware file that carries out the harmful action on the target. A phishing email and an exploit are only the delivery steps, while the payload is the ransomware or spyware that actually runs once the computer is compromised.
- supply chain compromise
- Breaking into a software maker or vendor so their trusted product or update infects their customers. Instead of attacking a hundred companies one by one, an intruder compromises a single software library or update server that all of those companies already trust. Security+ objective 2.2 lists the term
- npm package
- A reusable web code library published to the public npm registry for developers to install. Web developers pull in dozens of npm packages when building a site, and attackers frequently publish malicious packages with lookalike names to steal developer credentials during installation. Security+ objective 2.2 lists the term
- maintainer
- The developer or small team responsible for reviewing changes and publishing releases for an open-source project. Supply chain attackers often target a volunteer maintainer with phishing emails or offers to help, hoping to gain publishing rights over a popular code library.
- typosquat
- Registering a domain or software package with a common misspelling of a popular name. Attackers use typosquatting on code registries so a developer who mistypes one letter when installing a library accidentally downloads malware. Security+ objective 2.2 lists the term
- postinstall hook
- A script inside a software package that runs automatically right after a developer installs the package. Supply chain attackers abuse the postinstall hook in open-source packages so that as soon as a developer downloads a library, the script steals cloud keys from their laptop.
This page is a short description made for this site. The article itself, with its author's name and its own link, is on the Microsoft Security Blog website. Cite the article, not this page.
Read the full article on Microsoft Security Blog (opens in a new tab)
Course connections
Each line below connects this story to a Security+ objective (a skill on CompTIA's Security+ exam, a common first cybersecurity certification), a CYBR 101 week, or a cybersecurity job, and quotes the words that made the connection.
- Kind of story: Research and reports
"Microsoft Threat Intelligence observed a large-scale npm supply chain attack..." Found by reading the article; these exact words are in it - Security+ 2.2 Explain common threat vectors and attack surfaces.
"......to postinstall payload: Inside the Mastra npm supply chain compromise..." Found in the headline - Security+ 2.3 Explain various types of vulnerabilities.
"......to postinstall payload: Inside the Mastra npm supply chain compromise..." Found in the headline - Security+ 4.3 Explain various activities associated with vulnerability management.
"......chain attacks using Microsoft Defender and actionable threat intelligence." Found in the opening sentences - Security+ 5.3 Explain the processes associated with third-party risk assessment and management.
"......to postinstall payload: Inside the Mastra npm supply chain compromise..." Found in the headline - CYBR 101 week 7: Linux, Windows, permissions and firewalls
"......and defend against supply chain attacks using Microsoft Defender and actionable threat intelligence." Found in the opening sentences - CYBR 101 week 9: malware, indicators and how detection works
"......and defend against supply chain attacks using Microsoft Defender and actionable threat intelligence." Found in the opening sentences - Job skill (from the U.S. Department of Defense list of cybersecurity jobs): Knowledge of the concept of an advanced persistent threat (APT)
"...activity followed a coordinated staged delivery pattern..." Found by reading the article; these exact words are in it
How a story is connected to the course, and every objective, week and job role
Same story at other outlets
- Microsoft Attributes Mastra AI Supply Chain Attack to North Korea
- Microsoft links Mastra AI supply chain attack to North Korean hackers
- 144 Mastra npm Packages Compromised via Hijacked Contributor Account