GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||
GeezerVison is showing github.com — Update Rust crate actix-files to v0.6.10 [SECURITY] by renovate[bot] · Pull Request #130 · developing-today/code Conversation
|
| Package | Type | Update | Change |
|---|---|---|---|
| actix-files (source) | dependencies | patch | 0.6.2 → 0.6.10 |
When passing a non-existing folder to the actix_files::Files::new() method causes the actix server to expose unexpected files.
The actix-files library exposes a Files struct that configures an actix service to serve the files in a folder as static assets. Below you can find the signature of the Files::new method:
pub fn new<T: Into<PathBuf>>(mount_path: &str, serve_from: T) -> Files
When the mount_path you pass to Files doesn't exist, it defaults to an empty path (Path::new()). When the service receives a HTTP request, it joins the request information with the empty path and calls canonicalize. Rust resolves this path as relative and returns any file that matches it.
This behavior causes the library to expose unexpected files when the folder is not present.
There is a working PoC on https://github.com/Angelmmiguel/actix-files-vuln, although the next steps can be followed to reproduce the issue
Clone the https://github.com/actix/examples repository.
Change your directory to the basics/static-files folder.
Edit the src/main.rs file and change the line 13 to mount a non-existing folder:
- .service(Files::new("/images", "static/images/").show_files_listing()) + .service(Files::new("/images", "static/missing/").show_files_listing())
Run the project with cargo run.
Access the http://localhost:8080/images/Cargo.toml URL.
This is an exposure of information vulnerability. It affects anyone using the actix-files::Files library that mounts a non-existing folder for any reason.
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:NThis data is provided by the GitHub Advisory Database (CC-BY 4.0).
A GET request for a static file served by actix-files with an empty Range header triggers a panic. With panic = "abort", a remote user may crash the process on-demand.
actix-files assumes that HttpRange::parse(), when Ok, always returns a vector with at least one element. When parse() is called on an empty string, it returns Ok(vec![]). This can cause a panic at named.rs:534 when handling an HTTP request with an empty Range: header. This shouldn't significantly impact programs built with the default panic = "unwind", as the only effect is that the connection is closed when the worker thread panics and new threads are spooled up on demand. Programs built with panic = "abort" are vulnerable to being crashed on-demand by any user with permissions to perform a GET request for a static file served by actix-files.
https://github.com/actix/actix-web/blob/0383f4bdd1210e726143ca1ebcf01169b67a4b6c/actix-files/src/named.rs#L530-L535
Cargo.toml:
[package] name = "example" version = "0.1.0" edition = "2021" [dependencies] actix-web = "=4.5.1" actix-files = "=0.6.5" [profile.dev] panic = "abort"
src/main.rs:
use actix_files::NamedFile; use actix_web::{get, Responder}; #[get("/")] async fn index() -> impl Responder { NamedFile::open("test_file") } #[actix_web::main] async fn main() -> std::io::Result<()> { use actix_web::{App, HttpServer}; HttpServer::new(|| App::new().service(index)) .bind(("127.0.0.1", 8080))? .run() .await }
test.sh:
#!/bin/bash echo foo > test_file cargo b cargo r& sleep 1 nc 127.0.0.1 8080 << EOF GET / HTTP/1.1 Range: EOF kill %1
Create these files, then run chmod +x test.sh && ./test.sh. The server should start, then crash upon receiving the GET request from netcat.
This assumes a reasonably UNIX-like system with Rust, bash and netcat installed.
It is believed that only programs compiled with panic = "abort" are affected significantly. The only potential impact that can be seen is Denial of Service, though an attacker able to repeatedly send GET requests without those requests getting blocked by rate limiting, DDoS protection, etc. would be able to keep a server down indefinitely. As only a single unblocked request is needed to trigger the panic, merely having a rate limiter may not be enough to prevent this.
Though the impact in the worst case is significant, the real-world risk of this vulnerability appears to be limited, as it would be expected that anyone for whom uptime is a significant concern would not compile their program with panic = "abort".
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:NThis data is provided by the GitHub Advisory Database (CC-BY 4.0).
v0.6.10: Actix web 0.6.10Allow to use path without traling slashes for scope registration #241
Allow to set encoding for exact NamedFile #239
TestServer::post() actually sends GET request #240v0.6.9: Actix web 0.6.9Drop connection if request's payload is not fully consumed #236
Fix streaming response with body compression
v0.6.8: Actix web 0.6.8Fix scope resource path extractor #234
Re-use tcp listener on pause/resume
v0.6.7: Actix web 0.6.7v0.6.6: Actix web 0.6.6Panic during middleware execution #226
Add support for listen_tls/listen_ssl #224
Ranges header support for NamedFile #60
Implement extractor for Session
v0.6.5: Actix web 0.6.5v0.6.4: Actix web 0.6.4📅 Schedule: (UTC)
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
7adda8d to
db4ae07
Compare
db4ae07 to
90b4d28
Compare
90b4d28 to
f93e6bc
Compare
There was an error while loading. Please reload this page.
|
Important Review skippedBot user detected. To trigger a single review, invoke the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
f93e6bc to
e5e7e5c
Compare
e5e7e5c to
6b550ad
Compare
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.