home wiki.fukuchiharuki.me
Menu

キーワード

  • Tomcat

関連

現象

パラメータ数が512を超えると例外が起こる。

java.lang.IllegalStateException: Parameter count exceeded allowed maximum: 512

原因

Tomcatのそういう設定のため。

JavaのhashCode()の脆弱性を突いた攻撃を受けないように上限値を設定しているとのこと。

It was found that the Java hashCode() method implementation was susceptible
to predictable hash collisions. A remote attacker could use this flaw to
cause Tomcat to use an excessive amount of CPU time by sending an HTTP
request with a large number of parameters whose names map to the same hash
value. This update introduces a limit on the number of parameters processed
per request to mitigate this issue. The default limit is 512 for
parameters and 128 for headers. These defaults can be changed by setting
the org.apache.tomcat.util.http.Parameters.MAX_COUNT and
org.apache.tomcat.util.http.MimeHeaders.MAX_COUNT system properties.
(CVE-2011-4858)

対策

standalone.xmlのプロパティで上限値を設定できる(らしいです、試してません)。

Add the following system property to the configuration file(eg standalone.xml).
<property name="org.apache.tomcat.util.http.Parameters.MAX_COUNT" value="10000"/>

参考ページの引用なので、詳しくはそちらを参照してください。
(古い実装にはstandalone.xmlがないみたいね、どこに書いたらいいのかしら)

参考