T09 · Insecure Skill Coding Practices
- Location
assets/onboarding-system.html:753- Finding
DOM-based cross-site scripting through chat input
- Content
View full analysis
👤${text}`; ``` ### Technical Analysis The `text` value originates from the user-controlled chat input and is interpolated directly into an HTML template. The resulting string is assigned to `innerHTML` without output encoding or sanitization. Because `innerHTML` parses its input as markup, an attacker can supply active HTML, including elements with event-handler attributes. For example, an image element with an error handler would execute JavaScript when the browser parses the generated message. This application is described as a local dashboard, so exploitation generally requires a victim to enter or paste attacker-supplied content. Nevertheless, the code creates a valid arbitrary JavaScript execution primitive within the application's browser origin. ### Attack Path 1. A victim opens the onboarding dashboard and navigates to the chat panel. 2. The victim enters or pastes attacker-controlled HTML into the chat field, such as an element containing an event handler. 3. `sendMessage()` reads the value into `text`. 4. The application interpolates `text` into an HTML string. 5. The string is appended through `msgs.innerHTML`. 6. The browser parses the injected markup and executes its active content. 7. The injected script can access the page DOM and origin-accessible browser storage. ### Impact Assessment Successful exploitation permits arbitrary JavaScript execution in the dashboard's browser context. The injected code can: - Read and modify onboarding information stored in `localStorage`. - Alter checklist, roadmap, task, and satisfaction data. - Manipulate the visible interface or display deceptive content. - Trigger a ...[truncated 259 chars]- Remediation
View remediation
