# GHSA-3227-r97m-8j95: Relative Path Traversal in afire serve_static

- Severity: High (rating, scored by GitHub)
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2022-04-22T20:16:45.000Z
- Modified: 2022-04-22T20:16:45.000Z
- Weaknesses: CWE-22, CWE-34

## Description

### 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)]

(As written by GitHub Advisory Database.)

## Affected

- afire (crates.io): from 0.2.1 before 1.1.0

## References

- <https://github.com/Basicprogrammer10/afire/security/advisories/GHSA-3227-r97m-8j95> (web)
- <https://github.com/Basicprogrammer10/afire/commit/da7904c04f82e1cb43cc42eaf6a1dba072b5c921> (web)
- <https://github.com/Basicprogrammer10/afire> (package)
- <https://github.com/Basicprogrammer10/afire/releases/tag/v1.1.0> (web)

## Sources

- GitHub Advisory Database: [GHSA-3227-r97m-8j95](https://github.com/advisories/GHSA-3227-r97m-8j95), CC-BY-4.0, modified 2022-04-22

---

Page: https://cve.day/GHSA-3227-r97m-8j95 · Whole record: https://cve.day/GHSA-3227-r97m-8j95.json · Rebuilt by cve.day 2026-11-25T22:56:42.154Z
