GHSA-P498-V437-472G
Vulnerability from github – Published: 2026-09-02 14:27 – Updated: 2026-09-02 14:27Summary
@humanfs/node does not treat symlinks as a separate case during copy operations. A symlink placed inside an attacker-controlled source tree can make copyAll() read and copy the contents of any file readable by the process, even when that file is outside the directory being copied.
Details
The Node implementation exposes symlink state through list(), but copyAll() ignores it. During recursive copies, every non-directory entry is passed to copy(), which delegates to fs.promises.copyFile().
On Node, copyFile() dereferences symlinks. As a result, a symlink inside the copied tree is handled as if it were an ordinary file, and the destination receives the contents of the symlink target rather than a copy of the link itself.
That breaks the expected boundary of a directory copy. A caller can point copyAll() at a seemingly self-contained directory and still end up copying data from elsewhere on the host filesystem if the source tree contains attacker-supplied symlinks.
The same dereference behavior also affects copy() when the source path itself is a symlink.
PoC
import { NodeHfs } from "@humanfs/node";
import fs from "node:fs/promises";
import path from "node:path";
import os from "node:os";
const root = await fs.mkdtemp(path.join(os.tmpdir(), "humanfs-"));
const src = path.join(root, "src");
const dst = path.join(root, "dst");
const secret = path.join(root, "secret.txt");
await fs.mkdir(src);
await fs.writeFile(secret, "TOPSECRET");
await fs.symlink(secret, path.join(src, "link.txt"));
const hfs = new NodeHfs();
await hfs.copyAll(src, dst);
console.log(await fs.readFile(path.join(dst, "link.txt"), "utf8"));
// TOPSECRET
Impact
If an application uses copyAll() or copy() on attacker-controlled paths, a symlink can be used to pull arbitrary readable host files into the copied output. In practice, that can turn a normal workspace copy, export, or packaging step into a file disclosure primitive.
{
"affected": [
{
"package": {
"ecosystem": "npm",
"name": "@humanfs/node"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.16.8"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-09-02T14:27:16Z",
"nvd_published_at": null,
"severity": "MODERATE"
},
"details": "### Summary\n\n`@humanfs/node` does not treat symlinks as a separate case during copy operations. A symlink placed inside an attacker-controlled source tree can make `copyAll()` read and copy the contents of any file readable by the process, even when that file is outside the directory being copied.\n\n### Details\n\nThe Node implementation exposes symlink state through `list()`, but `copyAll()` ignores it. During recursive copies, every non-directory entry is passed to `copy()`, which delegates to `fs.promises.copyFile()`.\n\nOn Node, `copyFile()` dereferences symlinks. As a result, a symlink inside the copied tree is handled as if it were an ordinary file, and the destination receives the contents of the symlink target rather than a copy of the link itself.\n\nThat breaks the expected boundary of a directory copy. A caller can point `copyAll()` at a seemingly self-contained directory and still end up copying data from elsewhere on the host filesystem if the source tree contains attacker-supplied symlinks.\n\nThe same dereference behavior also affects `copy()` when the source path itself is a symlink.\n\n### PoC\n\n```js\nimport { NodeHfs } from \"@humanfs/node\";\nimport fs from \"node:fs/promises\";\nimport path from \"node:path\";\nimport os from \"node:os\";\n\nconst root = await fs.mkdtemp(path.join(os.tmpdir(), \"humanfs-\"));\nconst src = path.join(root, \"src\");\nconst dst = path.join(root, \"dst\");\nconst secret = path.join(root, \"secret.txt\");\n\nawait fs.mkdir(src);\nawait fs.writeFile(secret, \"TOPSECRET\");\nawait fs.symlink(secret, path.join(src, \"link.txt\"));\n\nconst hfs = new NodeHfs();\nawait hfs.copyAll(src, dst);\n\nconsole.log(await fs.readFile(path.join(dst, \"link.txt\"), \"utf8\"));\n// TOPSECRET\n```\n\n### Impact\n\nIf an application uses `copyAll()` or `copy()` on attacker-controlled paths, a symlink can be used to pull arbitrary readable host files into the copied output. In practice, that can turn a normal workspace copy, export, or packaging step into a file disclosure primitive.",
"id": "GHSA-p498-v437-472g",
"modified": "2026-09-02T14:27:16Z",
"published": "2026-09-02T14:27:16Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/humanwhocodes/humanfs/security/advisories/GHSA-p498-v437-472g"
},
{
"type": "WEB",
"url": "https://github.com/humanwhocodes/humanfs/commit/22bbaa4487a3e6c1197ca619840de4615d0c3404"
},
{
"type": "PACKAGE",
"url": "https://github.com/humanwhocodes/humanfs"
},
{
"type": "WEB",
"url": "https://github.com/humanwhocodes/humanfs/releases/tag/node-v0.16.8"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N",
"type": "CVSS_V4"
}
],
"summary": "humanfs: Recursive copy follows symlinked files and copies data from outside the source tree"
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.