In-depth lesson · XSS
Typical fixes
Every point the XSS reports back under this heading, best-backed first, each with the reports it is seen in.
-
Escape hash keys when converting to JSON, as values already are.
Seen in 1 report
-
Escape name values in email templates.
Seen in 1 report
-
Escape or decode parameters inserted into JavaScript string literals rather than relying on browser apostrophe encoding.
Seen in 1 report
-
Escape or sanitise allowed HTML elements in name fields before rendering.
-
Escape quotes and apply attribute-context encoding, not just angle bracket encoding.
Seen in 1 report
-
Escape quotes in the namespace URL when serialising the @namespace rule.
Seen in 1 report
-
Escape search and category parameters before reflecting them.
Seen in 1 report
-
Medium
-
-
Escape search parameters embedded into CSS blocks.
Seen in 1 report
-
Escape single quotes and other characters when embedding input into JSON in a script context.
Seen in 1 report
-
Escape SMTP error text before inserting it into the page.
Seen in 1 report
-
Escape the API title and description before inserting them into generated HTML.
-
Escape the customer email address in the packing slip template.
Seen in 1 report
-
Escape the request URI before inserting it into an anchor href.
-
Escape the review URL in every attribute, including href, not just title.
Seen in 1 report
-
Escape User-Agent and Referer headers before storing them in the log page.
Seen in 1 report
-
Escape user-supplied input before inserting it into email HTML.
Seen in 1 report
-
Escape usernames instead of using Twig's raw filter.
-
Fall back to a safe default when no Content-Type header is present instead of trusting the type attribute.
Seen in 1 report
-
Filter the URL segment in the analytics callback path.
-
Handle duplicate parameters and sanitise every occurrence, not just the first.
Seen in 1 report
-
Handle lesser-used styling attributes in the sanitiser and escape content inserted into JavaScript template strings.
Seen in 1 report
-
Handle nested tags consistently across parser implementations.
Seen in 1 report
-
HTML-encode angle brackets and set HttpOnly on session cookies.
Seen in 1 report
-
HTML-encode campaign names before outputting them into admin pages.
Seen in 1 report
-
HTML-encode circle display names before rendering in the search UI.
Seen in 1 report
-
HTML-encode logged request data before showing it in an admin dashboard.
Seen in 1 report
-
HTML-encode multipart field names and add CSRF protection to add-to-cart.
Seen in 1 report
-
HTML-encode or validate the page format parameter before echoing it.
Seen in 1 report
-
HTML-encode output placed inside attributes and validate the search term.
Seen in 1 report
-
HTML-encode reflected values in error pages.
Seen in 1 report
-
HTML-encode script standard output before rendering.
-
HTML-encode the comment value and add a CSRF token to the comment endpoint.
-
HTML-encode the current folder value before inserting it into the page.
Seen in 1 report
-
HTML-encode the Display Name before rendering it.
-
HTML-encode user-controlled PDF metadata and filenames before displaying them in chat.
Seen in 1 report
-
HTML-encode user-supplied message bodies before inserting them into outgoing emails.
Seen in 1 report
-
HTML-escape error messages and validate the redirect parameter.
Seen in 1 report
-
HTML-escape the region parameter before reflection.
Seen in 1 report
-
Medium
-
-
HTML-escape tracker names on the conversion statistics page.
Seen in 1 report
-
Insert the placeholder as text rather than assigning it to innerHTML.
Seen in 1 report
-
Insert title and subtitle as text rather than concatenating them into an HTML string.
-
Inspect compressed response bodies at the WAF.
-
Invalidate existing sessions when a password changes.
Seen in 1 report
-
Isolate javascript: URLs opened via new windows from the top-level origin.
Seen in 1 report
-
Keep a content security policy in place to mitigate script injection through the PDF rendering SDK.
Seen in 1 report
-
Keep JavaScript libraries up to date to avoid known vulnerabilities.
Seen in 1 report
-
Linkify mentions and references during markdown parsing rather than as post-processing on rendered HTML.
-
Make the browser ignore an injected base element for relative URL resolution when CSP restricts base-uri.
Seen in 1 report
-
Make the caching layer and application parse duplicate cookies consistently and sanitise cookie values reflected into script contexts.
Seen in 1 report
-
Make the sanitiser regex account for newlines.