play_sessionがmod_securityの禁止設定にひっかかる現象

160 views
Skip to first unread message

樋口勝也

unread,
Jun 16, 2015, 1:01:07 PM6/16/15
to pla...@googlegroups.com
猫の手software 樋口と申します。

現在 Playframework2.3.8 を用いて、 Amazon EC2(Linux) 環境で動作するWebアプリケーション開発をしています。

その過程でmod_securityの導入試験をおこなっているのですが、
PLAY_SESSIONがSQL_INJECTIONとして検知されてしまっている状態です。
検知ログは最下部に記載致します。

そこで、以下の点についてアドバイスを頂けないでしょうか。

1.例外設定
現状で思いつくのはPLAY_SESSIONのみをmod_securityのフィルタリング対象外とすることですが、
設定方法が不明な状態です。
こちらできくのが適切かどうかわかりませんが、よろしくお願いいたします。

2.その他のmod_security設定
playframework + mod_security で運用する場合に、
設定すべきルールのベストプラクティスなどはございますでしょうか。

以上です。
よろしくお願い申し上げます。

※mod_securityの検知ログ(ホスト名マスク済み)
--134f6f42-B--
GET /favicon.ico HTTP/1.1
Host: ------------
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
Accept: */*
Referer: http://------------/sample/login
Accept-Encoding: gzip, deflate, sdch
Accept-Language: ja
Cookie: PLAY_SESSION="bd1bfc46473526b3f08278eb47781d6b8efb6644-returnUrl=%2Fsample"; __pbcd_debug=1; _kz_debug=1

--134f6f42-F--
HTTP/1.1 403 Forbidden
Content-Length: 300
Connection: close
Content-Type: text/html; charset=iso-8859-1

--134f6f42-E--

--134f6f42-H--
Message: Access denied with code 403 (phase 2). Pattern match "(^[\"'`\xc2\xb4\xe2\x80\x99\xe2\x80\x98;]+|[\"'`\xc2\xb4\xe2\x80\x99\xe2\x80\x98;]+$)" at REQUEST_COOKIES:PLAY_SESSION. [file "/etc/httpd/modsecurity.d/activated_rules/modsecurity_crs_41_sql_injection_attacks.conf"] [line "64"] [id "981318"] [rev "2"] [msg "SQL Injection Attack: Common Injection Testing Detected"] [data "Matched Data: \x22 found within REQUEST_COOKIES:PLAY_SESSION: \x22bd1bfc46473526b3f08278eb47781d6b8efb6644-returnUrl=/sample\x22"] [severity "CRITICAL"] [ver "OWASP_CRS/2.2.8"] [maturity "9"] [accuracy "8"] [tag "OWASP_CRS/WEB_ATTACK/SQL_INJECTION"] [tag "WASCTC/WASC-19"] [tag "OWASP_TOP_10/A1"] [tag "OWASP_AppSensor/CIE1"] [tag "PCI/6.5.2"]
Action: Intercepted (phase 2)
Apache-Handler: proxy-server
Stopwatch: 1434470975682625 1231 (- - -)
Stopwatch2: 1434470975682625 1231; combined=554, p1=196, p2=331, p3=0, p4=0, p5=27, sr=34, sw=0, l=0, gc=0
Response-Body-Transformed: Dechunked
Producer: ModSecurity for Apache/2.8.0 (http://www.modsecurity.org/); OWASP_CRS/2.2.8.
Server: Apache/2.2.29 (Amazon)
Engine-Mode: "ENABLED"

--134f6f42-Z--
Reply all
Reply to author
Forward
0 new messages