0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【29個目】【CORS】 CORS vulnerability with basic origin reflection

Posted at

CORS vulnerability with basic origin reflection

概要

CORSの脆弱性を利用して、被害者のAPIキーを取得する

攻撃手順

  • Access-Control-Allow-Credentialsヘッダーがレスポンスに含まれていることを確認
  • Access-Control-Allow-Originヘッダーの値がリクエスト時のOriginヘッダーと同一であることを確認
  • 画面からAPIキーを取得し、攻撃者のサイトへリクエストするためのエクスプロイトを作成

対策

  • エスケープ処理を行う

メモ

  • Access-Control-Allow-Credentialsヘッダがtrueの場合
    • ブラウザはオリジンが異なるサーバに対し、Cookie、Authorizationヘッダ、TLSクライアント証明書などの資格情報を送信できるようになる
    • ただし、Access-Control-Allow-Originヘッダに指定されているオリジンに対して適用される(ワイルドカード「*」は使用できない)
  • withCredentialsがtrueに設定されると、HostヘッダのCookieを探し、リクエストヘッダーに追加してサーバに送る。falseの場合、Cookieは送信されない

クリアするまでにかかった時間

  • 1h
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?