Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Denial of service when the server sends an infinitely large header #55

Closed
Shnatsel opened this issue Mar 24, 2021 · 6 comments
Closed

Comments

@Shnatsel
Copy link

Shnatsel commented Mar 24, 2021

minreq will use an unbounded amount of memory if the server sends a single infinitely large header. This can be used to exhaust the memory on the machine and cause a denial of service.

You can reproduce the issue by running the following in Linux console and then connecting to localhost:8080 with minreq:

( echo -e "HTTP/1.1 200 OK\r"; echo -n "Huge-header: "; yes A | tr -d '\n' ) | nc -l localhost 8080

Tested using this code for minreq. You can inspect the Cargo.lock to know the exact dependency versions.

@Shnatsel
Copy link
Author

This also works when sending a great many smaller headers.

@neonmoe
Copy link
Owner

neonmoe commented Mar 24, 2021

Wrong issue tracker, or typo in crate name?

@Shnatsel
Copy link
Author

Shnatsel commented Mar 24, 2021

Typo. Let me fix it. Sorry!

@Shnatsel
Copy link
Author

Fixed now. This is what happens when I test 9 clients for 3 DoS issues each at the end of a long day.

@neonmoe
Copy link
Owner

neonmoe commented Mar 24, 2021

I appreciate the effort you put into these! It's a shame I don't have the time to fix them at the same pace 😄

@neonmoe
Copy link
Owner

neonmoe commented May 12, 2021

Fixed in efbaf75, though it's opt-in until 3.0.0.

@neonmoe neonmoe closed this as completed May 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants