π‘οΈ Sentinel: [HIGH] Fix Windows command injection via % and ^#779
π‘οΈ Sentinel: [HIGH] Fix Windows command injection via % and ^#779
Conversation
- Remove `%` from safe characters list in `src/modules/mod.rs` to ensure it undergoes dangerous pattern check. - Add `%` (variable expansion) and `^` (shell escape) to `dangerous_patterns` list in `src/modules/mod.rs` to prevent Windows-specific injection and info disclosure. - Add regression tests in `tests/security_windows_command_injection.rs`. - Update security journal in `.jules/sentinel.md`. Co-authored-by: dolagoartur <146357947+dolagoartur@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. |
There was a problem hiding this comment.
π‘ Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d1482c1b73
βΉοΈ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with π.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ("%", "variable expansion %"), | ||
| ("^", "shell escape ^"), |
There was a problem hiding this comment.
Scope Windows metacharacter checks to Windows shells
Blocking "%" and "^" in validate_command_args for all platforms introduces a functional regression because this validator is called unconditionally by CommandModule::validate_params (src/modules/command.rs) and ServiceConfig::from_params (src/modules/service.rs), so benign POSIX commands/args like date +%Y%m%d or regex arguments containing ^ now fail with InvalidParameter even though the reported risk is specific to cmd.exe expansion on Windows.
Useful? React with πΒ / π.
π¨ Severity: MEDIUM (Info Disclosure / Obfuscation)
π‘ Vulnerability: The
validate_command_argsfunction previously allowed%and^characters. On Windows systems where commands may be executed viacmd.exe, this allowed environment variable expansion (e.g.,%USERNAME%) leading to information disclosure, and command obfuscation using the caret escape character (^).π― Impact: An attacker could potentially read sensitive environment variables or bypass simple string filters by obfuscating commands (e.g.,
w^h^o^a^m^i).π§ Fix: Removed
%from the safe character allowlist and explicitly added%and^to the dangerous patterns blocklist insrc/modules/mod.rs.β Verification: Added new regression tests in
tests/security_windows_command_injection.rsconfirming that payloads containing these characters are now rejected with aModuleError::InvalidParameter.PR created automatically by Jules for task 3792982972886342161 started by @dolagoartur