Skip to main content
MSRC

IIS & ASP 向け検査・対策ツールを公開

小野寺です。

ニュースとしては、比較的下火になっているかもしれない、SQL インジェクションの対策が済んでいないサイトが、まだまだ、残っています。 しかし、実際に対策を進めてみると「検査方法が分からない」「開発元がもうすでに・・・」「色々有ってコードが変更できない」といった様々なフィードバックというか悩みがでてきます。

現在の SQL インジェクションの問題の怖いところは、侵害されたサイトが、そのサイトの利用者にも被害を伝播させるところです。そして利用者側で自衛するのは大変難しいと言えます。現在発見されている多くのパターンは、セキュリティ更新を適用しておけば被害を受ける可能性は低くなりますが、ゼロではありません。
将来、もしも未知の脆弱性が発見された場合、この多数の SQL インジェクションに耐性のないサイト群が犯罪者にとって都合のよい犯罪のプラットフォームになってしまう事も考えられます。

ということで、少なくとも先ずは、自分のところから何とかしようということになりまして、Internet Information Services (IIS) と ASP の対策・検査ツールを新たに提供することにしました。 (前置きが長かったです。)

**1. Microsoft Source Code Analyzer for SQL Injection (SQL インジェクションに関するソースコード分析ツール)
**このツールは、ASP のソースコードを静的に分析して、SQL インジェクションの原因となるような未検証の外��入力や、外部入力を直接使った SQL コマンド/ステートメントの構築等々を検出します。
ツールでは、以下の 6 種類の点について検査し、警告を出力します。

  • 80400 – Possible SQL Injection vulnerability through data that is read from the Request object without any input validation. These warnings are very likely bugs that must be fixed.
  • 80406 – Possible SQL Injection vulnerability through data that is read from the Request object where the input is passed through some unknown function calls that might perform data validation. If there is no data validation done inside the function call, then these are likely bugs else these are likely false positives.
  • 80403 – Possible SQL Injection vulnerability through data that comes from a backend server. If the data is controlled by an end user through some other web page then these are likely bugs. But if the data is well trusted then these may not be bugs. It is still a good practice to parameterize these queries as a defense in depth.
  • 80407 - Possible SQL Injection vulnerability through data that comes from a backend server and is passed through some unknown function calls. If the data is controlled by an end user through some other web pages and if there is no data validation performed on this data, then these are likely bugs.
  • 80420 – Possible SQL Injection vulnerability through function parameters. These warnings are generated at function scope, so if the function parameter values come from trusted sources then these are false positives. If the parameter values are controlled by end users then these are very likely bugs. You can use sql_pre_validated annotation on the function parameters to detect if end users can reach this code.
  • 80421 – Possible SQL Injection vulnerability through function parameters and the function parameters are passed through some unknown function calls that might perform data validation. You can use sql_pre_validated annotation on the function parameters and sql_validate on validation function to detect if end users can reach this code.

既存の ASP で一度、どんな項目が検出されるかチェックしてみてもよいかもしれません。
使い方は、以下の様な感じで、検査対象の ASP ソースを指定するだけです。 ツールは、自動的にページ遷移を追いかけませんので、複数の ASP ファイルが有る場合は、個別に検査する必要が有ります。

msscasi_asp.exe /input=“default.asp”

2. URLScan の新バージョン (3.0 ベータ) 今までも、URLScan で不正なリクエストをある程度拒否する事が出来たのですが、最近の SQL インジェクション攻撃を防ぐののに便利なオプションを追加しました。
まだ、ベータという扱いですが、既存のコードに一切手を入れることなくリスクを減らすことが可能です。 とはいえ、脆弱なコード、このツールを導入しても脆弱なままですし、すべてのケースで防げるとは限りません。 URLScan は、本来は「コードが対策済みで、もし、脆弱性が見つかっても」不正なリクエストを拒否する事で、実際の被害にはつながらない様にするためのリスク要因緩和ツールです。
決して、コード上の脆弱性対策の恒久的な代替え手段ではありません。


Related Posts

How satisfied are you with the MSRC Blog?

Rating

Thank you for your feedback!

We'll review your input and work on improving the site.