CVE-2020-15230: Github.com/vapor/vapor Remote Code Execution Vulnerability

MODERATE
Advisory Identifier: GHSA-vcvg-xgr8-p5gq
CVSS 6.5
CWE-22
Published
Advisory Summary

CVE-2020-15230 is a MODERATE (CVSS 6.5) remote code execution vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Github.com/vapor/vapor libraries in the SwiftURL ecosystem. The issue involves arbitrary file read using percent-encoded relative paths in filemiddleware. Remediation is available by upgrading affected packages to version 4.29.4.

CVE-2020-15230 at a Glance

CVE Identifier CVE-2020-15230
GHSA Identifier GHSA-vcvg-xgr8-p5gq
Severity MODERATE
CVSS v3.1 Base Score 6.5
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Github.com/vapor/vapor
Package Ecosystem SwiftURL
Published Date
Last Updated

Security Impact

CVSS: 6.5

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2020-15230

To remediate this vulnerability, upgrade all affected Github.com/vapor/vapor dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/vapor/vapor fixed: 4.29.4
Upgrade github.com/vapor/vapor to 4.29.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/vapor/vapor

How to Check if You Are Affected

To determine whether your application is affected by CVE-2020-15230, inspect your project dependencies for Github.com/vapor/vapor:

inspect dependencies for github.com/vapor/vapor

Analyze the terminal output to locate any version of Github.com/vapor/vapor in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.29.4), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where 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. In Github.com/vapor/vapor, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact Attackers can access data at arbitrary filesystem paths on the same host as an application using `FileMiddleware`. ### Patches Version [4.29.4](https://github.com/vapor/vapor/releases/tag/4.29.4) ### Workarounds Upgrade to 4.24.4 or later, or disable `FileMiddleware`. ### References * Introduced in https://github.com/vapor/vapor/pull/2223 * Fixed by https://github.com/vapor/vapor/pull/2500 ### For more information If you have any questions or comments about this advisory: * Open [an issue](https://github.com/vapor/vapor/issues) * Email us at [security@vapor.codes](mailto:security@vapor.codes)

CVE-2020-15230 Affected Github.com/vapor/vapor Versions

1 component(s)
Fixed Versions:
4.29.4
Product / Package Ecosystem Affected Versions Fixed Version
github.com/vapor/vapor
SwiftURL
≥ 4.0.0-rc.2.5
< 4.29.4
4.29.4

References

Frequently Asked Questions

What is CVE-2020-15230?
CVE-2020-15230 is a security vulnerability in Github.com/vapor/vapor involving Arbitrary file read using percent-encoded relative paths in FileMiddleware under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Github.com/vapor/vapor versions are affected?
Affected versions include releases prior to 4.29.4 across affected packages: github.com/vapor/vapor.
What version fixes CVE-2020-15230?
Upgrading to 4.29.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/vapor/vapor affected?
Yes, github.com/vapor/vapor is affected in releases prior to 4.29.4. Upgrade your dependency to 4.29.4 or later.
What is the CVSS score of CVE-2020-15230?
CVE-2020-15230 has a CVSS v3.1 base score of 6.5 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N.
What CWE is associated with CVE-2020-15230?
CVE-2020-15230 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (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.).
How can I check SwiftURL dependencies for CVE-2020-15230?
Run the dependency tree command: 'inspect dependencies for github.com/vapor/vapor'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-vcvg-xgr8-p5gq",
  "modified" : "2023-06-09T19:31:32Z",
  "published" : "2023-06-09T19:31:32Z",
  "aliases" : [ "CVE-2020-15230" ],
  "summary" : "Arbitrary file read using percent-encoded relative paths in FileMiddleware",
  "details" : "### Impact\n\nAttackers can access data at arbitrary filesystem paths on the same host as an application using `FileMiddleware`.\n\n### Patches\n\nVersion [4.29.4](https://github.com/vapor/vapor/releases/tag/4.29.4)\n\n### Workarounds\n\nUpgrade to 4.24.4 or later, or disable `FileMiddleware`.\n\n### References\n\n* Introduced in https://github.com/vapor/vapor/pull/2223\n* Fixed by https://github.com/vapor/vapor/pull/2500\n\n### For more information\n\nIf you have any questions or comments about this advisory:\n* Open [an issue](https://github.com/vapor/vapor/issues)\n* Email us at [security@vapor.codes](mailto:security@vapor.codes)",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "SwiftURL",
      "name" : "github.com/vapor/vapor"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0-rc.2.5"
      }, {
        "fixed" : "4.29.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vapor/vapor/security/advisories/GHSA-vcvg-xgr8-p5gq"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15230"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vapor/vapor/pull/2500"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vapor/vapor/commit/cf1651f7ff76515593f4d8ca6e6e15d2247fe255"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vapor/vapor"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-06-09T19:31:32Z",
    "nvd_published_at" : "2020-10-02T19:15:00Z"
  }
}