-
Notifications
You must be signed in to change notification settings - Fork 37
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
Removed a bug which could cause a crash in HeaderParser, and as consequence could potentially crash a web server based on it #22
base: master
Are you sure you want to change the base?
Conversation
…er.prototype._parseHeader
HeaderParser.prototype._parseHeader
constructor function HeaderParser. In the case of start > 0, end would be wrong.
constructor function Dicer and all its occurances, as it is not necessary, increases the code size, and adds unwanted complexity.
The else if clause was exactly the opposite of the if clause.
10898ae
to
8003224
Compare
@RolandHeinze Are you using dicer as a part of busboy or separately? |
I've been notified the current implementation is abandonned and has been forked by fastify to fix bugs, including some crashes and hangs: See: * mscdex/busboy#250 * mscdex/dicer#22 * mscdex/dicer#25
Hi devs, I'm starting to get Snyk High Vulnerability alerts regarding Dicer for all versions: https://snyk.io/vuln/npm%3Adicer Any way I can help get this PR across the line? |
@nathan-gilbert If you're just parsing web forms (multipart or urlencoded),
|
@mscdex I'm not using |
@nathan-gilbert If the parent dependency is an older version of |
@mscdex Yep, you're right. I thought there were more than just Thanks, sorry for taking up some time here. |
There is a Denial of Service (DoS) security flaw has been introduced in multer@1.4.4. The details are available in the Snyk report: https://security.snyk.io/vuln/SNYK-JS-DICER-2311764 |
@nsandeepn |
FYI it looks like firebase/firebase-admin-node depends on |
@Karlinator dicer * 2 high severity vulnerabilities |
For people getting this error in snyk, if it isn't already apparent from the comments above... An older version of busboy used this version of dicer that is throwing this problem. Multer really just needs to update their packages, |
This is not as easy as said, since the change in to not use dice is part of the braking release v1.0.0, which drops the support of older node versions. Upgrading to this version in multer would also require multer to create a breaking change release. (See: expressjs/multer#1097) Creating a fix in dicer would enable different users to use the Also: if you don't plan to support dicer further, i think it would be beneficial to deprecate/archive this repo and add some infos, that users can find easily. |
If anyone wants to patch around this in a minimal way until all their other dependencies update then we used this patch in Dicer (0.2.5):
This catches the error and emits it so that Express can properly fail the request and get back to processing other requests. Arguably, this would be a good change to see in Dicer regardless. |
We also have a direct dependency on Also agree with @rudxde if you no longer recommend developers to use |
@mscdex: So, is dicer still going to be maintained? If no, does anything speak against marking dicer as deprecated? |
@Kondamon It's low priority at the moment. |
Presumably indirect dependencies such as this... apollo-server > apollo-server-core > ...are of very little security risk remaining on dicer v0.3.1 with no fix? |
On which version of dicer did you create/apply this fix? |
@rafaelmaeuer 0.2.5 - I'll update my comment to say that |
@hardysabs2 |
Severity: High References: CVE-2022-24434 SNYK-JS-DICER-2311764 mscdex/busboy#250 mscdex/dicer#22 Notes: Only used during test anyway.
Severity: High References: CVE-2022-24434 SNYK-JS-DICER-2311764 mscdex/busboy#250 mscdex/dicer#22 Notes: Only used during test anyway.
Severity: High References: CVE-2022-24434 SNYK-JS-DICER-2311764 mscdex/busboy#250 mscdex/dicer#22 Notes: Only used during test anyway.
Function
HeaderParser.prototype._parseHeader()
uses a variableh
, which in edge cases is used before it is initialized. As a consequence the statementwould crash. This can happen if an attacker uses a manipulated multipart/form-data header with a header name that starts with ' ' or '\t'. I wrote a simple HTML file that is exactly doing this using the fetch() function:
I used such an HTML file, and was able to crash Dicer and also Busboy. In particular, it happens if one uses the example server code presented on the Dicer GitHub repository. I think that it is a severe bug which should be removed as soon as possible.
Therefore, I wrote this PR. It
end
;HeaderParser.prototype._parseHeader()
;_realFinish
and all of it's occurances inDicer.js
as it is not necessary, increases the code size, and adds unwanted complexity;else if
clause in the functionDicer.prototype._oninfo()
;