Mystery of industry-targeting backdoored NPM JavaScript packages solved

Yup, 'the intern' did it

Malicious packages in the NPM Registry that security researchers for weeks believed were being used to stage supply-chain attacks against prominent industrial companies in Germany turned out to be part of a penetration test run by a cybersecurity company.

Researchers at Snyk in late April published a blog post about a JavaScript package that stood out among others they had found because it contained both encrypted and obfuscated files.

More recently, software maker JFrog and cybersecurity firm ReversingLabs this week released their own findings about the multiple malicious libraries in the NPM Registry that all used the same payload and belonged to the same malware family as the one analyzed by Snyk. The goal appeared to be to launch dependency-confusion attacks in which applications within German companies end up using, through a misconfiguration or something like that, malicious npm modules rather than legitimate packages with similar or plausible names. If successful, developers within specific corporations would be fooled into introducing backdoors into their code bases.

JFrog researchers in their blog post wrote that "compared with most malware found in the npm repository, this payload seems particularly dangerous: a highly-sophisticated, obfuscated piece of malware that acts as a backdoor and allows the attacker to take total control over the infected machine. Furthermore, this malware seems to be an in-house development and not based on publicly-available tools."

What none of the researchers could figure out was the identity of the maker of the malicious packages.

Owning up

However, soon after JFrog's blog post appeared, pen-testing and threat intelligence company Code White took responsibility for the malicious packages. In tweets directed at Snyk, the Ulm, Germany-based company said the suspected malicious actor was actually an intern assigned to research dependency-confusion attacks as part of its "continuous attack simulations for clients."

Code White wrote that "to clarify your questions: we're trying to mimic realistic threat actors for dedicated clients as part of our Security Intelligence Service and we brought our 'own' package manager that supports yarn and npm."

It's not unusual for security researchers to pull together their own packages for testing purposes. In its report, the Snyk threat hunters said they detected these npm packages as part of a larger effort to look into what they said has been a constant increase in the number of malicious dependencies showing up in disparate ecosystems and that the large majority of them are benign.

By that they mean the code is used to collect information but doesn't harm the infected machine. The researchers referred to these as "softly malicious" packages that have varied tasks, including machine-related information exfiltration through DNS lookups that don't perform any other actions, or cryptocurrencies miners that siphon compute power from compromised systems but not are terribly malicious.

Other dodgy modules are "other researchers' 'softly-malicious' packages that are mainly for tests," Team Snyk wrote.

'Not very normal'

However, Shachar Menashe, senior director of security research at JFrog, told The Register the way White Code ran their tests was "not very normal and it could have problematic implications."

The malicious packages created by Code White had a more significantly malicious vibe, according to an analysis of them. The JFrog analysts wrote that when researching the payload in the malicious packages, "we were surprised to discover that this attack seems to be highly targeted against a number of prominent companies based in Germany" and that they detected four maintainer profiles created to oversee the packages. They reported all the packages related to three of the maintainers as malware to the npm registry maintainers and noted that those related to the fourth had already been removed.

Menashe said it was unclear how Code White got hold of internal packages names from which to name the malicious copycats; we presume Code White was doing work for the identified German businesses.

"I don't know how it happened in this specific case and I also don't know for a fact that these are the 'correct' internal package names," he said.

"It could happen in many ways. For example, if your build logs are written to some publicly-available location, then these package names can be there. It's definitely a security concern if someone gets your internal package names, since that enables a dependency confusion attack in many scenarios."

Though the threat intelligence teams at JFrog, Snyk and ReversingLabs spent weeks analyzing the malicious practices, Menashe said pen-testing companies don't concern themselves too much with companies like the aforementioned trio.

"I worry about the client's PSIRT [product security incident response team] that might have caught this attack, not knowing what it is (because there is no way to distinguish this from a real attack) and scrambling like we did," he added. "I also worry about the possible scenario where this backdoor payload is hijacked by a real threat actor and used to cause real damage."

That said, even after digging into the malicious packages and before Code White's admission, the JFrog researchers were unsure exactly what they were looking at, though they said they had "some concrete leads."

There were details that suggested a sophisticated real threat actor was behind the malicious packages, such as the use of custom code, the attack being highly targeted and relying on "difficult to get" insider information, such the private package names. In addition, the payload was extremely capable, contained features like dynamic configuration parameters that aren't needed for a simple pen-test and lacked descriptions or indications that they were used for pen-tests.

However, there also were indicators that it was part of what they described as a "very aggressive" penetration test, including that the usernames created in the npm registry didn't try to hide the targeted company and the obfuscator used was a public one, which can be easily detected and reversed.

The incident involving Code White came the same week a security consultant, to alert the JavaScript community that the security of NPM Registry – bought by GitHub two years ago – needs more scrutiny, bought the expired email domain used by a maintainer of a widely used package. He said the move backs up an argument he had made for years that it is too easy to take over the NPM account of a popular project to run a software supply-chain attack.

