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?

【20個目】【SQLインジェクション】SQL injection with filter bypass via XML encoding

Posted at

SQL injection with filter bypass via XML encoding

概要

一般的な攻撃文字列がWAFでブロックされているのをバイパスして管理者のアカウントを取得する

攻撃手順

  • クエリパラメタでリクエストしている通信を見つけて、サーバーと通信していると推測してRepeterに送る
  • IDの箇所を1+1などの式に変更して処理が通るか確認。通れば、SQLが実行されていると推測する
  • リクエストパラメタのXMLの値を1 UNION SELECT NULLに変更して処理が通るか確認
  • WAFでブロックされる場合、Hackvertorの「Encode/Decode」機能を使い、対象文字列を選択してエンコードする

対策

  • プレースホルダー(プリペアドステートメント)を利用する

予想される正規のSQL

SELECT stock FROM products WHERE product_id = 1 AND store_id = 1

予想される実行されるSQL

SELECT stock FROM products WHERE product_id = 1 AND store_id = 1 UNION SELECT username || '~' || password FROM users
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?