Open
Description
I run http-server primarily for SPA with proxy redirect. I prefer to just use http-server directly without an NGINX or some other firewall for my projects.
Environment Versions
- OS Type : Debian GNU/Linux 9.13 (stretch)
- Node version: v14.18.1
- http-server version: v13.0.2
Steps to reproduce
- make a request (POST, GET, etc) such that the url = '/?/?/?/?/?........... (repeated for about a hundred times) ..../?/?/api'
- This will force http-server to end up using all the available memory
- sample start
http-server ./web -o -c-1 -p 8080 --proxy http://localhost:8080?"
Suggestion
- I would propose a PR that links to this issue that deflects against this simple but powerful attack. that uses
url.slice(0,4) === '/?/?'
The more advanced way to handle this is to not use regex (intensive) but an indexOf analysis so we can parse legitamate query variables vs an actual attack.
Request thoughts and interest in handling this attack? I can propose an precise curl command and repository to demonstrate. Let me know.
Have an immediate fix i implemented here before we even touch parse.
rook2pawn@6645278
Metadata
Metadata
Assignees
Labels
No labels