Matan Giladi, Apiiro: Guarding your code against malicious patterns

Knight guarding code on a computer illustrating open-source resources released by Apiiro to help protect software developers and their projects against hacking through vulnerabilities in supply chains.

Malicious code is proving as persistent a threat as ever, despite years of awareness campaigns and ongoing incidents that demonstrate the vulnerabilities in software supply chains.

This year, Apiiro’s security research teams detected and analysed thousands of malicious code instances found in repositories and packages. What’s alarming is the ease with which these attacks exploit fundamental gaps in workflows, from dependency managers to build systems.

Highlighting recent attacks – including millions of cloned GitHub repositories infected with malware loaders – Apiiro’s approach is refreshingly simple: offer transparent, open-source tools designed to equip organisations with practical, robust defences.

“Despite constant news of malicious code, open-source support is severely lacking,” said Matan Giladi, Senior Security Researcher at Apiiro, to Developer.

To that end, Apiiro recently released two key open-source resources aimed at strengthening baseline defences:

  • malicious-code detection ruleset for Semgrep and Opengrep: Tailored to pinpoint and differentiate malicious from benign code.
  • PRevent, an open-source GitHub app: This tool scans pull requests (PRs), alerts teams to suspicious activity, and integrates seamlessly into existing workflows.

These offerings reflect the company’s broader mission to change how organisations and developers think about malicious code. With a better focus on secure collaboration and practical tooling, the Apiiro team hopes to significantly reduce the risks of common threats.

The ever-present threat of malicious code

Apiiro stresses that malicious code remains both a highly accessible and devastating attack vector.

While the security of dependency managers and code-hosting platforms has seen incremental improvements, gaps remain in areas like source validation, identity verification, and build systems—elements ripe for exploitation by bad actors.

By analysing attack samples, the research team identified recurring coding anti-patterns. Unlike traditional patterns, which are commonly used across clean codebases, anti-patterns reflect bad practices—rare in legitimate code but abundant in malicious instances.

This insight enabled Apiiro’s team to create unique detection capabilities, achieving a 94.3% success rate in PyPI scans and 88.4% in npm.

“Catching most known incidents is actually pretty simple,” says Giladi. “It’s surprising how vulnerable everyone still is to this attack vector.”

Apiiro’s research highlights two recurring themes: obfuscation and naive dynamic code execution.

Obfuscation is used to obscure malicious activity, leveraging techniques like Base64 encoding, runtime reconstruction loops, and arithmetic noise. Although these tactics aim to evade detection, Giladi notes, “Ironically, the attempt to evade detection is what gets most attacks caught.”

Examples include the @essie-wire/ethers npm package (hiding keyloggers in images) and typo-squatting PyPI packages like falask, which disguised malware through encoded URLs.

Meanwhile, dynamic code execution facilitates runtime code injection through methods like eval() and exec()—both commonly exploited by attackers to distribute payloads or bypass safeguards.

Recent examples include the btc-miner npm package, which impersonated a Bitcoin miner while stealing cryptocurrency, and suvauxlib, which exfiltrated sensitive data using dynamically obfuscated parameters.

“The main exploit here is of the human aspect,” explains Giladi. “Areas where developers feel more comfortable turning a blind eye to and accepting unreadable or suboptimal code are naturally where you’d want to hide things.”

The open-source advantage

Apiiro’s Semgrep-compatible ruleset leverages cutting-edge detection criteria to identify malicious elements during code submission or modification, while the free PRevent app offers seamless integration to scan pull request events before code merges.

PRevent’s unique advantage lies in its ability to embed detection into the development lifecycle where it matters most. When a pull request (PR) includes suspicious patterns, the app flags the issue and prompts authorised reviewers to decide whether the submission should proceed.

This PR-first scanning and enforcement approach builds a stronger foundation than traditional methods like linters or local hooks, which lack the coverage or enforcement necessary to prevent highly targeted attacks.

While technology alone isn’t a panacea, integrating scanners and rulesets where they matter most can help block attacks without compromising productivity.

By creating open-source rules and fostering community contributions, Apiiro is encouraging developers and security teams to unite against malicious code.

“We should focus more on helping each other and less on spreading FUD [fear, uncertainty, and doubt],” said Giladi.

From publishing precise rulesets to making tools free-to-use, Apiiro, for its part, hopes to fill a gap that has long left organisations under-prepared.

Scroll to Top

Contact Us

Please enter the details below to get in touch with us!