-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Possible Critical CVE - Multer file upload lib #9489
Comments
Could you please provide a minimum reproduction repository so that we can verify this ourselves? It might be as simple as updating the multer version but we'd need something to test against with reproduction steps |
Hello @jmcdo29!! I work as a Pentester, I'll talk to the dev team to create something specific for this CVE and I'll forward the link to you. Thanks in advance for your help. |
Here is the code for this CVE: https://github.com/z3xddd/Repository-for-test-CVE-NestJS If the CVE is accepted, please let me know so we can start creating it. |
Top man! |
Okay, so what do I need to do to reproduce this? Sending a file from the
And got a successful return with the ability to send more requests afterwards. Is there something I should be doing instead? |
Hello @jmcdo29. Here is the movie PoC: https://we.tl/t-CjWwHPcIGb
|
Can you give steps on how to do this specifically? Most everything I do is from terminal/command line so I'm not sure what I would need to do to inject that payload |
Okay. First: To exploit vulnerability:
Feel free to contact me if you have questions about this. |
In the moovie PoC it's all step by step. |
Okay, I did try that, got a 500 response, but the server was not taken down and I could still send requests. |
In my case the server not still send request and on my Kubernetes Cloud Server the same. |
You see the moovie Poc? |
Well, with the reproduction provided, while the server sends back a 500 it does not crash, so I don't believe this needs to be reported as a CVE, correct?
Yes I did. I saw that you got a 500 back because of an invalid Content-Type, but saw no signs of the server crashing |
I do not agree, because in our tests the environment falls and is the same as we sent it. Here is the first issue opened on Multer with a user with the same case: expressjs/multer#224 For me it remains a case of CVE yes. Please review this case. |
In the reproduction you provided the server
You wanted to report the CVE because the server would no longer accept requests, correct? Or am I missing something here? What is it that you are expecting should happen instead of the current behavior in the reproduction? Also, the current version of multer being used is 1.4.2, so this should have been solved long ago. |
In Kubernetes Server the service does crash. Here's a print of the AKS pods crashing when exploiting the vulnerability: As you can see in this issue, it was commented in 2020 that this issue continues to be sustained in NestJS. |
And I am telling you that with the reproduction you've provided this crash doesn't happen, so it's an issue in your code not our framework. If we cannot produce this outside of your server, then it's not a problem with the framework. |
If you truly believe this is a vulnerability we need concrete proof with a reproduction that has exact steps to take on how to make the crash happen when uploading a file like this. |
@z3xddd Using this project and following these steps, the server doesn't crashes here in my Ubuntu, just got Also, as this is related with |
Hi guys @micalevisk @jmcdo29! I'll pass it on to the dev team to check the codes again. Thanks for the help and I apologize for the inconvenience. |
Is there an existing issue for this?
Current behavior
Hi guys, I hope you are doing well!
I sent an email to support regarding this CVE found but I didn't get a response, so I'm opening this issue.
We identified a critical security issue when using the Multer lib to parse file uploads (FileInterceptor).
We have a web application using NestJS. During PenTest, when i send a multipart form data http request (file upload) and change the value of the Content-Type to "application/vdn.hzn-3d-crossword" our backend crashes with the following error:
node:events:504
throw er; // Unhandled 'error' event
^
Error: Unexpected end of multipart data
at /home/application/node_modules/dicer/lib/Dicer.js:62:28
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Emitted 'error' event on Busboy instance at:
at Busboy.emit (/home/application/node_modules/busboy/lib/main.js:38:33)
at Dicer. (/home/application/node_modules/busboy/lib/types/multipart.js:281:9)
at Dicer.emit (node:events:526:28)
at Dicer.emit (/home/application/node_modules/dicer/lib/Dicer.js:80:35)
at /home/application/node_modules/dicer/lib/Dicer.js:62:14
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Here is the request payload we used to reproduce the issue:
------WebKitFormBoundaryeQ3kzkwETmKP36OH
Content-Disposition: form-data; name="type"
DOCUMENTO_FRENTE
------WebKitFormBoundaryeQ3kzkwETmKP36OH--------WebKitFormBoundaryeQ3kzkwETmKP36OH
Content-Disposition: form-data; name="file"; filename="xss-2.jpg"
Content-Type: application/vdn.hzn-3d-crossword <-- Inject Payload
We believe this case is a new CVE found in the multer lib or its dependencies which NestJS uses.
Here's a print of the AKS pods crashing when exploiting the vulnerability:
An issue about this was opened directly in Multer and it was commented that this error had been solved, however it still happens in NestJS, indicating it is possibly a new CVE.
Minimum reproduction code
Sorry, for business policies we dont provide this code. To reproduce this issue is necessary web application with file upload function and use Multer lib to file upload parse.
Steps to reproduce
Expected behavior
The lib shouldn't return an error and bring down the application's services. The correct thing would be to inform that this mimetype is not allowed. (This was configured in the application, but as the error occurs directly in the lib used, the treatment performed does not work).
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
8.4.4
Packages versions
Node.js version
16 Alpine
In which operating systems have you tested?
Other
The web application run on Kubernetes cluster using docker image.
The text was updated successfully, but these errors were encountered: