Cybersecurity researchers have discovered that entry points can be abused in various programming ecosystems such as PyPI, npm, Ruby Gems, NuGet, Dart Pub, and Rust Crates to conduct attacks on software supply chains.
“Attackers can use these entry points to execute malicious code when certain commands are executed, creating widespread danger in the open source landscape,” Checkmarx researchers Yehuda Gelb and Elad Rapaport said in the report shared with The Hacker News.
The software supply chain security company noted that point-of-entry attacks offer threat actors a more cunning and persistent method of breaching systems in a way that bypasses traditional 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 shell (aka console_scripts). In addition, they can also serve to download plugins that extend the package’s capabilities.
Checkmarks noted that while entry points are a powerful way to improve modularity, the same feature can be abused to distribute malicious code to unsuspecting users. Some of the ways this can happen include spoofing commands and creating fake plugins for various tools and frameworks.
Command hacking occurs when fake packages use entry points that mimic popular third-party tools and commands (such as aws and docker), thereby collecting sensitive information when developers install the package, even in cases where it is distributed as a wheel (.whl ) file.
Some of the widely used third-party commands that could be potential targets for command hacks include npm, pip, git, kubectl, terraform, gcloud, heroku, and dotnet.
A second type of command breach can also occur when threat actors use legitimate system command names (such as touch, curl, cd, ls, and mkdir) as entry points to hijack the execution thread.
“The success of this approach primarily depends on the order of the PATH,” the researchers noted. “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 happen in development environments where local package directories take precedence.”
That’s not all. Checkmarks found that the effectiveness of team selection can be improved with a more stealthy tactic called team wrapping, which involves creating an entry point that acts as a shell around the original team rather than replacing it entirely.
What makes this approach powerful is that it silently executes the malicious code while simultaneously calling the original, legitimate command and returning the execution results, thus allowing it to fly under the radar.
“Because the legitimate command is still executed and its output and behavior are preserved, there is no immediate indication of compromise, making the attack extremely difficult to detect in normal use,” the researchers said. “This stealthy approach allows attackers to maintain long-term access and potentially steal sensitive information without arousing suspicion.”
Another entry point attack tactic involves creating malicious plug-ins and extensions for developer tools that have the ability to gain extensive access to the code base itself, thus giving malicious actors the ability to change the behavior of the program or interfere with the testing process to make it look like the code is running appointments.
“Moving forward, it is critical to develop comprehensive security measures that take into account the use of the entry point,” the researchers said. “By understanding and addressing these risks, we can work towards a more secure Python packaging environment, protecting both individual developers and enterprise systems from sophisticated supply chain attacks.”
The development comes after Sonatype revealed in its annual State of the Software Supply Chain report that more than 512,847 malicious packages were discovered in the open source ecosystems for Java, JavaScript, Python and .NET as of November 2023. which is a 156% jump year. – for a year.
“Traditional security tools often fail to detect these new attacks, leaving developers and automated build environments highly vulnerable,” the company said in a statement. said. “This has led to a new wave of next-generation supply chain attacks targeting developers directly, bypassing existing defenses.”