Cyber Risks · PortSwigger Research

Lab: Stored XSS into onclick event with angle brackets and double quotes HTML-encoded and single quotes and backslash escaped

Summary: PortSwigger's Web Security Academy lab describes a stored cross-site scripting flaw in a comment feature, where the author name is reflected inside an onclick event handler attribute with angle brackets and double quotes HTML-encoded and single quotes and backslash escaped. The solution posts a comment with a random alphanumeric string in the Website input, intercepts the request in Burp Repeater, and injects the payload http://foo?'-alert(1)-' so that clicking the comment author name triggers an alert.

Bottom line: The lab shows that encoding angle brackets and double quotes while escaping single quotes and backslashes still leaves an onclick handler injectable through a JavaScript URL, so a filter tuned to those characters alone does not close the hole.

Read the original at PortSwigger Research ↗

Topics
Vulnerabilities & Patching
Related