🔒 Prevent potential command injection in modprobe - #236
undivisible wants to merge 1 commit into
Conversation
Adds strict validation for module names passed to modprobe to prevent potential argument or command injection. The validation ensures that the module name is not empty, does not start with a hyphen, and only contains ASCII alphanumeric characters, underscores, and hyphens. Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@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. |
Bugbot couldn't run - usage limit reachedBugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit. A user or team admin can review and increase usage limits in the Cursor dashboard. (requestId: serverGenReqId_feaa76c3-d138-4a1b-ac4e-d604622ae333) |
|
Tick the box to add this pull request to the merge queue (same as
|
🎯 What: The vulnerability fixed is a potential command/argument injection in the
⚠️ Risk: Although the current inputs are hardcoded, the pattern of passing arguments directly to
modprobeexecution block ininit.rs.Command::newwithout validation is a security hygiene issue. If this list were to be populated dynamically in the future, it could lead to command execution or unintended kernel module loading.🛡️ Solution: Added strict validation to ensure that the module name is not empty, does not start with a hyphen, and only contains ASCII alphanumeric characters, underscores, and hyphens. Invalid module names are skipped and logged as an error.
PR created automatically by Jules for task 14235387394271860600 started by @undivisible
Note
Low Risk
Boot-time hardening on a fixed module list; no change to mount logic or dynamic module loading.
Overview
Hardens early boot in
init.rsby validating each kernel module name before invoking/sbin/modprobe. Names that are empty, start with-, or contain characters outside ASCII alphanumerics, underscores, and hyphens are rejected with an error log and skipped instead of being passed through.Several
run("/bin/mount", …)calls were reformatted to multi-line argument lists only; mount behavior is unchanged.Reviewed by Cursor Bugbot for commit f2fa024. Configure here.