Table of contents
Title
Table of content
Table of contents
Title

Malicious code

Updated

Malicious code is any code written to make a system do what its owner never authorized: destroy or steal data, hand control to an attacker, or quietly alter what a legitimate program does. NIST describes it as a program “covertly inserted into another program,” and that word — covertly — is the part most definitions skip. Malicious code rarely announces itself. It arrives inside something that looks fine.

Of the 100 most recent entries in the Fluid Attacks Database on November 11, 2026, 25 were malicious packages, published under identifiers such as MAL-2026-19118 rather than CVEs. Three of them carried the same npm library name under different scopes; three more were near-identical variants of a single package name. None was a flaw somebody made by accident. Every one was code written on purpose and published where developers would install it.

This page covers what malicious code is and how it differs from a vulnerability, the types you will meet, how it reaches a system — through dependencies, updates and build pipelines — how we detect it at Fluid Attacks, and what prevention looks like when the delivery vehicle is software your team chose to trust.

What is malicious code?

Malicious code is software, or a fragment of it, built with the intent to harm the system that runs it. Intent is what defines it. A buffer overflow that lets an attacker run commands is a defect introduced by mistake; a backdoor that lets the same attacker in is code somebody wrote to be there.

That distinction matters more than the vocabulary around it. “Malicious code” and “malware” are used interchangeably, and NIST treats them as the same thing. The useful split is not between the two words but between code that was inserted and code that was mishandled.

That has a practical consequence: if you only look for malicious code at the endpoint, you are watching the last step of a path that began somewhere else.

Malicious code is not the same thing as a vulnerability

A vulnerability is a weakness in code written in good faith. Malicious code is the opposite: the code is doing exactly what its author intended.

The two interact constantly — an attacker exploits a vulnerability to run malicious code — which is why they get conflated. But they need different responses. You patch a vulnerability. You cannot patch malicious code; you remove it, then find out what it did while it was there.

Fluid Attacks’ security requirement 155, “Application free of malicious code”, frames it the way a development team experiences it. Malicious code “can be imported as part of third party libraries, which may be intentionally malicious,” or “come as a backdoor left by one of the developers.” The requirement maps to CWE-507 (Trojan horse), CWE-510 (Trapdoor) and CWE-511 (Logic/Time bomb), to ISO 27001 control 8.26 and to FedRAMP SI-3.

Types of malicious code

What matters in practice is not what the code does once it runs, but how it spreads and how it got there. Those two properties decide your response.

Type

What it does

Self-replicates

Typical entry

Virus

Attaches to a file or program and runs when that file does

Yes, needs a host

Infected file or document

Worm

Copies itself across a network or ecosystem with no user action

Yes, standalone

Network service, package registry

Trojan horse

Presents itself as legitimate software to get installed

No

Download, app store, compromised update

Ransomware

Encrypts files or systems and demands payment, as in Colonial Pipeline

Varies

Phishing, exposed service, dropper

Spyware

Monitors activity, records keystrokes, captures screen, camera or microphone

No

Bundled installer, trojan, malicious extension

Rootkit

Hides the attacker’s presence by subverting the OS or firmware

No

Post-compromise installation

Backdoor

Provides covert access that bypasses authentication

No

Inserted in source, build or an update

Logic bomb

Stays dormant until a condition or date triggers it

No

Inserted by someone with commit access

Adware

Displays unwanted advertising

No

Bundled installer

Two corrections worth making, because both are common and both are wrong.

A trojan is not a virus. A virus replicates by attaching itself to other files; a trojan does not replicate at all. It gets installed because somebody chose to install it, believing it was something else. That is its entire mechanism, and why trojans survive where viruses do not.

Not all adware is malicious code. Advertising-supported software that discloses what it does and can be uninstalled is a business model, not an attack. It becomes malicious code when it hides itself, resists removal or carries a second payload. The line is disclosure, not annoyance.

