Find, fix and prevent vulnerabilities in your code.
critical severity
- Vulnerable module: multer
- Introduced through: multer@1.4.4
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › multer@1.4.4Remediation: Upgrade to multer@2.0.1.
Overview
Affected versions of this package are vulnerable to Uncaught Exception in makeMiddleware, when processing a file upload request. An attacker can cause the application to crash by sending a request with a field name containing an empty string.
Remediation
Upgrade multer to version 2.0.1 or higher.
References
high severity
- Vulnerable module: multer
- Introduced through: multer@1.4.4
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › multer@1.4.4Remediation: Upgrade to multer@2.0.0.
Overview
Affected versions of this package are vulnerable to Missing Release of Memory after Effective Lifetime due to improper handling of error events in HTTP request streams, which fails to close the internal busboy stream. An attacker can cause a denial of service by repeatedly triggering errors in file upload streams, leading to resource exhaustion and memory leaks.
Note:
This is only exploitable if the server is handling file uploads.
Remediation
Upgrade multer to version 2.0.0 or higher.
References
high severity
- Vulnerable module: multer
- Introduced through: multer@1.4.4
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › multer@1.4.4Remediation: Upgrade to multer@2.0.0.
Overview
Affected versions of this package are vulnerable to Uncaught Exception due to an error event thrown by busboy. An attacker can cause a full nodejs application to crash by sending a specially crafted multi-part upload request.
PoC
const express = require('express')
const multer = require('multer')
const http = require('http')
const upload = multer({ dest: 'uploads/' })
const port = 8888
const app = express()
app.post('/upload', upload.single('file'), function (req, res) {
res.send({})
})
app.listen(port, () => {
console.log(`Listening on port ${port}`)
const boundary = 'AaB03x'
const body = [
'--' + boundary,
'Content-Disposition: form-data; name="file"; filename="test.txt"',
'Content-Type: text/plain',
'',
'test without end boundary'
].join('\r\n')
const options = {
hostname: 'localhost',
port,
path: '/upload',
method: 'POST',
headers: {
'content-type': 'multipart/form-data; boundary=' + boundary,
'content-length': body.length,
}
}
const req = http.request(options, (res) => {
console.log(res.statusCode)
})
req.on('error', (err) => {
console.error(err)
})
req.write(body)
req.end()
})
Remediation
Upgrade multer to version 2.0.0 or higher.
References
high severity
- Vulnerable module: multer
- Introduced through: multer@1.4.4
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › multer@1.4.4Remediation: Upgrade to multer@2.0.2.
Overview
Affected versions of this package are vulnerable to Uncaught Exception due to improper handling of multipart requests. An attacker can cause the application to crash by sending a specially crafted malformed multi-part upload request that triggers an unhandled exception.
Remediation
Upgrade multer to version 2.0.2 or higher.
References
high severity
- Vulnerable module: dicer
- Introduced through: multer@1.4.4
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › multer@1.4.4 › busboy@0.2.14 › dicer@0.2.5
Overview
Affected versions of this package are vulnerable to Denial of Service (DoS). A malicious attacker can send a modified form to server, and crash the nodejs service. An attacker could sent the payload again and again so that the service continuously crashes.
PoC
await fetch('http://127.0.0.1:8000', { method: 'POST', headers: { ['content-type']: 'multipart/form-data; boundary=----WebKitFormBoundaryoo6vortfDzBsDiro', ['content-length']: '145', connection: 'keep-alive', }, body: '------WebKitFormBoundaryoo6vortfDzBsDiro\r\n Content-Disposition: form-data; name="bildbeschreibung"\r\n\r\n\r\n------WebKitFormBoundaryoo6vortfDzBsDiro--' });
Remediation
There is no fixed version for dicer.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: jsonwebtoken@8.5.1
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › jsonwebtoken@8.5.1Remediation: Upgrade to jsonwebtoken@9.0.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Use of a Broken or Risky Cryptographic Algorithm such that the library can be misconfigured to use legacy, insecure key types for signature verification. For example, DSA keys could be used with the RS256 algorithm.
Exploitability
Users are affected when using an algorithm and a key type other than the combinations mentioned below:
EC: ES256, ES384, ES512
RSA: RS256, RS384, RS512, PS256, PS384, PS512
RSA-PSS: PS256, PS384, PS512
And for Elliptic Curve algorithms:
ES256: prime256v1
ES384: secp384r1
ES512: secp521r1
Workaround
Users who are unable to upgrade to the fixed version can use the allowInvalidAsymmetricKeyTypes option to true in the sign() and verify() functions to continue usage of invalid key type/algorithm combination in 9.0.0 for legacy compatibility.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: jsonwebtoken@8.5.1
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › jsonwebtoken@8.5.1Remediation: Upgrade to jsonwebtoken@9.0.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Improper Restriction of Security Token Assignment via the secretOrPublicKey argument due to misconfigurations of the key retrieval function jwt.verify(). Exploiting this vulnerability might result in incorrect verification of forged tokens when tokens signed with an asymmetric public key could be verified with a symmetric HS256 algorithm.
Note:
This vulnerability affects your application if it supports the usage of both symmetric and asymmetric keys in jwt.verify() implementation with the same key retrieval function.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: jsonwebtoken
- Introduced through: jsonwebtoken@8.5.1
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › jsonwebtoken@8.5.1Remediation: Upgrade to jsonwebtoken@9.0.0.
Overview
jsonwebtoken is a JSON Web Token implementation (symmetric and asymmetric)
Affected versions of this package are vulnerable to Improper Authentication such that the lack of algorithm definition in the jwt.verify() function can lead to signature validation bypass due to defaulting to the none algorithm for signature verification.
Exploitability
Users are affected only if all of the following conditions are true for the jwt.verify() function:
A token with no signature is received.
No algorithms are specified.
A falsy (e.g.,
null,false,undefined) secret or key is passed.
Remediation
Upgrade jsonwebtoken to version 9.0.0 or higher.
References
medium severity
- Vulnerable module: inflight
- Introduced through: bunyan@1.8.15 and bunyan-express-serializer@1.0.0
Detailed paths
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › bunyan@1.8.15 › mv@2.1.1 › rimraf@2.4.5 › glob@6.0.4 › inflight@1.0.6
-
Introduced through: nodejs-express-mongodb@Marcelin97/MarcelinLois_6_10112021#e6b3dd4bad2bbd409ac28b7842d3d79d79416b60 › bunyan-express-serializer@1.0.0 › bunyan@1.8.15 › mv@2.1.1 › rimraf@2.4.5 › glob@6.0.4 › inflight@1.0.6
Overview
Affected versions of this package are vulnerable to Missing Release of Resource after Effective Lifetime via the makeres function due to improperly deleting keys from the reqs object after execution of callbacks. This behavior causes the keys to remain in the reqs object, which leads to resource exhaustion.
Exploiting this vulnerability results in crashing the node process or in the application crash.
Note: This library is not maintained, and currently, there is no fix for this issue. To overcome this vulnerability, several dependent packages have eliminated the use of this library.
To trigger the memory leak, an attacker would need to have the ability to execute or influence the asynchronous operations that use the inflight module within the application. This typically requires access to the internal workings of the server or application, which is not commonly exposed to remote users. Therefore, “Attack vector” is marked as “Local”.
PoC
const inflight = require('inflight');
function testInflight() {
let i = 0;
function scheduleNext() {
let key = `key-${i++}`;
const callback = () => {
};
for (let j = 0; j < 1000000; j++) {
inflight(key, callback);
}
setImmediate(scheduleNext);
}
if (i % 100 === 0) {
console.log(process.memoryUsage());
}
scheduleNext();
}
testInflight();
Remediation
There is no fixed version for inflight.