Skip to content

Security: Terminal escape sequence injection via crafted app names#636

Open
barttran2k wants to merge 2 commits intooffa:masterfrom
barttran2k:contribai/fix/security/terminal-escape-sequence-injection-via-c
Open

Security: Terminal escape sequence injection via crafted app names#636
barttran2k wants to merge 2 commits intooffa:masterfrom
barttran2k:contribai/fix/security/terminal-escape-sequence-injection-via-c

Conversation

@barttran2k
Copy link
Copy Markdown
Contributor

Problem

In ensure_sorted.py, app names are extracted from README.md via regex and printed directly to the terminal interspersed with ANSI escape codes. If a malicious contributor inserts crafted escape sequences within app name fields in the Markdown (e.g., [**\x1b]malicious\x1b\\**]), they could potentially manipulate terminal output, hide malicious changes, or in some terminals execute commands.

Severity: low
File: ensure_sorted.py

Solution

Sanitize extracted app names before printing to the terminal by stripping or escaping non-printable and control characters, e.g., app_name = re.sub(r'[\x00-\x1f\x7f-\x9f]', '', app_name).

Changes

  • ensure_sorted.py (modified)
  • index.html (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced

In `ensure_sorted.py`, app names are extracted from `README.md` via regex and printed directly to the terminal interspersed with ANSI escape codes. If a malicious contributor inserts crafted escape sequences within app name fields in the Markdown (e.g., `[**\x1b]malicious\x1b\\**]`), they could potentially manipulate terminal output, hide malicious changes, or in some terminals execute commands.

Affected files: ensure_sorted.py, index.html

Signed-off-by: Trần Bách <45133811+barttran2k@users.noreply.github.com>
In `ensure_sorted.py`, app names are extracted from `README.md` via regex and printed directly to the terminal interspersed with ANSI escape codes. If a malicious contributor inserts crafted escape sequences within app name fields in the Markdown (e.g., `[**\x1b]malicious\x1b\\**]`), they could potentially manipulate terminal output, hide malicious changes, or in some terminals execute commands.

Affected files: ensure_sorted.py, index.html

Signed-off-by: Trần Bách <45133811+barttran2k@users.noreply.github.com>
Copy link
Copy Markdown
Owner

@offa offa left a comment

Choose a reason for hiding this comment

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

Please see comments in #634.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants