🛡️ Sentinel: [CRITICAL] Fix arbitrary command execution via unvalidated binary path#46
Conversation
…ed binary path This patch implements strict validation on the binary paths configured by the user before executing them as shell commands. Specifically, it ensures the `bitcoin_cli` path points strictly to an approved executable (`bitcoin-cli` or `bitcoin-cli.exe`) and rejects paths containing `..` traversal. This prevents arbitrary system command execution. Co-authored-by: bitcoiner-dev <75873427+bitcoiner-dev@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
🚨 Severity: CRITICAL
💡 Vulnerability: The CLI application allowed users to supply an arbitrary executable path for
bitcoin_cliin their profile configuration. This path was passed directly tostd::process::Command::newwithout any validation. WhileCommand::newusesexecvedirectly and mitigates classic shell injection in the arguments, it does not prevent an attacker or a malicious configuration from substituting the intended binary with an arbitrary system binary (like/bin/shor a trojan executable) to gain complete control under the context of the running application.🎯 Impact: Arbitrary command execution leading to complete host takeover, data theft (including sensitive wallet information), and privilege escalation.
🔧 Fix: Implemented
validate_bitcoin_cli_pathinsrc/utils.rswhich performs strict validation on the given path. It asserts that the filename component is exactlybitcoin-cliorbitcoin-cli.exe, and explicitly blocks directory traversal attempts (..). This validation is now applied before initializingstd::process::Command::newin both invocations ofrun_bitcoin_cliacross the codebase.✅ Verification: Run
cargo test --bin zinc-clito ensure there are no regressions. Attempt to run the CLI with a maliciousbitcoin_clipath in the profile (e.g./bin/sh) to verify that the CLI correctly rejects it with a configuration error instead of executing it.PR created automatically by Jules for task 11265635129825612101 started by @bitcoiner-dev