Skip to content

Gunicorn incorrectly accepts requests that don't have the 2nd CRLF in the final chunk #3382

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

Open
saadiqnafis opened this issue Apr 12, 2025 · 0 comments

Comments

@saadiqnafis
Copy link

When Gunicorn receives a request that's missing the second CRLF in the final chunk, it doesn't reject the request.

To see this for yourself,

  1. Start a Gunicorn server, such as this one:
python3 -m gunicorn --worker-class=gevent --workers=1 --worker-connections=1000 --bind 0.0.0.0:80 server:app
  1. Send it a request that's missing the final chunk's second CRLF
printf 'POST / HTTP/1.1\r\nHost: a\r\nTransfer-Encoding: chunked\r\n\r\n0\r\n' \
 | ncat localhost 80
  1. Observe that it still responds:
HTTP/1.1 200 OK
Server: gunicorn
Date: Sat, 12 Apr 2025 22:57:45 GMT
Connection: keep-alive
Content-type: application/json
Content-Length: 145

{"headers":[["SE9TVA==","YQ=="],["VFJBTlNGRVJfRU5DT0RJTkc=","Y2h1bmtlZA=="]],"body":"","version":"SFRUUC8xLjE=","uri":"Lw==","method":"UE9TVA=="}
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

1 participant