[SECURITY] HIGH: HTML injection in Telegram messages #5

Closed
opened 2026-03-25 10:38:06 +01:00 by shoko · 0 comments
Owner

Severity: HIGH

Event titles from Polymarket API are inserted directly into Telegram messages with parse_mode=HTML without escaping. Characters like <, >, & are not escaped.

Location

scripts/browse.py lines 614-661 (send_to_telegram())

Attack Scenario

  1. Polymarket (or attacker who compromises data) includes title like <script>alert('XSS')</script>
  2. The bot sends this to Telegram
  3. Telegram renders the HTML (limited XSS risk but malformed HTML can cause issues)
import html

def escape_html(text):
    return (text
        .replace("&", "&amp;")
        .replace("<", "&lt;")
        .replace(">", "&gt;")
        .replace('"', "&quot;"))

title_escaped = escape_html(title_clean)
lines.append(f"<b>{i}.</b> <a href=\"{url}\">{title_escaped}</a>")

Reference

See reviews/2026-03-25.md Section 6.3

## Severity: HIGH Event titles from Polymarket API are inserted directly into Telegram messages with `parse_mode=HTML` without escaping. Characters like `<`, `>`, `&` are not escaped. ## Location `scripts/browse.py` lines 614-661 (`send_to_telegram()`) ## Attack Scenario 1. Polymarket (or attacker who compromises data) includes title like `<script>alert('XSS')</script>` 2. The bot sends this to Telegram 3. Telegram renders the HTML (limited XSS risk but malformed HTML can cause issues) ## Recommended Fix ```python import html def escape_html(text): return (text .replace("&", "&amp;") .replace("<", "&lt;") .replace(">", "&gt;") .replace('"', "&quot;")) title_escaped = escape_html(title_clean) lines.append(f"<b>{i}.</b> <a href=\"{url}\">{title_escaped}</a>") ``` ## Reference See `reviews/2026-03-25.md` Section 6.3
shoko added the highsecurity labels 2026-03-25 10:38:06 +01:00
shoko closed this issue 2026-03-25 13:13:52 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/jujutsu-skills#5