路径相关样式表导入漏洞

use*_*104 5 css security

为了避免路径相关的样式表导入漏洞,我应该使用完整路径在我的页面上附加 css 文件,例如

<link href="http://mywebsite/style.css" type="text/css" rel="stylesheet" />
Run Code Online (Sandbox Code Playgroud)

代替

<link href="style.css" type="text/css" rel="stylesheet" />
Run Code Online (Sandbox Code Playgroud)

你怎么认为?

Adr*_*ria 8

只需添加一个前导斜杠并使路径相对于根目录,而不是此漏洞所依赖的相对路径。
不需要域/方案。

 <link rel="stylesheet" href="/style.css">
Run Code Online (Sandbox Code Playgroud)