---
title: "CAPEC-53: Postfix, Null Terminate, and Backslash"
url: https://radicalnotion.ai/capec/capec-53
type: capec
description: "If a string is passed through a filter of some kind, then a terminal NULL may not be valid. Using alternate representation of NULL allows an adversary to embed the NULL mid-string while postfixing the proper data so that the filter is avoided. One example is a filter that looks for a trailing slash character. If a string insertion is possible, but the slash must exist, an alternate encoding of NULL in mid-string may be used."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-53: Postfix, Null Terminate, and Backslash

- **Abstraction:** Detailed
- **Status:** Draft
- **Typical severity:** High
- **Likelihood of attack:** High
- **CAPEC catalog version:** 3.9

## Description

If a string is passed through a filter of some kind, then a terminal NULL may not be valid. Using alternate representation of NULL allows an adversary to embed the NULL mid-string while postfixing the proper data so that the filter is avoided. One example is a filter that looks for a trailing slash character. If a string insertion is possible, but the slash must exist, an alternate encoding of NULL in mid-string may be used.

## Execution flow

### Step 1: Explore

\[Survey the application for user-controllable inputs\] Using a browser, an automated tool or by inspecting the application, an adversary records all entry points to the application.

- Use a spidering tool to follow and record all links and analyze the web pages to find entry points. Make special note of any links that include parameters in the URL.
- Use a proxy tool to record all user input entry points visited during a manual traversal of the web application.
- Use a browser to manually explore the website and analyze how it is constructed. Many browsers' plugins are available to facilitate the analysis or automate the discovery.
- Manually inspect the application to find entry points.

### Step 2: Experiment

\[Probe entry points to locate vulnerabilities\] The adversary uses the entry points gathered in the "Explore" phase as a target list and injects postfix null byte(s) followed by a backslash to observe how the application handles them as input. The adversary is looking for areas where user input is placed in the middle of a string, and the null byte causes the application to stop processing the string at the end of the user input.

- Try different encodings for null such as \\0 or %00 followed by an encoding for the backslash character.

### Step 3: Exploit

\[Remove data after null byte(s)\] After determined entry points that are vulnerable, the adversary places a null byte(s) followed by a backslash such that they bypass an input filter and remove data after the null byte(s) in a way that is beneficial to them.

- If the input is a directory as part of a longer file path, add a null byte(s) followed by a backslash at the end of the input to try to traverse to the given directory.

## Prerequisites

- Null terminators are not properly handled by the filter.

## Skills required

- **Medium:** An adversary needs to understand alternate encodings, what the filter looks for and the data format acceptable to the target API

## Indicators

- Null characters are observed by the filter. The filter needs to be able to understand various encodings of the Null character, or only canonical data should be passed to it.

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity | Modify Data | - |
| Confidentiality | Read Data | - |
| Confidentiality, Access Control, Authorization | Gain Privileges | - |

## Mitigations

- Properly handle Null characters. Make sure canonicalization is properly applied. Do not pass Null characters to the underlying APIs.
- Assume all input is malicious. Create an allowlist that defines all valid input to the software system based on the requirements specifications. Input that does not match against the allowlist should not be permitted to enter into the system.

## Example instances

A rather simple injection is possible in a URL: http://getAccessHostname/sekbin/ helpwin.gas.bat?mode=&draw=x&file=x&module=&locale=\[insert relative path here\] \[%00\]\[%5C\]&chapter= This attack has appeared with regularity in the wild. There are many variations of this kind of attack. Spending a short amount of time injecting against Web applications will usually result in a new exploit being discovered.

## Related weaknesses (CWE)

- [CWE-20](https://radicalnotion.ai/cwe/cwe-20): Improper Input Validation
- [CWE-74](https://radicalnotion.ai/cwe/cwe-74): Improper Neutralization of Special Elements in Output Used by a Downstream Component
- [CWE-158](https://radicalnotion.ai/cwe/cwe-158): Improper Neutralization of Null Byte or NUL Character
- [CWE-172](https://radicalnotion.ai/cwe/cwe-172): Improper Encoding or Decoding of Data
- [CWE-173](https://radicalnotion.ai/cwe/cwe-173): Improper Handling of Alternate Encoding
- [CWE-697](https://radicalnotion.ai/cwe/cwe-697): Incorrect Comparison
- [CWE-707](https://radicalnotion.ai/cwe/cwe-707): Improper Neutralization

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-267](https://radicalnotion.ai/capec/capec-267) | Leverage Alternate Encoding |

## Frequently asked questions

### What is CAPEC-53?

If a string is passed through a filter of some kind, then a terminal NULL may not be valid. Using alternate representation of NULL allows an adversary to embed the NULL mid-string while postfixing the proper data so that the filter is avoided. One example is a filter that looks for a trailing slash character. If a string insertion is possible, but the slash must exist, an alternate encoding of NULL in mid-string may be used.

### How does a Postfix, Null Terminate, and Backslash attack work?

It typically unfolds over 3 phases. It begins with: \[Survey the application for user-controllable inputs\] Using a browser, an automated tool or by inspecting the application, an adversary records all entry points to the application.

### How do you prevent CAPEC-53?

Properly handle Null characters. Make sure canonicalization is properly applied. Do not pass Null characters to the underlying APIs.

### What weaknesses does CAPEC-53 target?

CAPEC-53 exploits 7 CWE weaknesses, including CWE-20 (Improper Input Validation), CWE-74 (Improper Neutralization of Special Elements in Output Used by a Downstream Component), CWE-158 (Improper Neutralization of Null Byte or NUL Character) and CWE-172 (Improper Encoding or Decoding of Data).

### How severe is CAPEC-53?

MITRE rates CAPEC-53 as High severity with high likelihood of attack.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/53.html)

---

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