The vulnerability is a reflected Cross-Site Scripting (XSS) issue in the /api/icon/getDynamicIcon endpoint. The root cause is two-fold:
- User-provided input from the
content query parameter is directly embedded into an SVG template without proper XML/HTML escaping. This happens within the generateTypeEightSVG function, which is called by getDynamicIcon.
- The resulting SVG string was then passed to a weak sanitizer,
util.RemoveScriptsInSVG. As the function name implies, it only removed <script> tags, leaving other vectors for script execution like onerror attributes intact.
The patch addresses this by replacing the inadequate util.RemoveScriptsInSVG function with a new, more thorough util.SanitizeSVG function. The new function removes a wider range of dangerous tags (like iframe, object), event handler attributes (like onerror), and unsafe attribute values (like javascript: in href).
The analysis of the commit d68bd5a79391742b3cb2e14d892bdd9997064927 confirms this. The changes show RemoveScriptsInSVG being replaced by SanitizeSVG in two places: kernel/api/icon.go within the getDynamicIcon function (the primary vulnerable endpoint) and kernel/server/serve.go within the serveSVG function.
Therefore, the key functions that would appear in a runtime profile during exploitation are getDynamicIcon, which is the entry point for the attack, and RemoveScriptsInSVG, which is the function that fails to prevent it. The serveSVG function is also included as it contained the same vulnerable pattern.