Backdoors and logic bombs deserve more attention than lists like this give them: they are the kinds of malicious code that reach you through software you paid for or code your own team merged. They do not spread. They do not need to.

Malicious code at Fluid Attacks

We treat malicious code as a software supply chain problem first and an endpoint problem second, because that is where our clients’ exposure sits. Here is what we look for, what we can prove, and where our numbers stop.

What we look for in third-party code

Our weakness catalog gives malicious code in dependencies a class of its own: 448, “Use of software with malware”, a project dependency that “contains code or components suspected of being compromised by malware or malicious behavior.” Its listed impact is unauthorized access and full control of the application infrastructure, loss of availability, and spread to other applications, servers or networks — the dependency becomes the vector, not the target.

Fluid Attacks Database entry for use of software with malware]

Fluid Attacks reports dependencies compromised by malicious code as weakness 448.

Two things in that entry are worth reading closely. Its exploit maturity is A, for Attacked: this is not theoretical. And its expected remediation time is 60 minutes — the fix is usually fast once you know; the hard part is knowing.

Among the requirements it connects to are 155, above, and 262, “Verify third-party components”, which also governs dependency confusion.

What it looks like in practice

What we instrument

What it looks for

Where the evidence lands

Software Composition Analysis

Dependencies carrying malicious code or known vulnerabilities, direct and transitive

Packages section, with the file and line that pulls it in

Malware advisories

Packages published with malicious behavior and no CVE

Own MAL identifiers in the public database

Reachability analysis

Whether your code actually calls a vulnerable function

“Reachable” tag on the affected package

Secure Code Review

Malicious code in your own repository: backdoors, logic bombs, inserted logic

Reported vulnerability with the code in context

SBOM export

The full component inventory, with transitivity and build-or-run stage

CycloneDX or SPDX download

 Packages section listing third-party dependencies and their vulnerabilities

The Packages section lists every third-party dependency in a group’s repositories, with the vulnerabilities and locations of each.

On the platform, the Packages section shows each dependency’s “location in your projects and if it contains malware.” It also records whether a component is used at build stage or at run stage, which changes what a malicious package can reach.

What automated detection catches, and what it does not

In Fluid Attacks’ benchmark of third-party AppSec tools against a web application seeded with 1,201 vulnerabilities across 105 CWE categories, a pentester reported 1,076 of them — 89.6% recall at 100% precision. The best automated scanner in the same exercise, our own, reached 22.7% recall, finding 273 of the 1,201, and covered 8.8% of total risk exposure.

Where those numbers stop

That benchmark measures vulnerabilities, not malicious code. It would be easy to carry 89.6% over into a claim about detecting malicious code, and it would be wrong: finding an injection flaw in a seeded application and spotting a postinstall script that exfiltrates environment variables are different problems with different ceilings. We publish it because it is reproducible, not because it transfers. Two more limits we would rather state than have you discover:

Reachability and malware detection answer different questions. Our documentation lists them separately for a reason. Reachability tells you whether your code calls the vulnerable function in a dependency. It says nothing about whether that dependency contains malicious code, because a hostile package does not wait to be called — an install script runs at install time.

A lock file protects the next build, not the one you already made. It pins the version you installed so a malicious release in the declared range cannot slip in later. If the version you pinned was already compromised, the lock file holds it in place faithfully.

The control that decides most of the rest

If you implement one thing from this page, implement lock files with hashes. Our documentation on them states the failure case plainly: “Attackers have taken control of maintainer accounts and released malicious versions of popular packages.” Without a lock file, “the next build can install a malicious version that is in the declared range.”

With hashes recorded, the package manager “stops the installation when a package is different from the package that you locked” — integrity verification on every build. Our docs list the file and CI/CD command for 15 package managers, from npm ci to cargo build --locked, plus what to do for pip, Maven and sbt, which produce none.

Go deeper: our overview of software supply chain security covers the broader set of practices, and the page on software composition analysis explains how component inventories get built and assessed.

How malicious code gets into a system

Malicious code needs a delivery mechanism, and the list has grown well past email attachments. These are the routes that matter now.

  • Phishing and social engineering. Still the most common opener, but social engineering now targets the people who publish code, not only end users. The September 2025 npm compromise began with a phishing email to one maintainer.

  • Downloads and removable media. Cracked software, fake installers, malicious browser extensions, USB drives. The classic route, and it still works.

  • Exploitation of a vulnerability. The attacker does not insert malicious code into your software; they use a flaw in it to run theirs.

  • Compromised software updates. An update signed with legitimate certificates, delivered through the vendor’s own channel, carrying code the vendor did not write.

  • Malicious dependencies. A typosquatting package published under a name close to a real one, an abandoned package re-registered by somebody else, or a legitimate package whose maintainer account was taken over. Dependency confusion belongs here too: when a project declares its dependencies ambiguously, an attacker can get the package manager to resolve to their package instead of yours.

  • CI/CD and developer tooling. Build runners, reusable actions, IDE extensions and, now, the instruction files that AI coding agents read. MITRE ATT&CK technique T1195.001, Compromise Software Dependencies and Development Tools, covers all of it, and notes that agent skill files may pass registry screening and signature-based scanning, because they are natural language rather than executable code.

One evasion technique is worth flagging because it defeats code review itself: in October 2025, attackers hid malicious code in VS Code extensions using invisible Unicode characters that render as blank space in a diff view but execute normally.

Malicious code in the software supply chain

The highest-impact malicious code of the last five years did not arrive as a suspicious download. It arrived as a legitimate update or a trusted package. That is what a software supply chain attack is: the attacker compromises something upstream of you, and your own trust in it does the delivery. Four cases, all documented by our team, show the pattern.

Case

Year

How the code got in

What it did

SolarWinds Orion

2020

Backdoor inserted into the build, shipped as a signed update

Covert channel to attacker-controlled servers, across thousands of organizations

tj-actions/changed-files

2025

Version tags repointed to a malicious commit in a GitHub Action

Dumped CI/CD secrets from runner memory into workflow logs

npm maintainer takeover

2025

Phishing of one maintainer, then publication of malicious versions

Browser-based interceptor that rewrote cryptocurrency transactions

Shai-Hulud

2025

Malicious payload in a hijacked postinstall script

Stole credentials and republished itself into further packages automatically

SolarWinds broke the assumption underneath most endpoint defenses: the compromised component was digitally signed and delivered through the vendor’s official update channel. Signature verification confirmed the package was authentic. It was. The malicious code was inside it.

The GitHub Action case applies the same logic to the build. More than 23,000 repositories depended on it; our advisory for CVE-2025-30066 classifies it under weakness 448 with CWE-506, Embedded Malicious Code, and records an EPSS score of 0.88385 — the 99.47th percentile for likelihood of exploitation.

Shai-Hulud changed the economics again. By stealing credentials and using them to publish itself into other packages, it removed the attacker from the loop. A software supply chain attack that propagates on its own turns the ecosystem into the distribution network.

How to detect and prevent malicious code

