Vulnerability in send package: Directory Traversal
Summary
GHSA-pgv6-jrvv-75jp: Moderate severity vulnerability that affects send. Affects send versions < 0.8.4. Fixed in 0.8.4. How to fix ↓
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 send package is a popular npm module used in Node.js applications for serving static files. It provides functionality for efficiently transferring files from the server to the client. However, versions prior to 0.8.4 are vulnerable to a directory traversal attack, which allows remote attackers to access restricted directories. This vulnerability occurs due to a partial comparison used by the package to verify if a directory is within the document root.
Vulnerability Detail
The directory traversal vulnerability in the send package allows attackers to bypass access restrictions and retrieve sensitive files from the server. By exploiting this vulnerability, an attacker can traverse the directory structure and access files outside the intended document root. For example, an attacker could access the 'public-restricted' directory located under the 'public' directory, which should be restricted from public access. This can lead to unauthorized disclosure of sensitive information and potential compromise of the server.
How To Fix
Latest published version: 1.2.1 as of 22 Oct 2026
npm install send@1.2.1
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
0.8.4
This is the first release that contains the fix.
npm install send@0.8.4
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 immediately feasible, a temporary workaround can be implemented by manually validating the requested file path against the document root. This can be done by checking if the requested file path is within the document root directory and denying access if it is not. Here is an example of how this can be implemented in Node.js:
const path = require('path');
const send = require('send');
function serveFile(req, res) {
const requestedFile = req.params.file;
const documentRoot = path.join(__dirname, 'public');
if (!requestedFile.startsWith(documentRoot)) {
res.status(403).send('Access denied.');
return;
}
send(req, requestedFile).pipe(res);
}
Conclusion
The directory traversal vulnerability in the send package can have serious security implications for Node.js applications. It is crucial to upgrade to version 0.8.4 or later to mitigate this vulnerability. If immediate upgrade is not possible, implementing the suggested workaround can provide temporary protection. For further assistance and support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for send →
FAQ
The vulnerability allows remote attackers to access restricted directories and potentially retrieve sensitive files from the server. This can lead to unauthorized disclosure of information and compromise the security of the application and server.
Versions prior to 0.8.4 of the send package are affected by this vulnerability.
Yes, upgrading to version 0.8.4 or later of the send package fixes this vulnerability.
A temporary workaround is to manually validate the requested file path against the document root and deny access if it is outside the allowed directory.
You can find more information about this vulnerability in the GitHub Security Advisory database: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2018/10/GHSA-pgv6-jrvv-75jp/GHSA-pgv6-jrvv-75jp.json
References
Related vulnerabilities
Recent vulnerabilities recorded for send.