Effective DoS attacks against Web Application Platforms
cryptanalysis.eu
cryptanalysis.eu
http://webcache.googleusercontent.com/search?q=cache:D8sBZ4-...
This problem is not new, see:
http://www.cs.rice.edu/~scrosby/hash/CrosbyWallach_UsenixSec...
http://mail.python.org/pipermail/python-dev/2003-May/035874....
Using a balanced tree in place of a list in a separately chained hash table is possible - but adds much complexity and reduced average-case performance to solve a problem that seems better to solve in a different way. Dynamic perfect hashing works too, but opens you up to a new memory exhaustion attack.
A combination of limiting header size and adding a seed to the hash function, as mentioned in the article, seems like the right way. Limiting header sizes and counts is something that servers should be doing anyways, and seeding the hash function seems to close this hole quite neatly.
Adding a balanced tree does not touch on average-case performance in any meaningful way, which is why I'm advocating it.
Everyone is using simple hashes for hash tables in order to get very good average-case performance.
If you keep that fast hash function, and only go to a tree when getting pathological input, you'll be impervious. That was my meaning.
What's new this time?
You mean to say, that if you've configured PHP in a poor way, (max post size, max execution time not appropriately tuned ) then you are open to a DoS? -- If you've configured it that badly, then this is probably the least of your worries.
The max_input_vars parameter was a new one for me.
Furthermore this is a problem you will encounter in every case in which the keys you populate a hash table with come from an untrusted source.