CWEweakness

CWE-829 Inclusion of Functionality from Untrusted Control Sphere

Official page ↗
Abstraction
Base
Structure
Simple
Status
Incomplete
Languages
Not Language-Specific
CWE version
5.0

Description

The product imports, requires, or includes executable functionality (such as a library) from a source that is outside of the intended control sphere.

Common consequences

• Confidentiality, Integrity, Availability: Execute Unauthorized Code or Commands — An attacker could insert malicious functionality into the program by causing the program to download code that the attacker has placed into the untrusted control sphere, such as a malicious web site. This could enable the injection of malware, information exposure by granting excessive privileges or permissions to the untrusted functionality, DOM-based XSS vulnerabilities, stealing user's cookies, open redirect to malware (CWE-601), etc.

Potential mitigations

• [Architecture and Design] Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482]. • [Architecture and Design] When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs. For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap [REF-45] provide this capability. • [Architecture and Design] For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server. • [Architecture and Design, Operation] Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software. OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails. • [Architecture and Design, Operation] Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations. • [Implementation] Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does. When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue." Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright. When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434. Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would be removed from the original string, but the remaining characters would still form the "../" string. • [Architecture and Design, Operation] Store library, include, and utility files outside of the web document root, if possible. Otherwise, store them in a separate directory and use the web server's access control capabilities to prevent attackers from directly requesting them. One common practice is to define a fixed constant in each calling program, then check for the existence of the constant in the library/include file; if the constant does not exist, then the file was directly requested, and it can exit immediately. This significantly reduces the chance of an attacker being able to bypass any protection mechanisms that are in the base program but not in the include files. It will also reduce the attack surface. • [Architecture and Design, Implementation] Understand all the potential areas where untrusted inputs can enter your software: parameters or arguments, cookies, anything read from the network, environment variables, reverse DNS lookups, query results, request headers, URL components, e-mail, files, filenames, databases, and any external systems that provide data to the application. Remember that such inputs may be obtained indirectly through API calls. Many file inclusion problems occur because the programmer assumed that certain inputs could not be modified, especially for cookies and URL components. • [Operation] Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].

Detection methods

• Automated Static Analysis - Binary or Bytecode: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Bytecode Weakness Analysis - including disassembler + source code weakness analysis • 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 • Dynamic Analysis with Manual Results Interpretation: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Forced Path Execution • Monitored Virtual Environment - run potentially malicious code in sandbox / wrapper / virtual machine, see if it does anything suspicious • Manual Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Manual Source Code Review (not inspections) Cost effective for partial coverage: • Focused Manual Spotcheck - Focused manual analysis of source • Automated Static Analysis - Source Code: According to SOAR [REF-1479], the following detection techniques may be useful: Cost effective for partial coverage: • Source code Weakness Analyzer • Context-configured Source Code Weakness Analyzer • Architecture or Design Review: According to SOAR [REF-1479], the following detection techniques may be useful: Highly cost effective: • Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.) • Formal Methods / Correct-By-Construction Cost effective for partial coverage: • Attack Modeling

Observed examples

• CVE-2010-2076: Product does not properly reject DTDs in SOAP messages, which allows remote attackers to read arbitrary files, send HTTP requests to intranet servers, or cause a denial of service. • CVE-2004-0285: Modification of assumed-immutable configuration variable in include file allows file inclusion via direct request. • CVE-2004-0030: Modification of assumed-immutable configuration variable in include file allows file inclusion via direct request. • CVE-2004-0068: Modification of assumed-immutable configuration variable in include file allows file inclusion via direct request. • CVE-2005-2157: Modification of assumed-immutable configuration variable in include file allows file inclusion via direct request. • CVE-2005-2162: Modification of assumed-immutable configuration variable in include file allows file inclusion via direct request. • CVE-2005-2198: Modification of assumed-immutable configuration variable in include file allows file inclusion via direct request. • CVE-2004-0128: Modification of assumed-immutable variable in configuration script leads to file inclusion. • CVE-2005-1864: PHP file inclusion. • CVE-2005-1869: PHP file inclusion. • CVE-2005-1870: PHP file inclusion. • CVE-2005-2154: PHP local file inclusion. • CVE-2002-1704: PHP remote file include. • CVE-2002-1707: PHP remote file include. • CVE-2005-1964: PHP remote file include. • CVE-2005-1681: PHP remote file include. • CVE-2005-2086: PHP remote file include. • CVE-2004-0127: Directory traversal vulnerability in PHP include statement. • CVE-2005-1971: Directory traversal vulnerability in PHP include statement. • CVE-2005-3335: PHP file inclusion issue, both remote and local; local include uses ".." and "%00" characters as a manipulation, but many remote file inclusion issues probably have this vector.

Related