ReversingLabs analysts wrote in a blog post they had been looking at exploitable flaws and misconfigurations on platforms like NPM and GitHub as potential fuel for a growth in dependency-confusion attacks, recognizing that most they saw have been proofs-of concept. What made what Snyk found in late April notable was that "dependency attacks moved from hypothetical to actual," they wrote. ®

Broader topics

Other stories you might like

  • Lonestar plans to put datacenters in the Moon's lava tubes
    How? Founder tells The Register 'Robots… lots of robots'

    Imagine a future where racks of computer servers hum quietly in darkness below the surface of the Moon.

    Here is where some of the most important data is stored, to be left untouched for as long as can be. The idea sounds like something from science-fiction, but one startup that recently emerged from stealth is trying to turn it into a reality. Lonestar Data Holdings has a unique mission unlike any other cloud provider: to build datacenters on the Moon backing up the world's data.

    "It's inconceivable to me that we are keeping our most precious assets, our knowledge and our data, on Earth, where we're setting off bombs and burning things," Christopher Stott, founder and CEO of Lonestar, told The Register. "We need to put our assets in place off our planet, where we can keep it safe."

    Continue reading
  • Conti: Russian-backed rulers of Costa Rican hacktocracy?
    Also, Chinese IT admin jailed for deleting database, and the NSA promises no more backdoors

    In brief The notorious Russian-aligned Conti ransomware gang has upped the ante in its attack against Costa Rica, threatening to overthrow the government if it doesn't pay a $20 million ransom. 

    Costa Rican president Rodrigo Chaves said that the country is effectively at war with the gang, who in April infiltrated the government's computer systems, gaining a foothold in 27 agencies at various government levels. The US State Department has offered a $15 million reward leading to the capture of Conti's leaders, who it said have made more than $150 million from 1,000+ victims.

    Conti claimed this week that it has insiders in the Costa Rican government, the AP reported, warning that "We are determined to overthrow the government by means of a cyber attack, we have already shown you all the strength and power, you have introduced an emergency." 

    Continue reading
  • China-linked Twisted Panda caught spying on Russian defense R&D
    Because Beijing isn't above covert ops to accomplish its five-year goals

    Chinese cyberspies targeted two Russian defense institutes and possibly another research facility in Belarus, according to Check Point Research.

    The new campaign, dubbed Twisted Panda, is part of a larger, state-sponsored espionage operation that has been ongoing for several months, if not nearly a year, according to the security shop.

    In a technical analysis, the researchers detail the various malicious stages and payloads of the campaign that used sanctions-related phishing emails to attack Russian entities, which are part of the state-owned defense conglomerate Rostec Corporation.

    Continue reading
  • FTC signals crackdown on ed-tech harvesting kid's data
    Trade watchdog, and President, reminds that COPPA can ban ya

    The US Federal Trade Commission on Thursday said it intends to take action against educational technology companies that unlawfully collect data from children using online educational services.

    In a policy statement, the agency said, "Children should not have to needlessly hand over their data and forfeit their privacy in order to do their schoolwork or participate in remote learning, especially given the wide and increasing adoption of ed tech tools."

    The agency says it will scrutinize educational service providers to ensure that they are meeting their legal obligations under COPPA, the Children's Online Privacy Protection Act.

    Continue reading
  • Mysterious firm seeks to buy majority stake in Arm China
    Chinese joint venture's ousted CEO tries to hang on - who will get control?

    The saga surrounding Arm's joint venture in China just took another intriguing turn: a mysterious firm named Lotcap Group claims it has signed a letter of intent to buy a 51 percent stake in Arm China from existing investors in the country.

    In a Chinese-language press release posted Wednesday, Lotcap said it has formed a subsidiary, Lotcap Fund, to buy a majority stake in the joint venture. However, reporting by one newspaper suggested that the investment firm still needs the approval of one significant investor to gain 51 percent control of Arm China.

    The development comes a couple of weeks after Arm China said that its former CEO, Allen Wu, was refusing once again to step down from his position, despite the company's board voting in late April to replace Wu with two co-chief executives. SoftBank Group, which owns 49 percent of the Chinese venture, has been trying to unentangle Arm China from Wu as the Japanese tech investment giant plans for an initial public offering of the British parent company.

    Continue reading
  • SmartNICs power the cloud, are enterprise datacenters next?
    High pricing, lack of software make smartNICs a tough sell, despite offload potential

    SmartNICs have the potential to accelerate enterprise workloads, but don't expect to see them bring hyperscale-class efficiency to most datacenters anytime soon, ZK Research's Zeus Kerravala told The Register.

    SmartNICs are widely deployed in cloud and hyperscale datacenters as a means to offload input/output (I/O) intensive network, security, and storage operations from the CPU, freeing it up to run revenue generating tenant workloads. Some more advanced chips even offload the hypervisor to further separate the infrastructure management layer from the rest of the server.

    Despite relative success in the cloud and a flurry of innovation from the still-limited vendor SmartNIC ecosystem, including Mellanox (Nvidia), Intel, Marvell, and Xilinx (AMD), Kerravala argues that the use cases for enterprise datacenters are unlikely to resemble those of the major hyperscalers, at least in the near term.

    Continue reading

Biting the hand that feeds IT © 1998–2022