# Stored XSS > Persistent XSS where the payload is saved by the application (database, file, config) and served unescaped to other users later, so it fires without the victim clicking an attacker link — the highest-baseline-impact XSS class. ## How it works Attacker input is persisted and rendered to viewers who never interact with the attacker. Impact scales with *who* views it: a payload in a public comment hits every reader; one in an admin-only view becomes [[Blind XSS]]. Because it self-triggers in an authenticated victim's session, stored XSS is the natural precursor to [[Account Takeover]], privilege escalation, and worming. Common stored sinks that evade naive filters: - Profile fields (name, bio, avatar), comments, posts, filenames, markdown, rich-text/WYSIWYG output. - Non-obvious fields parsed later: ID3 tags (Ampache song lyrics), post slugs (WriteFreely), SVG/HTML uploads ([[SVG and File Upload XSS]]), topic/MIME names (MQTTX, EdgeEver), custom-property options (GitHub Enterprise Server). - Second-order: value stored safely in one context, rendered unsafely in another (markdown renderer trusting its own output; Semantic MediaWiki property labels). ## Techniques / payloads - Mapping: submit a unique marker per field, then grep every rendered surface (your profile, others' views, admin tooling, exports, emails). Use Burp to correlate input→output points. - Breakout mirrors [[Reflected XSS]] but you also control persistence/format: markdown `[x](javascript:alert(1))`, HTML in a field claimed to be plain text, event handlers surviving an attribute-level sanitizer. - Framework-specific sinks: jQuery `.html()` (forum-java), Alpine `x-` directives (Axeloz), Angular template compiler schema gaps (CVE-2025-66412 via SVG animation/MathML), `srcdoc` (SunEditor). - Privilege escalation: inject into a field rendered inside a higher-privileged user's session. Contributor → admin by planting a payload an admin will open (The Events Calendar CVE-2026-123464; Pretalx CVE-2026-41241 forcing talk acceptance). ## Notable cases - **XSS → RCE in Electron/desktop renderers:** Opera *My Flow* (Renwa), MeshCentral, DbGate (CVE-2026-34725), Storybook dev server (CVE-2026-27148, via WebSocket). The renderer has Node/privileged context, so DOM injection becomes code execution. - **Stored XSS → server RCE:** Magento 2.3.1 unauthenticated stored XSS chained to authenticated PHAR deserialization; PivotX CMS (CVE-2025-52367). - **Mass impact:** "stored XSS on thousands of webshops" via a shared component; cache-poisoned stored XSS (PayPal $18.9k, GitLab DesignReferenceFilter $16k). - **Session theft → ATO:** unescaped bio field → admin session hijack (spyboy); GitHub Enterprise Server stored XSS used to add an attacker SSH key to another user. - **Admidio 5.0.0–5.0.17 (CVE-2026-134262, critical)**: role administrators put quote-breaking role names into an unencoded `data-message` attribute (`modules/profile/roles_functions.php`). When a full administrator views the profile, the script steals the CSRF token and assigns the attacker more privileges ([[raw/github.com/admidio-critical-stored-xss-15625|GHSA-956j-82cc-g6jm]]). ## Defenses - Encode on output for the exact render context; treat every "plain text" field as untrusted HTML when it may be rendered as HTML later. - Sanitize rich text/markdown with a vetted allowlist sanitizer (DOMPurify) — and know its limits ([[Mutation XSS]]). - Serve user uploads from a separate origin with `Content-Disposition: attachment` and `X-Content-Type-Options: nosniff` ([[SVG and File Upload XSS]]). - Defense-in-depth: [[Content Security Policy]], `HttpOnly` cookies, and move session tokens out of JS-readable `localStorage`. ## Related - [[Cross-Site Scripting]] · [[Reflected XSS]] · [[Blind XSS]] · [[SVG and File Upload XSS]] · [[Account Takeover]] · [[Content Security Policy]] · [[Unrestricted File Upload]] ## Sources - [[raw/portswigger.net/testing-for-stored-xss-with-burp-suite-2549|Testing for stored XSS with Burp Suite]] - [[raw/medium.com/from-contributor-to-administrator-stored-xss-in-the-events-calendar-14034|Contributor to Administrator: Stored XSS in The Events Calendar]] - [[raw/rescana.com/cve-2026-41241-critical-stored-xss-in-pretalx-conference-platform-allo-8323|Critical Stored XSS in Pretalx (CVE-2026-41241)]] - [[raw/sonarsource.com/magento-2-3-1-unauthenticated-stored-xss-to-rce-3082|Magento 2.3.1: Unauthenticated Stored XSS to RCE]] - [[raw/medium.com/stored-xss-in-my-flow-to-rce-in-opera-browser-2-renwa-medium-5005|Stored XSS in My Flow to RCE in Opera Browser]] - [[raw/techanarchy.net/meshcentral-from-xss-to-rce-9182|MeshCentral: From XSS to RCE]] - [[raw/medium.com/the-renderer-that-trusted-its-own-output-stored-xss-through-a-markdown-13380|Stored XSS Through a Markdown Sanitization Gap]] - [[raw/medium.com/how-i-found-a-stored-xss-on-thousands-of-webshops-366|Stored XSS on thousands of webshops]] - [[raw/spyboy.blog/how-i-hacked-a-web-app-using-stored-xss-to-steal-sessions-3108|Stored XSS to Steal Sessions]] - [[raw/github.com/github-enterprise-server-stored-xss-15031|GitHub Enterprise Server stored XSS]] - [[raw/github.com/admidio-critical-stored-xss-15625|Admidio critical stored XSS]]