Attack pattern · CAPEC (13)

  • CAPEC-175 Code Inclusion attack pattern
  • CAPEC-201 Serialized Data External Linking attack pattern
  • CAPEC-228 DTD Injection attack pattern
  • CAPEC-251 Local Code Inclusion attack pattern
  • CAPEC-252 PHP Local File Inclusion attack pattern
  • CAPEC-253 Remote Code Inclusion attack pattern
  • CAPEC-263 Force Use of Corrupted Files attack pattern
  • CAPEC-538 Open-Source Library Manipulation attack pattern
  • CAPEC-549 Local Execution of Code attack pattern
  • CAPEC-640 Inclusion of Code in Existing Process attack pattern
  • CAPEC-660 Root/Jailbreak Detection Evasion via Hooking attack pattern
  • CAPEC-695 Repo Jacking attack pattern
  • CAPEC-698 Install Malicious Extension attack pattern

Observed example · CVE (20)

  • CVE-2010-2076 Apache CXF 2.0.x before 2.0.13, 2.1.x before 2.1.10, and 2.2.x before 2.2.9, as used in Apache ServiceMix, Apache Camel, Apache Chemistry,… vulnerability
  • CVE-2005-3335 PHP file inclusion vulnerability in bug_sponsorship_list_view_inc.php in Mantis 1.0.0RC2 and 0.19.2 allows remote attackers to execute… vulnerability
  • CVE-2005-2198 PHP remote file inclusion vulnerability in lang.php in SPiD before 1.3.1 allows remote attackers to execute arbitrary code via the… vulnerability
  • CVE-2005-2154 PHP local file inclusion vulnerability in (1) view.php and (2) open.php in osTicket 1.3.1 beta and earlier allows remote attackers to… vulnerability
  • CVE-2005-2157 PHP remote file inclusion vulnerability in survey.inc.php for nabopoll 1.2 allows remote attackers to execute arbitrary PHP code via the… vulnerability
  • CVE-2005-2162 PHP remote file inclusion vulnerability in form.inc.php3 in MyGuestbook 0.6.1 allows remote attackers to execute arbitrary PHP code via the… vulnerability
  • CVE-2005-2086 PHP remote file inclusion vulnerability in viewtopic.php in phpBB 2.0.15 and earlier allows remote attackers to execute arbitrary PHP code. vulnerability
  • CVE-2005-1971 Directory traversal vulnerability in InteractivePHP FusionBB .11 Beta and earlier allows remote attackers to include arbitrary local files… vulnerability
  • CVE-2005-1864 PHP remote file inclusion vulnerability in cal_admintop.php in Calendarix Advanced 1.5 allows remote attackers to execute arbitrary PHP… vulnerability
  • CVE-2005-1870 PHP remote file inclusion vulnerability in childwindow.inc.php in Popper 1.41-r2 and earlier allows remote attackers to execute arbitrary… vulnerability
  • CVE-2005-1964 PHP remote file inclusion vulnerability in utilit.php for Ovidentia Portal allows remote attackers to execute arbitrary PHP code via the… vulnerability
  • CVE-2005-1869 PHP remote file inclusion vulnerability in start_lobby.php in MWChat 6.x allows remote attackers to execute arbitrary PHP code via the… vulnerability
  • CVE-2005-1681 PHP remote file inclusion vulnerability in common.php in phpATM 1.21, and possibly earlier versions, allows remote attackers to execute… vulnerability
  • CVE-2004-0285 PHP remote file inclusion vulnerabilities in include/footer.inc.php in (1) AllMyVisitors, (2) AllMyLinks, and (3) AllMyGuests allow remote… vulnerability
  • CVE-2004-0127 Directory traversal vulnerability in editconfig_gedcom.php for phpGedView 2.65.1 and earlier allows remote attackers to read arbitrary… vulnerability
  • CVE-2004-0128 PHP remote file inclusion vulnerability in the GEDCOM configuration script for phpGedView 2.65.1 and earlier allows remote attackers to… vulnerability
  • CVE-2004-0068 PHP remote file inclusion vulnerability in config.php for PhpDig 1.6.5 and earlier allows remote attackers to execute arbitrary PHP code by… vulnerability
  • CVE-2004-0030 PHP remote file inclusion vulnerability in (1) functions.php, (2) authentication_index.php, and (3) config_gedcom.php for PHPGEDVIEW 2.61… vulnerability
  • CVE-2002-1704 Zeroboard 4.1, when the "allow_url_fopen" and "register_globals" variables are enabled, allows remote attackers to execute arbitrary PHP… vulnerability
  • CVE-2002-1707 install.php in phpBB 2.0 through 2.0.1, when "allow_url_fopen" and "register_globals" variables are set to "on", allows remote attackers to… vulnerability

Child of · CWE (1)

  • CWE-669 Incorrect Resource Transfer Between Spheres weakness

Referenced by CAPEC · weakness (13)

  • CAPEC-175 Code Inclusion attack pattern
  • CAPEC-201 Serialized Data External Linking attack pattern
  • CAPEC-228 DTD Injection attack pattern
  • CAPEC-251 Local Code Inclusion attack pattern
  • CAPEC-252 PHP Local File Inclusion attack pattern
  • CAPEC-253 Remote Code Inclusion attack pattern
  • CAPEC-263 Force Use of Corrupted Files attack pattern
  • CAPEC-538 Open-Source Library Manipulation attack pattern
  • CAPEC-549 Local Execution of Code attack pattern
  • CAPEC-640 Inclusion of Code in Existing Process attack pattern
  • CAPEC-660 Root/Jailbreak Detection Evasion via Hooking attack pattern
  • CAPEC-695 Repo Jacking attack pattern
  • CAPEC-698 Install Malicious Extension attack pattern

