GHSA-3227-r97m-8j95: Afire Path Traversal Vulnerability

HIGH
CWE-34 CWE-22
Published
Advisory Summary

GHSA-3227-r97m-8j95 is a HIGH path traversal vulnerability (CWE-34: Path Traversal: '....//') affecting Afire libraries in the crates.io ecosystem. The issue involves relative path traversal in afire serve_static. Remediation is available by upgrading affected packages to version 1.1.0.

GHSA-3227-r97m-8j95 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-3227-r97m-8j95
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-34: Path Traversal: '....//'
Affected Product Afire
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-3227-r97m-8j95

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

afire fixed: 1.1.0
Upgrade afire to 1.1.0
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 afire

How to Check if You Are Affected

To determine whether your application is affected by GHSA-3227-r97m-8j95, inspect your project dependencies for Afire:

inspect dependencies for afire

Analyze the terminal output to locate any version of Afire in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.1.0), 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-34: Path Traversal: '....//', where the product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '....//' (doubled dot dot slash) sequences that can resolve to a location that is outside of that directory. In Afire, 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 This vulnerability effects the built-in afire serve_static extension allowing paths containing `//....` to bypass the previous path sanitation and request files in higher directories that should not be accessible. ### Patches The issue has been fixed in [afire 1.1.0](https://crates.io/crates/afire/1.1.0). If you can, just update to the newest version of afire. ### Workarounds If you can't update afire you can simply disallow paths containing `/..` with the following middleware. Make sure this is the last middleware added to the server so it runs first, stopping the bad requests. ```rust use afire::prelude::*; struct PathTraversalFix; impl Middleware for PathTraversalFix { fn pre(&self, req: Request) -> MiddleRequest { if req.path.replace("\\", "/").contains("/..") { return MiddleRequest::Send( Response::new() .status(400) .text("Paths containing `..` are not allowed"), ); } MiddleRequest::Continue } } ``` ```rust let mut server = Server::new(host, port); PathTraversalFix.attach(&mut server); ``` ### References You can read about the new changes to afire in 1.1.0 [here](https://connorcode.com/writing/afire/update-3) ### For more information If you have any questions or comments about this advisory you can email me or message me on discord. [[https://connorcode.com/contact](https://connorcode.com/contact)]

GHSA-3227-r97m-8j95 Affected Afire Versions

1 component(s)
Fixed Versions:
1.1.0
Product / Package Ecosystem Affected Versions Fixed Version
afire
crates.io
≥ 0.2.1
< 1.1.0
1.1.0

References

Frequently Asked Questions

What is GHSA-3227-r97m-8j95?
GHSA-3227-r97m-8j95 is a security vulnerability in Afire involving Relative Path Traversal in afire serve_static under CWE-34: Path Traversal: '....//'.
Which Afire versions are affected?
Affected versions include releases prior to 1.1.0 across affected packages: afire.
What version fixes GHSA-3227-r97m-8j95?
Upgrading to 1.1.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is afire affected?
Yes, afire is affected in releases prior to 1.1.0. Upgrade your dependency to 1.1.0 or later.
What CWE is associated with GHSA-3227-r97m-8j95?
GHSA-3227-r97m-8j95 is classified under CWE-34: Path Traversal: '....//' (The product uses external input to construct a pathname that should be within a restricted directory, but it does not properly neutralize '....//' (doubled dot dot slash) sequences that can resolve to a location that is outside of that directory.).
How can I check crates.io dependencies for GHSA-3227-r97m-8j95?
Run the dependency tree command: 'inspect dependencies for afire'. 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-3227-r97m-8j95",
  "modified" : "2022-04-22T20:16:45Z",
  "published" : "2022-04-22T20:16:45Z",
  "aliases" : [ ],
  "summary" : "Relative Path Traversal in afire serve_static",
  "details" : "### Impact\nThis vulnerability effects the built-in afire serve_static extension allowing paths containing `//....` to bypass the previous path sanitation and request files in higher directories that should not be accessible.\n\n### Patches\nThe issue has been fixed in [afire 1.1.0](https://crates.io/crates/afire/1.1.0).\nIf you can, just update to the newest version of afire.\n\n### Workarounds\nIf you can't update afire you can simply disallow paths containing `/..` with the following middleware.\nMake sure this is the last middleware added to the server so it runs first, stopping the bad requests.\n```rust\nuse afire::prelude::*;\n\nstruct PathTraversalFix;\n\nimpl Middleware for PathTraversalFix {\n    fn pre(&self, req: Request) -> MiddleRequest {\n        if req.path.replace(\"\\\\\", \"/\").contains(\"/..\") {\n            return MiddleRequest::Send(\n                Response::new()\n                    .status(400)\n                    .text(\"Paths containing `..` are not allowed\"),\n            );\n        }\n\n        MiddleRequest::Continue\n    }\n}\n```\n```rust\nlet mut server = Server::new(host, port);\nPathTraversalFix.attach(&mut server);\n```\n\n### References\nYou can read about the new changes to afire in 1.1.0 [here](https://connorcode.com/writing/afire/update-3)\n\n### For more information\nIf you have any questions or comments about this advisory you can email me or message me on discord.\n[[https://connorcode.com/contact](https://connorcode.com/contact)]",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "afire"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0.2.1"
      }, {
        "fixed" : "1.1.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/Basicprogrammer10/afire/security/advisories/GHSA-3227-r97m-8j95"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Basicprogrammer10/afire/commit/da7904c04f82e1cb43cc42eaf6a1dba072b5c921"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/Basicprogrammer10/afire"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/Basicprogrammer10/afire/releases/tag/v1.1.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-34" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-04-22T20:16:45Z",
    "nvd_published_at" : null
  }
}