PHP5.3.9以降でmax_input_varsを超えるPOSTデータが失われる件
PHP5.3.9でhashdosの脆弱性の対応が入っているのですが、PHP5.3.9以降では、max_input_varsを
超えてしまうと、そこから後ろの$_POSTのデータがごっそり失われてしまう。
PHP5.3.9で改修が複数回行われていて、パッチあてて、再ビルドとかするといきなり動かなくなるかもしれない。
注意。
問題は、配列を使って、何かをPOSTしたとき
http://www.php.net/manual/ja/faq.html.php#faq.html.arrays
<input name="MyArray[]" /> <input name="MyArray[]" /> <input name="MyOtherArray[]" /> <input name="MyOtherArray[]" />
これがHashDOSの攻撃の関係で、このときにボディに入ってくる値は4個としてカウントされる。
https://github.com/php/php-src/commit/282d3f20349b78eeed0173a2e55d311324faeb4d
ここのコミット以前は、ボディに入ってくる値のカウントとしては2個としてカウントされていた。
例えば、ユーザーを1000人突っ込むために
<input name="group[]" /> <input name="group[]" /> ... ... ... <input name="group[]" />
max_input_vars+1以降のパラメータの値が失われてしまう。
この仕様変更は
http://www.serverphorums.com/read.php?7,425749,426342#msg-426342
> Hi!
>
>
>> and different with the fix which was commited now, this patch count
>> the num vars in a global scope, that means if there are 2 elements
>> which both have 500 elements in post, the restriction will also
>> affect,
>
>
> Why? The point of the limitation is to avoid hash collisions and related
> performance problems, but if they are in different elements, what is the
> point of limiting them?
>
Hi, this patch is aim at a quick/simple fix than before, that is why I
proposal this patch.actually, there might be no attack even a array has more than 1000 elements,
I mean, this is a simple / quick fix but works the same.
thanks
ここで議論されていて、立派な仕様変更だとおもうんだけど、適当すぎやろ!っていう叫びでした。