CVE-2018-3717: Cross-Site Scripting in connect
Summary
CVE-2018-3717: Cross-Site Scripting in connect. Affects connect versions < 2.14.0. Fixed in 2.14.0. How to fix ↓
Also tracked for
- node-connect · Debian:11
The same CVE-2018-3717 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The connect node module is an npm package that provides middleware for creating web servers in Node.js. It is widely used for building web applications and APIs. The vulnerability in connect version before 2.14.0 allows for a Cross-Site Scripting (XSS) attack due to a lack of validation of files in the directory.js middleware.
Vulnerability Detail
The Cross-Site Scripting (XSS) vulnerability in connect allows an attacker to inject malicious scripts into web pages viewed by users. This can lead to various security issues, such as stealing sensitive information, session hijacking, or performing actions on behalf of the user. The vulnerability arises from the failure to properly validate files in the directory.js middleware, allowing an attacker to upload and execute malicious scripts.
How To Fix
Minimum fixed version
2.14.0
This is the first release that contains the fix.
npm install connect@2.14.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If upgrading to the latest version is not feasible, a temporary workaround is to implement additional input validation and sanitization measures in the affected middleware. This can involve using security libraries or frameworks that provide protection against XSS attacks, such as the 'xss' library. Here is an example of how to use the 'xss' library as a workaround:
const xss = require('xss');
app.use((req, res, next) => {
req.body = xss(req.body);
next();
});
Conclusion
The Cross-Site Scripting vulnerability in connect version before 2.14.0 can have serious security implications for web applications and APIs. It is crucial to upgrade to the latest version or implement the recommended workaround to mitigate the risk of XSS attacks. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for connect →
FAQ
The vulnerability allows an attacker to inject malicious scripts into web pages, potentially leading to unauthorized access, data theft, or other malicious activities.
While there is no specific known exploit available, the vulnerability can be exploited by an attacker who can upload and execute malicious scripts.
No, only versions before 2.14.0 are affected. It is recommended to upgrade to the latest version to mitigate the vulnerability.
Yes, the CVSS score for this vulnerability is 5.4, indicating a moderate severity level.
You can find more information about this vulnerability in the GitHub Advisory Database: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/07/GHSA-rch9-xh7r-mqgw/GHSA-rch9-xh7r-mqgw.json
References
Related vulnerabilities
Recent vulnerabilities recorded for connect.