Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions crates/uffs-client/src/verify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,25 @@ pub(crate) fn verify_daemon_pid_file(pid_path: &std::path::Path) -> bool {
};

if actual_hash != expected_hash {
// A path-STRING hash mismatch is NOT proof of impersonation. The daemon
// records `current_exe()` (its launch path), while this side reads
// `QueryFullProcessImageNameW` (the resolved image path). For a daemon
// launched through a symlink/shim — e.g. a WinGet `…\Links\uffsd.exe`
// entry, or any relaunch — those two path strings differ for the SAME
// binary, so the hashes differ even though nothing is wrong. Rather than
// refuse a legitimate daemon, defer to the authoritative identity check:
// the peer must be a `uffsd` binary (by name) and, when signed, pass
// Authenticode — which a real impostor fails just as it fails the hash.
// (This mirrors the hash==0 path, which already falls back here.)
tracing::warn!(
pid,
exe = %exe_path.display(),
expected_hash,
actual_hash,
"Daemon exe_path_hash mismatch — possible impersonation"
"Daemon exe_path_hash mismatch (launch path vs resolved image path?) \
— deferring to name + signature identity check"
);
return false;
return verify_daemon_identity(pid);
}

true
Expand Down
Loading