CAPEC-13
Subverting Environment Variable Values
The adversary directly or indirectly modifies environment variables used by or controlling the target software. The adversary's goal is to cause the target software to deviate from its expected operation in a manner that benefits the adversary.
On this page
Ask an AI about this attack pattern
Show the prompt
Explain the attack pattern CAPEC-13: Subverting Environment Variable Values: how it unfolds, what it needs and how to prevent and detect it in my systems. Use https://capec.mitre.org/data/definitions/13.html and https://cve.bz/cve/capec/13?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.
[Probe target application] The adversary first probes the target application to determine important information about the target. This information could include types software used, software versions, what user input the application consumes, and so on. Most importantly, the adversary tries to determine what environment variables might be used by the underlying software, or even the application itself.
Experiment
They probe what they found.
[Find user-controlled environment variables] Using the information found by probing the application, the adversary attempts to manipulate any user-controlled environment variables they have found are being used by the application, or suspect are being used by the application, and observe the effects of these changes. If the adversary notices any significant changes to the application, they will know that a certain environment variable is important to the application behavior and indicates a possible attack vector.
1 technique
- Alter known environment variables such as "$PATH", "$HOSTNAME", or "LD_LIBRARY_PATH" and see if application behavior changes.
Exploit
They carry out the attack.
[Manipulate user-controlled environment variables] The adversary manipulates the found environment variable(s) to abuse the normal flow of processes or to gain access to privileged resources.
Prerequisites
An environment variable is accessible to the user.
An environment variable used by the application can be tainted with user supplied data.
Input data used in an environment variable is not validated properly.
The variables encapsulation is not done properly. For instance setting a variable as public in a class makes it visible and an adversary may attempt to manipulate that variable.
Skills required
- Low skill
In a web based scenario, the client controls the data that it submitted to the server. So anybody can try to send malicious data and try to bypass the authentication mechanism.
- High skill
Some more advanced attacks may require knowledge about protocols and probing technique which help controlling a variable. The malicious user may try to understand the authentication mechanism in order to defeat it.
Consequences
| Impact | Affects | Note |
|---|---|---|
| Execute Unauthorized Commands | Confidentiality, Integrity, Availability | Run Arbitrary Code |
| Bypass Protection Mechanism | Confidentiality, Access Control, Authorization | |
| Unreliable Execution | Availability | |
| Read Data | Confidentiality | |
| Hide Activities | Accountability |
Mitigations
Protect environment variables against unauthorized read and write access.
Protect the configuration files which contain environment variables against illegitimate read and write access.
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.
Apply the least privilege principles. If a process has no legitimate reason to read an environment variable do not give that privilege.
Weaknesses it exploits
- CWE-15 External Control of System or Configuration Setting
- CWE-20 Improper Input Validation
- CWE-73 External Control of File Name or Path
- CWE-74 Improper Neutralization of Special Elements in Output Used by a Downstream Component
- CWE-200 Exposure of Sensitive Information to an Unauthorized Actor
- CWE-285 Improper Authorization
- CWE-302 Authentication Bypass by Assumed-Immutable Data
- CWE-353 Missing Support for Integrity Check
Recent CVEs with these weaknesses
- 5.3CVE-2026-140130
A flaw has been found in jobic10 student-management-using-django up to 066dcaeffc52fe52e9279d93e2a00c15909544ae. This affects the function get_students/save_attendance/get_student_attendance/update_attendance of the file main_app/staff_vie…
- 3.3CVE-2026-118999
Permission control vulnerability in the theme setting module. Impact: Successful exploitation of this vulnerability may affect service confidentiality.
- 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-140052
A vulnerability was identified in g-mr SmartCall up to 1.0.9. This vulnerability affects the function token of the file smart-maxkb/src/main/java/com/qidiangk/smart/maxkb/controller/TokenController.java of the component smart-maxkb. Such m…
- 6.2CVE-2026-119008
Vulnerability of improper data management in the location service module. Impact: Successful exploitation of this vulnerability may affect service confidentiality.
- 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 …
The newest records naming one of them. Each weakness's page lists them all.
Related attack patterns
- Part of
- CAPEC-77 Manipulating User-Controlled Variables
- Can lead to
- CAPEC-14 Client-side Injection-induced Buffer Overflow
- Related to
- CAPEC-10 Buffer Overflow via Environment Variables
Examples
Changing the LD_LIBRARY_PATH environment variable in TELNET will cause TELNET to use an alternate (possibly T…
Changing the LD_LIBRARY_PATH environment variable in TELNET will cause TELNET to use an alternate (possibly Trojan) version of a function library. The Trojan library must be accessible using the target file system and should include Trojan code that will allow the user to log in with a bad password. This requires that the adversary upload the Trojan library to a specific location on the target. As an alternative to uploading a Trojan file, some file systems support file paths that include remote addresses, such as \\172.16.2.100\shared_files\trojan_dll.dll. See also: Path Manipulation (CVE-1999-0073)
The HISTCONTROL environment variable keeps track of what should be saved by the history command and eventuall…
The HISTCONTROL environment variable keeps track of what should be saved by the history command and eventually into the ~/.bash_history file when a user logs out. This setting can be configured to ignore commands that start with a space by simply setting it to "ignorespace". HISTCONTROL can also be set to ignore duplicate commands by setting it to "ignoredups". In some Linux systems, this is set by default to "ignoreboth" which covers both of the previous examples. This means that " ls" will not be saved, but "ls" would be saved by history. HISTCONTROL does not exist by default on macOS, but can be set by the user and will be respected. Adversaries can use this to operate without leaving traces by simply prepending a space to all of their terminal commands.
MITRE's words, unchanged: CAPEC-13 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.