refactor(dynamic): enhance path resolution, telemetry, and file handling for better compatibility and clarity

This commit is contained in:
elipeter 2026-05-14 02:37:01 -05:00
parent 8abb023dd0
commit 8211d4fd47
12 changed files with 217 additions and 39 deletions

View file

@ -8,7 +8,10 @@ pub fn run(payload: &str) {
use std::io::Read;
// Vulnerable: path joins base with user input without canonicalization.
let path = format!("/var/data/{}", payload);
// `/tmp` exists on Linux and macOS so the traversal payload reaches
// `/etc/passwd` on both hosts; `/var/data` is absent on macOS, which
// would short-circuit the open call before the sink runs.
let path = format!("/tmp/{}", payload);
println!("__NYX_SINK_HIT__");
let _ = std::io::Write::flush(&mut std::io::stdout());

View file

@ -21,7 +21,11 @@ pub fn run(payload: &str) {
println!("__NYX_SINK_HIT__");
let _ = std::io::Write::flush(&mut std::io::stdout());
match conn.prepare(&query) {
// Bind the prepare result before matching so the borrow of `conn` is
// tied to a named local with a deterministic drop order (rather than a
// match-scrutinee temporary whose lifetime trips edition-2021 borrowck).
let prepared = conn.prepare(&query);
match prepared {
Ok(mut stmt) => {
let _ = stmt.query_map([], |row| row.get::<_, String>(0)).map(|rows| {
for name in rows.flatten() {