-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
WSGI header spoofing via underscore/dash conflation #2799
Labels
Comments
evgeni
added a commit
to evgeni/puppet-pulpcore
that referenced
this issue
Sep 4, 2024
Those are rejected by Gunicorn 22+, see [1] for details. For older releases of Gunicorn we still unset the underscore notation. [1] benoitc/gunicorn#2799
ekohl
pushed a commit
to theforeman/puppet-pulpcore
that referenced
this issue
Sep 4, 2024
Those are rejected by Gunicorn 22+, see [1] for details. For older releases of Gunicorn we still unset the underscore notation. [1] benoitc/gunicorn#2799
Odilhao
pushed a commit
to Odilhao/puppet-pulpcore
that referenced
this issue
Oct 11, 2024
Those are rejected by Gunicorn 22+, see [1] for details. For older releases of Gunicorn we still unset the underscore notation. [1] benoitc/gunicorn#2799
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Gunicorn normalizes headers by converting dashes to underscores. Both
Foo-Bar
andFoo_Bar
becomeHTTP_FOO_BAR
. Additionally, if the HTTP request contains bothFoo-Bar: a
andFoo_Bar: b
, Gunicorn merges them to{'HTTP_FOO_BAR': 'a,b'}
.This can lead to vulnerabilities in some web apps. If a header is used in a security-sensitive way (for instance, passing authentication information along from a front-end proxy), even if the proxy carefully strips any incoming value for X-Auth-User, an attacker may be able to provide an X-Auth_User header (with underscore) and bypass this protection.
Another example: if the attacker sets
X_Forwarded_For: 5.6.7.8
(fake IP) and the front proxy setsX-Forwarded-For: 1.2.3.4
(real IP), the Python app could see1.2.3.4,5.6.7.8
or5.6.7.8,1.2.3.4
depending on the proxy's header order.See also: https://github.security.telekom.com/2020/05/smuggling-http-headers-through-reverse-proxies.html
Because of this risk, many servers ignore any header whose name contains underscores.
underscores_in_headers on;
.What should Gunicorn do about this?
The text was updated successfully, but these errors were encountered: