---
title: "CWE-793: Only Filtering One Instance of a Special Element"
url: https://radicalnotion.ai/cwe/cwe-793
type: cwe
description: "The product receives data from an upstream component, but only filters a single instance of a special element before sending it to a downstream component."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-793: Only Filtering One Instance of a Special Element

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

## Description

The product receives data from an upstream component, but only filters a single instance of a special element before sending it to a downstream component.

Incomplete filtering of this nature may be location-dependent; e.g., only the first or last element is filtered.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | REALIZATION: This weakness is caused during implementation of an architectural security tactic. |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity | Unexpected State | - |

## Demonstrative examples

### Example 1

The following code takes untrusted input and uses a regular expression to filter "../" from the input. It then appends this result to the /home/user/ directory and attempts to read the file in the final resulting path.

Bad code:

```perl
my $Username = GetUntrustedInput();
$Username =~ s/\.\.\///;
my $filename = "/home/user/" . $Username;
ReadAndSendFile($filename);
```

Attack code:

```
../../../etc/passwd
```

Result code:

```
../../etc/passwd
```

Result code:

```
/home/user/../../etc/passwd
```

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-792](https://radicalnotion.ai/cwe/cwe-792) | Incomplete Filtering of One or More Instances of Special Elements |

## Frequently asked questions

### What is CWE-793?

The product receives data from an upstream component, but only filters a single instance of a special element before sending it to a downstream component.

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

Exploiting CWE-793 can lead to: Unexpected State.

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

---

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