5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

OWASP ZAPで送信されるリクエストにBearer Tokenを付与する方法

Last updated at Posted at 2020-12-14

備忘録
参考サイト:https://www.pupha.net/archives/2654/
脆弱性診断をはじめて2日目。
.NETCoreで作成したAPIを脆弱性診断してみよう。

スクリプトを作成

[表示] -> [スクリプト] -> スクリプトタブを選択

  • Type:Stand Alone
  • Script engine: ECMAScript: Oracle Nashorn
  • テンプレート:なし

👇貼り付け。

 // HttpSenderListenerというインタフェースを持ったリスナーを HttpSender に登録する
 org.parosproxy.paros.network.HttpSender.addListener(
   new org.zaproxy.zap.network.HttpSenderListener {
     getListenerOrder: function() {
       return 1;
     },

     // リクエスト送信前に呼ばれる
     onHttpRequestSend: function(msg, initiator) {
       msg.getRequestHeader().setHeader(
         "Authorization", "Bearer [myToken]");
     },

     // レスポンス取得後に呼ばれる
     onHttpResponseReceive: function(msg, initiator) {
     }
 });

[myToken]を置き換える。
置き換えたら実行しよう。

スクリプトでToken取得の処理書いてもいけそう。
今回はAuthorizationヘッダを追加しているが他のヘッダを追加するときにも同様の方法ができそう。

5
6
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
5
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?