[アップデート] AWS WAF向けAWS製のManaged Rulesが出ました

本日AWS Managed Rules for AWS WAFが発表されたのでご紹介します。 早速、その変更点と、「SQL databaseルール」でWAFを検知させてみましたのでご紹介します。
2019.11.26

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

こんにちはコカコーラ大好き、カジです。

本日AWS Managed Rules for AWS WAFが発表されたのでご紹介します。

Announcing AWS Managed Rules for AWS WAF | AWS News Blog

早速、その変更点と、AWS Managed Rulesの「SQL databaseルール」で検知させてみました。 また、AWS Managed Rulesの一覧をまとめてみましたので、どなたかのお役に立てれば光栄です。

目次

変更点

  • AWS製のManaged RulesがGUIで簡単に設定ができる(ルールの一覧については本ページの下部に記載)
  • Web ACLの上限が10から、WCUs(Web ACL capacity units)で管理
  • Web ACLのグループ上限が2から、WCUs(Web ACL capacity units)で管理
  • 新GUI上にてセキュリティベンダーのルールがCyber Security CloudとFortinetの2社のルールのみ(2019/11/26時点のため、今後追加になると推測)

推測ですがAWS Managed Ruleについては、以前はCloudFormationで導入していたものから強化されていると思います。

AWSセキュリティホワイトペーパー「Use AWS WAF to Mitigate OWASP’s Top 10 Web Application Vulnerabilities」のご紹介 | Developers.IO

試してみる

新しいGUIへ変更

Web ACLの名前入力

マネージドルールを追加

以下の画面が表示されるのにしばらく待つ必要がある場合があります。

今回はSQLインジェクションの保護を設定してみます。カウントのみにしています。

優先度を設定できますが、今回1つのみのためそのままとします。

CloudWatchのメトリクス名はそのままでOKのため、そのままにします。(名前が決められるの良いですね。)

現在までの設定を確認し、「Create web ACL」をクリックします。

作成までしばらく数分かかりました。

CloudFrontへ適用

ウィザード中でも追加できたのですが、Web ACLを作成後にCloudFrontに適用しています。

検知テスト

curlでAWS WAFを適用したURLへテストアクセスを行い、検知できました。

検知した画面

表示までにしばらくかかる場合や、更新ボタンを押さないと表示されない場合がありました。下側に検知した1行が表示されました。

試したコマンド

$ curl -v -X GET -d '? or 1=1-- ' http://www.kajihiroyuki.classmethod.info
* Rebuilt URL to: http://www.kajihiroyuki.classmethod.info/
* Trying 99.84.143.21...
* TCP_NODELAY set
* Connected to www.kajihiroyuki.classmethod.info (99.84.143.21) port 80 (#0)
> GET / HTTP/1.1
> Host: www.kajihiroyuki.classmethod.info
> User-Agent: curl/7.54.0
> Accept: */*
> Content-Length: 11
> Content-Type: application/x-www-form-urlencoded
>
* upload completely sent off: 11 out of 11 bytes
< HTTP/1.1 403 Forbidden
< Server: CloudFront
< Date: Tue, 26 Nov 2019 06:08:05 GMT
< Content-Type: text/html
< Content-Length: 915
< Connection: keep-alive
< X-Cache: Error from cloudfront
< Via: 1.1 c159eb62f3c6d01f9dfafeaa1db9fd24.cloudfront.net (CloudFront)
< X-Amz-Cf-Pop: NRT57-C3
< X-Amz-Cf-Id: aqQrDte6U8jQp81x235ZbP32gtNqyQsVetyelbMJyQge6PI73HlE5Q==
<
<h1>403 ERROR</h1>
<h2>The request could not be satisfied.</h2>

<hr noshade="noshade" size="1px" />

Bad request.
We can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website owner.
<br clear="all" />If you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.
<br clear="all" />

<hr noshade="noshade" size="1px" />

<pre>Generated by cloudfront (CloudFront)
Request ID: aqQrDte6U8jQp81x235ZbP32gtNqyQsVetyelbMJyQge6PI73HlE5Q==
</pre>
<address> </address>* Connection #0 to host www.kajihiroyuki.classmethod.info left intact

AWS Managed Rules一覧

最後に、AWS Managed Ruleの一覧についての説明をAmazon Translateで翻訳したものを貼っておきます。 どのようなルールがあるのか参考になれば幸いです。

Admin protection

Contains rules that allow you to block external access to exposed admin pages. This may be useful if you are running third-party software or would like to reduce the risk of a malicious actor gaining administrative access to your application.

(Amazon Translateの直訳) 公開された管理ページへの外部アクセスをブロックするためのルールが含まれています。 これは、サードパーティのソフトウェアを実行している場合や、悪意のあるアクターがアプリケーションへの管理アクセスを得るリスクを軽減したい場合に便利です。

Amazon IP reputation list

This group contains rules that are based on Amazon threat intelligence. This is useful if you would like to block sources associated with bots or other threats.

(Amazon Translateの直訳) このグループには、Amazon の脅威インテリジェンスに基づくルールが含まれます。 これは、ボットやその他の脅威に関連するソースをブロックしたい場合に便利です。

Core rule set

Contains rules that are generally applicable to web applications. This provides protection against exploitation of a wide range of vulnerabilities, including those described in OWASP publications and common Common Vulnerabilities and Exposures (CVE).

(Amazon Translateの直訳) Web アプリケーションに一般的に適用可能なルールが含まれています。 これにより、OWASP の出版物および一般的な脆弱性およびエクスポージャー (CVE) に記載されているものを含む、幅広い脆弱性の悪用に対する保護が提供されます。

Known bad inputs

Contains rules that allow you to block request patterns that are known to be invalid and are associated with exploitation or discovery of vulnerabilities. This can help reduce the risk of a malicious actor discovering a vulnerable application.

(Amazon Translateの直訳) 無効であることがわかり、脆弱性の悪用または発見に関連する要求パターンをブロックするためのルールが含まれています。 これにより、悪意のあるアクターが脆弱なアプリケーションを発見するリスクを軽減できます。

Linux operating system

Contains rules that block request patterns associated with exploitation of vulnerabilities specific to Linux, including LFI attacks. This can help prevent attacks that expose file contents or execute code for which the attacker should not have had access.

(Amazon Translateの直訳) LFI 攻撃を含む Linux 固有の脆弱性の悪用に関連する要求パターンをブロックするルールが含まれます。 これにより、攻撃者がアクセスしてはならないファイルの内容を公開したり、コードを実行したりする攻撃を防ぐことができます。

PHP application

Contains rules that block request patterns associated with exploiting vulnerabilities specific to the use of the PHP, including injection of unsafe PHP functions. This can help prevent exploits that allow an attacker to remotely execute code or commands.

(Amazon Translateの直訳) 安全でないPHP関数の注入など、PHPの使用に固有の脆弱性を悪用するリクエストパターンをブロックするルールが含まれています。 これにより、攻撃者がリモートでコードやコマンドを実行できる悪用を防ぐことができます。

POSIX operating system

Contains rules that block request patterns associated with exploiting vulnerabilities specific to POSIX/POSIX-like OS, including LFI attacks. This can help prevent attacks that expose file contents or execute code for which access should not been allowed.

(Amazon Translateの直訳) LFI 攻撃を含む POSIX/POSIX に似た OS に固有の脆弱性の悪用に関連する要求パターンをブロックするルールが含まれています。 これにより、ファイルの内容を公開したり、アクセスを許可してはならないコードを実行したりする攻撃を防ぐことができます。

SQL database

Contains rules that allow you to block request patterns associated with exploitation of SQL databases, like SQL injection attacks. This can help prevent remote injection of unauthorized queries.

(Amazon Translateの直訳) SQL インジェクション攻撃など、SQL データベースの悪用に関連する要求パターンをブロックできるルールが含まれています。 これにより、不正なクエリのリモートインジェクションを防ぐことができます。

Windows operating system

Contains rules that block request patterns associated with exploiting vulnerabilities specific to Windows, (e.g., PowerShell commands). This can help prevent exploits that allow attacker to run unauthorized commands or execute malicious code.

(Amazon Translateの直訳) Windows 固有の脆弱性 (PowerShell コマンドなど) の悪用に関連する要求パターンをブロックするルールが含まれます。 これにより、攻撃者が不正なコマンドを実行したり、悪意のあるコードを実行したりする悪用を防ぐことができます。

WordPress application

The WordPress Applications group contains rules that block request patterns associated with the exploitation of vulnerabilities specific to WordPress sites.

(Amazon Translateの直訳) WordPress アプリケーショングループには、WordPress サイト固有の脆弱性の悪用に関連する要求パターンをブロックするルールが含まれています。

その他

セキュリティベンダーのルール(Cyber Security CloudとFortinetの2社のルール)

以上、どなたかのお役に立てれば光栄です。