Referenced by CVE · weakness (381)

  • CVE-2023-7357 A remote code execution (RCE) vulnerability was identified in the FlexNet Publisher lmadmin web user interface. vulnerability
  • CVE-2026-114488 A flaw was found in Wildfly. vulnerability
  • CVE-2026-118762 Monkeytype is a minimalistic and customizable typing test. vulnerability
  • CVE-2026-15564 Wildfly's IIOP listener may permit deserialization of input streams before authentication is performed. vulnerability
  • CVE-2026-59172 Joker is a small Clojure interpreter, linter and formatter written in Go. vulnerability
  • CVE-2026-59176 Functype is a family of TypeScript functional programming libraries. vulnerability
  • CVE-2026-84725 when EAP runs with -secmgr, the openjdk-orb's JDKBridge honours attacker-supplied CDR codebase URLs during object unmarshalling on :3528,… vulnerability
  • CVE-2026-116843 Mistral Vibe before 3.0.3 contains a remote code execution vulnerability that allows attackers to run commands by defining git filter… vulnerability
  • CVE-2026-65119 NVIDIA TensorRT-LLM for any platform contains a vulnerability in KvCacheAwareRouter tokenizer loading, where an attacker could cause… vulnerability
  • CVE-2026-115802 A weakness has been identified in InternScience InternAgent 1.5.0. vulnerability
  • CVE-2026-114727 Roundcube Webmail before 1.6.20 and 1.7.x before 1.7.5 passes potentially unsafe content into ImageMagick when resizing images. vulnerability
  • CVE-2026-54532 CloudPirates Open Source Helm Charts is a collection of Helm charts. vulnerability
  • CVE-2026-113461 Local privilege escalation in Checkmk 2.5.0p14 allows a local user with write access to the Oracle client library directory of an Oracle… vulnerability
  • CVE-2026-113709 Argo CD is a declarative, GitOps continuous delivery tool for Kubernetes. vulnerability
  • CVE-2026-86948 This issue was addressed by enforcing library validation on the affected binaries. vulnerability
  • CVE-2026-86949 This issue was addressed by enforcing library validation on the affected binaries. vulnerability
  • CVE-2026-111091 In JetBrains Junie CLI before 26.8.3 code execution was possible via an untrusted project's MCP server configuration vulnerability
  • CVE-2026-111357 Ivanti Connect Secure 22.8R2.4 mishandles the manner in which the dsinvoked broker trusts DSCache configuration data, leading to privilege… vulnerability
  • CVE-2026-73800 Gitea resolves local reusable workflow files from a fork's head commit when a trusted base-branch workflow runs for a pull_request_target… vulnerability
  • CVE-2026-55675 The Salty documentation repository builds and deploys the docs.saltbox.dev website. vulnerability
  • CVE-2026-70267 Inclusion of functionality from untrusted control sphere in Microsoft Office SharePoint allows an authorized attacker to execute code over… vulnerability
  • CVE-2026-85355 Inclusion of functionality from untrusted control sphere in Windows Common Log File System Driver allows an authorized attacker to elevate… vulnerability
  • CVE-2026-86063 Claude Code is an agentic coding tool. vulnerability
  • CVE-2026-87695 Inclusion of functionality from untrusted control sphere in Microsoft Exchange Server allows an authorized attacker to elevate privileges… vulnerability
  • CVE-2026-96237 Inclusion of functionality from untrusted control sphere in .NET allows an unauthorized attacker to execute code over a network. vulnerability
  • CVE-2026-108913 omarchy-theme-set in Omarchy 4 before 4.0.1 allows code execution via a third-party theme because the files placed into… vulnerability
  • CVE-2026-78019 Dell Secure Connect Gateway (SCG) Policy Manager, versions prior to 5.34.00.16, contains an Inclusion of Functionality from Untrusted… vulnerability
  • CVE-2026-92705 Aegisub is a cross-platform advanced subtitle editor. vulnerability
  • CVE-2026-105331 Local privilege escalation in Checkmk 2.5.0 before 2.5.0p10 allows a user with access to edit the Oracle Instant Client referenced by the… vulnerability
  • CVE-2026-104809 DigitalCanion has discovered a vulnerability that allows an attacker to cause the system to load an attacker-controlled .so file instead of… vulnerability
Show all 381 ›

Referenced by CWE · child of (3)

  • CWE-827 Improper Control of Document Type Definition weakness
  • CWE-830 Inclusion of Web Functionality from an Untrusted Source weakness
  • CWE-98 Improper Control of Filename for Include/Require Statement in PHP Program weakness

Referenced by CWE · has member (1)

Referenced by OWASP · mapped cwe (2)

  • A08:2025 Software or Data Integrity Failures Top 10 2025
  • A08:2021 Software and Data Integrity Failures Top 10 2021