CAPEC-3
Using Leading 'Ghost' Character Sequences to Bypass Input Filters
Some APIs will strip certain leading characters from a string of parameters. An adversary can intentionally introduce leading "ghost" characters (extra characters that don't affect the validity of the request at the API layer) that enable the input to pass the filters and therefore process the adversary's input. This occurs when the targeted API will accept input data in several syntactic forms and interpret it in the equivalent semantic way, while the filter does not take into account the full spectrum of the syntactic forms acceptable to the targeted API.
On this page
Ask an AI about this attack pattern
Show the prompt
Explain the attack pattern CAPEC-3: Using Leading 'Ghost' Character Sequences to Bypass Input Filters: how it unfolds, what it needs and how to prevent and detect it in my systems. Use https://capec.mitre.org/data/definitions/3.html and https://cve.bz/cve/capec/3?via=ask-ai-copy, which lists recent CVEs with the weaknesses it exploits. Cite the sources.Opens a third-party assistant; its answer is its own, not cve.bz's. The prompt holds only this attack pattern's id and public links.
How the attack unfolds
Explore
The attacker looks for a way in.
[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.
4 techniques
- 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.
Experiment
They probe what they found.
[Probe entry points to locate vulnerabilities] The adversary uses the entry points gathered in the "Explore" phase as a target list and injects various leading 'Ghost' character sequences to determine how to application filters them.
2 techniques
- Add additional characters to common sequences such as "../" to see how the application will filter them.
- Try repeating special characters (?, @, #, *, etc.) at the beginning of user input to see how the application filters these out.
Exploit
They carry out the attack.
[Bypass input filtering] Using what the adversary learned about how the application filters input data, they craft specific input data that bypasses the filter. This can lead to directory traversal attacks, arbitrary shell command execution, corruption of files, etc.
Prerequisites
The targeted API must ignore the leading ghost characters that are used to get past the filters for the semantics to be the same.
Skills required
- Medium skill
The ability to make an API request, and knowledge of "ghost" characters that will not be filtered by any input validation. These "ghost" characters must be known to not affect the way in which the request will be interpreted.
Consequences
| Impact | Affects | Note |
|---|---|---|
| Gain Privileges | Confidentiality, Access Control, Authorization | |
| Modify Data | Integrity |
Mitigations
Use an allowlist rather than a denylist input validation.
Canonicalize all data prior to validation.
Take an iterative approach to input validation (defense in depth).
Weaknesses it exploits
- CWE-20 Improper Input Validation
- CWE-41 Improper Resolution of Path Equivalence
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component
- CWE-172 Improper Encoding or Decoding of Data
- CWE-173 Improper Handling of Alternate Encoding
- CWE-179 Incorrect Behavior Order: Early Validation
- CWE-180 Incorrect Behavior Order: Validate Before Canonicalize
- CWE-181 Incorrect Behavior Order: Validate Before Filter
- CWE-183 Permissive List of Allowed Inputs
- CWE-184 Incomplete List of Disallowed Inputs
- CWE-697 Incorrect Comparison
- CWE-707 Improper Neutralization
Recent CVEs with these weaknesses
- 6.9CVE-2026-140128
A flaw has been found in Baison E3 Omni-Channel Retail Platform up to 2.5.1. Affected is an unknown function of the component KHATTACH Controller. Executing a manipulation of the argument retObjs can lead to sql injection. It is possible t…
- 5.5CVE-2026-139984
A weakness has been identified in walinejs Waline up to 1.43.6. The affected element is an unknown function of the component OAuth Login Callback Handler. Executing a manipulation of the argument Type can lead to improper input validation.…
- 5.5CVE-2026-139983
A vulnerability was identified in walinejs Waline up to 1.43.4. This issue affects some unknown processing. Such manipulation of the argument mail leads to sql injection. The attack can be executed remotely. The exploit is publicly availab…
- 5.5CVE-2026-139982
A vulnerability was found in PerfreeBlog up to 4.0.11. This issue affects the function buildPage of the file MyBatisUtils.java. Performing a manipulation of the argument Field results in sql injection. Remote exploitation of the attack is …
- 2.1CVE-2026-139980
A vulnerability was detected in PerfreeBlog up to 4.0.11. Affected by this issue is the function buildPage of the file MyBatisUtils.java. The manipulation of the argument Field results in sql injection. The attack can be launched remotely.…
- 7.7CVE-2026-105843
A flaw was found in OpenShift Router. The regular expression used to validate the haproxy.router.openshift.io/hsts_header route annotation matches the whitespace character class, which includes newline characters, and the matched value is …
- 2.1CVE-2026-139895
A vulnerability was determined in itsourcecode Stock Management System 1.0. The impacted element is an unknown function of the file fetchOrderData.php. Executing a manipulation of the argument orderId can lead to sql injection. It is possi…
- 5.3CVE-2026-130400
The iOS application "MynaApp (formerly Mynaportal App)" provided by Digital Agency contains an improper restriction vulnerability due to permissive list of allowed inputs. By clicking a malicious link, a user may be redirected to an arbitr…
The newest records naming one of them. Each weakness's page lists them all.
Related attack patterns
- Part of
- CAPEC-267 Leverage Alternate Encoding
Examples
Alternate Encoding with Ghost Characters in FTP and Web Servers
Alternate Encoding with Ghost Characters in FTP and Web Servers
Some web and FTP servers fail to detect prohibited upward directory traversals if the user-supplied pathname contains extra characters such as an extra leading dot. For example, a program that will disallow access to the pathname "../test.txt" may erroneously allow access to that file if the pathname is specified as ".../test.txt". This attack succeeds because 1) the input validation logic fails to detect the triple-dot as a directory traversal attempt (since it isn't dot-dot), 2) some part of the input processing decided to strip off the "extra" dot, leaving the dot-dot behind.
Using the file system API as the target, the following strings are all equivalent to many programs:
.../../../test.txt
............/../../test.txt
..?/../../test.txt
..????????/../../test.txt
../test.txtAs you can see, there are many ways to make a semantically equivalent request. All these strings ultimately result in a request for the file ../test.txt.
MITRE's words, unchanged: CAPEC-3 at MITRE. CAPEC is Copyright © 2007–2026, The MITRE Corporation, used under the CAPEC terms of use: “The MITRE Corporation (MITRE) hereby grants you a non-exclusive, royalty-free license to use Common Attack Pattern Enumeration and Classification (CAPEC™) for research, development, and commercial purposes. Any copy you make for such purposes is authorized provided that you reproduce MITRE’s copyright designation and this license in any such copy.” CAPEC and the CAPEC logo are trademarks of The MITRE Corporation. Credits. All attack patterns.