[🐸 Frogbot] Upgrade express-fileupload to 1.1.9 #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
📦 Vulnerable Dependencies
✍️ Summary
Critical
🔬 Research Details
Description:
express-fileupload is a popular Node.js express middleware package which enables high-level file upload processing in Node.js server-side code.
Attackers can exploit the package by sending a crafted file upload packet with a filename that pollutes the Object prototype. If the
fileUpload()
function is called with theparseNested
option set, theprocessNested()
function is invoked. This function breaks the submitted data into key-value pairs and performs assignment based on the resulting values. The code does not check for assignment to values outside of the intended scope. The attacker can exploit this by passing keys under the__proto__
namespace, for example passing__proto__.toString
as the key and a random string as the value will cause a denial of service due to unexpected object type (string instead of function). The public exploit uses theejs
package to elevate the impact to code execution, by polluting theoutputFunctionName
option, which is evaluated as code and allows for JS code injection.The original exploit was published in a blog. The package's maintainers issued two patches: the first addressed the precise issue as reported in the blog, and the second addressed a wider possibility for exploitation.
Remediation:
Development mitigations
Do not use
express-fileupload
with theparseNested
option set.Development mitigations
Call
Object.freeze(Object.prototype)
before usingexpress-fileupload
.Development mitigations
Strictly validate the schema of any JSON used as input to this package to prevent possible attacks:
🐸 JFrog Frogbot