Configuration Management / Path-Relative Style Sheet Import
Path-relative style sheet import (CWE-16) is a vulnerability related to configuration management in web and API applications. It is a type of vulnerability that allows attackers to inject malicious code in a style sheet, which can in turn be used to steal sensitive data. This vulnerability is described in detail in the Common Weakness Enumeration (CWE) directory and is also covered in the OWASP Testing Guide.
This vulnerability can have a high impact as it can allow an attacker to steal and manipulate sensitive data. It can also be used to bypass authentication and authorization controls, leading to unauthorized access. To assess the risk, organizations should analyze the impact of the vulnerability, the likelihood of exploitation, and the effectiveness of the existing controls.
The best way to mitigate this vulnerability is to use relative path traversal instead of absolute paths in the style sheet import statements. This will prevent attackers from injecting malicious code into the style sheet. Additionally, organizations should configure their web application firewall to detect and block malicious attempts to access the style sheet.
The following code block demonstrates an example of the vulnerability, taken from the CVE directory:
<link rel="stylesheet" href="../../../../../etc/passwd" type="text/css">
This code allows an attacker to inject malicious code into the style sheet, which can be used to read sensitive data from the file