Detection of malicious code splits by where the code sits. Code in your own repository needs review. Code you imported needs intelligence about its source.

  1. Scan dependencies against malware intelligence, not just CVE feeds
    This is the gap that catches teams out. A maliciously published package never receives a CVE, because nothing was disclosed — somebody published hostile code. Our database issues these under their own MAL identifiers, and a tool matching your manifest against the NVD alone reports those projects as clean.

  2. Inventory what you ship
    The Packages section tracks direct and transitive dependencies per repository and exports an SBOM in CycloneDX or SPDX. You cannot assess a component you do not know you have, and most of the inventory is transitive.

  3. Pin versions and verify integrity
    Lock files with hashes, plus the CI/CD command that fails the build when the lock file is stale.

  4. Review your own code for inserted logic
    Backdoors, time bombs and rootkit loaders are not found by matching package names. They are found by somebody reading the code, which is what Secure Code Review and code-assisted Pentesting as a Service (PTaaS) are for.

  5. Gate the CI/CD pipeline
    In Fluid Attacks’ State of Attacks 2026, covering 1,119,396 vulnerabilities reported across 2025, organizations using our CI Gate remediated 72.2% of their reported vulnerabilities, against 58% among those that did not. It also found that 70% of assessed systems carried at least one high- or critical-severity vulnerability, up from 53.3% the year before. A CI/CD pipeline that fails the build on a policy violation is the place to stop an unreviewed dependency.

  6. Treat detection as the start of the response
    Weakness 448 recommends reviewing the origin and integrity of affected dependencies, replacing them, then testing to verify the production environment is not already compromised. Removing malicious code does not undo what it did with the credentials it read.

Conclusions

Malicious code earns the name through intent, not through technique, and the techniques that matter have moved. The endpoint-era picture — an infected attachment, a USB drive, an antivirus signature — still describes real attacks, but not the ones that reached thousands of organizations at once. Those arrived through a signed update, a reusable CI/CD action, and a package with two billion weekly downloads.

Defending against that means knowing what your software is made of, verifying those components are what they claim to be, and reading the code your own team writes. No control set makes a system immune. The reachable goal is that malicious code in your supply chain is something you detect in hours, not something you learn about from somebody else.

Frequently asked questions

Is malicious code the same thing as malware?

Yes, the terms are interchangeable. NIST’s SP 800-83 defines malware as “also known as malicious code”: any program covertly inserted into another with intent to destroy data, run destructive or intrusive programs, or compromise the confidentiality, integrity or availability of the victim’s data, applications or operating system. The more useful distinction is between malicious code, written on purpose, and a vulnerability, a defect introduced by mistake.

Can digitally signed software contain malicious code?

Yes, and the most damaging supply chain attacks have worked exactly this way. In the 2020 SolarWinds Orion compromise, attackers inserted a backdoor during the build, so the resulting update was signed with the vendor’s legitimate certificates and distributed through its official channel. Signature verification proved the package was authentic. It was. The malicious code was inside it.

How does malicious code get into open-source packages?

Usually through the maintainer, not the code. Attackers phish or take over a maintainer’s account and publish a malicious version of a package people already trust, register names close to popular ones so a typo installs theirs, or re-register abandoned packages. MITRE ATT&CK documents all three under technique T1195.001, along with compromise of CI/CD components such as GitHub Actions.

Can automated tools detect malicious code in dependencies?

Partly, and the gap is specific. A tool matching your dependencies against CVE feeds will miss maliciously published packages entirely, because those never get a CVE. Detection requires a feed of confirmed malicious publications. Of the 100 most recent entries in Fluid Attacks’ Database on November 11, 2026, 25 were malicious packages carrying MAL identifiers rather than CVE identifiers.

Does Fluid Attacks detect malicious code in dependencies?

Yes. Our static scans inventory the third-party dependencies in your software, and the Packages section shows each one’s location in your projects and whether it contains malware — a weakness we catalog as 448, “Use of software with malware.” Malicious code inserted into your own repository is a different problem, covered by manual Secure Code Review rather than component matching.

Know what your software is really running

Our scanners and pentesters check both halves of the problem: the dependencies you imported and the code your team wrote. Start free trial · Contact us.

Get started with Fluid Attacks' RBVM solution right now

Reduce risk without slowing delivery

Fast and accurate results from one continuous security program powered by AI, scanners, and pentesters.

Reduce risk without slowing delivery

Fast and accurate results from one continuous security program powered by AI, scanners, and pentesters.

Reduce risk without slowing delivery

Fast and accurate results from one continuous security program powered by AI, scanners, and pentesters.