🔒 Fix Command Execution with relative useradd path - #411
Conversation
Replace Command::new("useradd") with absolute path Command::new("/usr/sbin/useradd") in server_manager/src/core/system.rs to eliminate risk of binary hijacking via PATH manipulation. Added unit test suite for username input validation.
|
👋 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. |
🎯 What:
Replaced
Command::new("useradd")with absolute path/usr/sbin/useraddinserver_manager/src/core/system.rsand added a unit test module validating username input sanitization.Using relative executable names in
Command::newrelies on$PATHresolution. If an attacker gains control over$PATHor writes to a directory preceding/usr/sbinin$PATH, they could hijack execution when creating system users.🛡️ Solution:
Updating
Command::new("useradd")to/usr/sbin/useraddguarantees execution of the trusted system binary regardless of environment$PATHoverrides.PR created automatically by Jules for task 13098466155646312693 started by @Cylae