Skip to content

Security: Stored XSS via Unsanitized onclick Attribute Injection in Sidebar #167

@rishab11250

Description

@rishab11250

Summary

Script names and relative_path values are interpolated directly into onclick handler strings in renderSidebar() without any escaping. A maliciously-named script file breaks out of the JS string and executes arbitrary code.

Location

ui/app.js — renderSidebar(), renderWelcomeStats()

Vulnerable patterns:
onclick="selectScript('${s.relative_path}')"
onclick="toggleCategory('${cat}')"
onclick="toggleFavorite('${s.relative_path}')"

Steps to Reproduce

  1. Create a script file named: test'; alert(1); '.sh
  2. Refresh the app
  3. Script appears in sidebar
  4. Sidebar renders: onclick="selectScript('test'; alert(1); '.sh')"
  5. alert() executes

Risk

Stored XSS. Attacker needs write access to scripts/ directory or can social engineer via GitHub import.

Proposed Fix

Replace onclick string handlers with addEventListener via dataset attributes or pass all interpolated values through escapeAttr().

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions