JSON-LD script tag vulnerable to XSS via </script> in content #34
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
JsonLdBuilder::toScriptTag()at line 163 concatenates JSON directly into a<script>tag:If any OG data (title, description, author name) contains the string
</script>, the browser will interpret it as closing the script block, allowing arbitrary HTML/JS injection.Impact
Security vulnerability: An article author or anyone who can set OG title/description could inject JavaScript via stored XSS through the JSON-LD output.
Fix
Escape
</sequences in the JSON output before embedding in the script tag:This is the standard mitigation per the HTML spec for inline JSON.
File
src/packages/plg_system_mokoog/src/Helper/JsonLdBuilder.php:163-166Branch created:
feature/34-json-ld-script-tag-vulnerable-to-xss-via