# RUSTSEC-2022-0072: Location header incorporates user input, allowing open redirect

- Database: RustSec
- Published: 2022-12-23
- Modified: 2023-11-08

## Also published as

- [GHSA-5WVV-Q5FV-2388](https://cve.now/GHSA-5WVV-Q5FV-2388.md) (GitHub)

## Affected versions

- hyper-staticfile (crates.io): fixed in 0.9.4; from 0.10.0-0, fixed in 0.10.0-alpha.5

## Description

When `hyper-staticfile` performs a redirect for a directory request (e.g. a
request for `/dir` that redirects to `/dir/`), the `Location` header value was
derived from user input (the request path), simply appending a slash. The
intent was to perform an origin-relative redirect, but specific inputs
allowed performing a scheme-relative redirect instead.

An attacker could craft a special URL that would appear to be for the correct
domain, but immediately redirects to a malicious domain. Such a URL can benefit
phishing attacks, for example an innocent looking link in an email.

## References

- https://crates.io/crates/hyper-staticfile
- https://rustsec.org/advisories/RUSTSEC-2022-0072.html
- https://github.com/stephank/hyper-staticfile/commit/f12cadc6666c6f555d29725f5bc45da2103f24ea

Page: https://cve.now/RUSTSEC-2022-0072

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
