Supply Chain Attacks Can Exploit Entry Points in Python, npm, and Open-Source Ecosystems
Cybersecurity researchers have found that entry points could be abused across multiple programming ecosystems like PyPI, npm, Ruby Gems, NuGet, Dart Pub, and Rust Crates to stage software supply chain attacks.
"Attackers can leverage these entry points to execute malicious code when specific commands are run, posing a widespread risk in the open-source landscape," Checkmarx researchers Yehuda Gelb and Elad Rapaport said in a report shared with The Hacker News.
The software supply chain security company noted that entry-point attacks offer threat actors a more sneaky and persistent method of compromising systems in a manner that can bypass traditional security defenses.
Entry points in a programming language like Python refer to a packaging mechanism that allows developers to expose certain functionality as a command-line wrapper (aka console_scripts). Alternatively, they can also serve to load plugins that augment a package's features.
Checkmarx noted that while entry points are a powerful way to improve modularity, the same feature could be abused to distribute malicious code to unsuspecting users. Some of the ways this could happen include command-jacking and creating rogue plugins for various tools and frameworks.
Command-jacking occurs when counterfeit packages use entry points that impersonate popular third-party tools and commands (e.g., aws and docker), thereby harvesting sensitive information when developers install the package, even in cases where it's distributed as a wheel (.whl) file.
Some of the widely-used third-party commands that could be potential targets for command-jacking comprise npm, pip, git, kubectl, terraform, gcloud, heroku, and dotnet. A second type command-jacking can also manifest when threat actors use legitimate system command names (e.g., touch, curl, cd, ls, and mkdir) as entry points in order to hijack the execution flow.
"The success of this approach primarily depends on the PATH order," the researchers pointed out. "If the directory containing the malicious entry points appears earlier in the PATH than the system directories, the malicious command will be executed instead of the system command. This is more likely to occur in development environments where local package directories are prioritized."
That's not all. Checkmarx found that the effectiveness of command-jacking can be improved by a more stealthy tactic called command wrapping, which involves creating an entry point that acts as a wrapper around the original command, instead of replacing it altogether.
What makes the approach potent is that it silently executes the malicious code while also invoking the original, legitimate command and returning the results of the execution, thus allowing it to fly under the radar.
"Since the legitimate command still runs and its output and behavior are preserved, there's no immediate sign of compromise, making the attack extremely difficult to detect through normal use," the researchers said. "This stealthy approach allows attackers to maintain long-term access and potentially exfiltrate sensitive information without raising suspicion."
Another entry point attack tactic entails creating malicious plugins and extensions for developer tools that have the capability to gain broad access to the codebase itself, thus giving bad actors an opportunity to change program behavior or tamper with the testing process to make it seem like the code is working as intended.
"Moving forward, it's crucial to develop comprehensive security measures that account for entry point exploitation," the researchers said. "By understanding and addressing these risks, we can work towards a more secure Python packaging environment, safeguarding both individual developers and enterprise systems against sophisticated supply chain attacks."
The development comes as Sonatype, in its annual State of the Software Supply Chain report, revealed that over 512,847 malicious packages have been discovered across open-source ecosystems for Java, JavaScript, Python, and .NET since November 2023, a 156% jump year-over-year.
"Traditional security tools often fail to detect these novel attacks, leaving developers and automated build environments highly vulnerable," the company said. "This has resulted in a new wave of next-generation supply chain attacks, which target developers directly, bypassing existing defenses."
source: TheHackerNews
Free security scan for your website
Top News:
Recorded Future CEO applauds "undesirable" designation by Russia
December 19, 2024CISA orders federal agencies to secure Microsoft 365 tenants
December 18, 2024Google Chrome uses AI to analyze pages in new scam detection feature
December 21, 2024