Skip to content

Comments

πŸ›‘οΈ Sentinel: [HIGH] Fix Windows command injection via % and ^#779

Open
adolago wants to merge 1 commit intomainfrom
sentinel-fix-windows-command-injection-3792982972886342161
Open

πŸ›‘οΈ Sentinel: [HIGH] Fix Windows command injection via % and ^#779
adolago wants to merge 1 commit intomainfrom
sentinel-fix-windows-command-injection-3792982972886342161

Conversation

@adolago
Copy link
Owner

@adolago adolago commented Feb 20, 2026

🚨 Severity: MEDIUM (Info Disclosure / Obfuscation)
πŸ’‘ Vulnerability: The validate_command_args function previously allowed % and ^ characters. On Windows systems where commands may be executed via cmd.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 in src/modules/mod.rs.
βœ… Verification: Added new regression tests in tests/security_windows_command_injection.rs confirming that payloads containing these characters are now rejected with a ModuleError::InvalidParameter.


PR created automatically by Jules for task 3792982972886342161 started by @dolagoartur

- 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>
@google-labs-jules
Copy link
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ 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".

Comment on lines +436 to +437
("%", "variable expansion %"),
("^", "shell escape ^"),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 πŸ‘Β / πŸ‘Ž.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant