-
-
Notifications
You must be signed in to change notification settings - Fork 16.2k
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
Binary request header value results in dropped connection #3943
Comments
What version of Express and Node.js are you running? This is likely an issue with Node.js HTTP server, but just need to know the version numbers to confirm. |
You can also attempt to confirm this if the following server exhibits the same behavior: const http = require('http')
const server = http.createServer((_req, res) => {
res.statusCode = 204
res.end()
})
server.listen(8080); |
See the comments in expressjs/express#3943 The issue turned out to be bigger as the behavior is due to Node's HTTP server.
My fault! The versions are –
Express: Confirmed. The behavior is the same. I've updated the test repo. |
This bug is fixed in Node 10 (I have
|
Thanks for the versions and confirming. AFAIK this behavior was fixed in Node.js 9 and up, so upgrading Node.js should resolve. |
Ah just posted at the same time. Sounds like you confirmed your issue was resolved with that version upgrade 👍 |
Thanks! And sorry for bothering! ❤️ |
It's no problem! In the future though if you believe it is a security issue, ideally it should be reported following https://github.com/expressjs/express/blob/master/Security.md Node.js also has a special security report procedure if it did escalate to Node.js |
Thanks for the hint, I shall bear it in mind. |
If Express.js receives a request header with binary data, it silently drops this connection. This is incorrect behavior, Web servers should accept any requests (including malformed) and reply with meaningful responses. This could be a security issue as well: if a load balancer sees too many dropped upstream connections, it will mark the upstream host as down. What if it marks all the hosts as down?
Steps to reproduce
I have set up a minimal project to show this issue: https://github.com/alaz/express-req-header-binary
The Express application is trivial:
I have also an Nginx configuration that has two identical locations, both of them proxy to the same Express.js path. The only difference is that one of the Nginx locations sets a request header with binary value:
Tests
The above is a correct behavior. Below we are calling the location that sets binary data in a header:
and Nginx
error.log
will have:The text was updated successfully, but these errors were encountered: