Class · High

CWE-610: Externally Controlled Reference to a Resource in Another Sphere

The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.

CWE-610 · Class Level ·6 CVEs

Description

The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.

Potential Impact

Confidentiality, Integrity

Read Application Data, Modify Application Data

Access Control

Gain Privileges or Assume Identity

Demonstrative Examples

The following code is a Java servlet that will receive a GET request with a url parameter in the request to redirect the browser to the address specified in the url parameter. The servlet will retrieve the url parameter value from the request and send a response to redirect the browser to the url address.
Bad
public class RedirectServlet extends HttpServlet {
               
                 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {String query = request.getQueryString();if (query.contains("url")) {String url = request.getParameter("url");response.sendRedirect(url);}}
               }
The problem with this Java servlet code is that an attacker could use the RedirectServlet as part of an e-mail phishing scam to redirect users to a malicious site. An attacker could send an HTML formatted e-mail directing the user to log into their account by including in the e-mail the following link:
Attack
<a href="http://bank.example.com/redirect?url=http://attacker.example.net">Click here to log in</a>
The user may assume that the link is safe since the URL starts with their trusted bank, bank.example.com. However, the user will then be redirected to the attacker's web site (attacker.example.net) which the attacker may have made to appear very similar to bank.example.com. The user may then unwittingly enter credentials into the attacker's web page and compromise their bank account. A Java servlet should never redirect a user to a URL without verifying that the redirect address is a trusted site.

Real-World CVE Examples

CVE IDDescription
CVE-2022-3032An email client does not block loading of remote objects in a nested document.
CVE-2022-45918Chain: a learning management tool debugger uses external input to locate previous session logs (CWE-73) and does not properly validate the given path (CWE-20), allowing for filesystem path traversal u
CVE-2018-1000613Cryptography API uses unsafe reflection when deserializing a private key
CVE-2020-11053Chain: Go-based Oauth2 reverse proxy can send the authenticated user to another site at the end of the authentication flow. A redirect URL with HTML-encoded whitespace characters can bypass the valida
CVE-2022-42745Recruiter software allows reading arbitrary files using XXE
CVE-2004-2331Database system allows attackers to bypass sandbox restrictions by using the Reflection API.

Frequently Asked Questions

What is CWE-610?

CWE-610 (Externally Controlled Reference to a Resource in Another Sphere) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Class-level weakness. The product uses an externally controlled name or reference that resolves to a resource that is outside of the intended control sphere.

How can CWE-610 be exploited?

Attackers can exploit CWE-610 (Externally Controlled Reference to a Resource in Another Sphere) to read application data, modify application data. This weakness is typically introduced during the Architecture and Design phase of software development.

How do I prevent CWE-610?

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-610?

CWE-610 is classified as a Class-level weakness (High abstraction). It has been observed in 6 real-world CVEs.