The vulnerability exists in two parts of Apache JSPWiki: the core markup parser and the Markdown extension. Both failed to properly sanitize user input when rendering links, leading to a Cross-Site Scripting (XSS) vulnerability. The analysis of the provided patches confirms this.
-
JSPWiki Core Parser (JSPWikiMarkupParser.java): The makeLink function, when creating a footnote link, directly used the provided text without escaping, even when the allowHTML setting was turned off. An attacker could craft a malicious link with embedded JavaScript, which would then be executed in the victim's browser. The patch introduces conditional escaping using escapeHTMLEntities when HTML is not allowed, mitigating the vulnerability.
-
Markdown Extension (MarkdownDocument.java): The options method, responsible for configuring the underlying flexmark-java Markdown parser, did not set the option to escape HTML based on the wiki's global configuration. This resulted in the Markdown parser always rendering raw HTML, creating another vector for XSS. The fix involves setting the HtmlRenderer.ESCAPE_HTML option according to the jspwiki.translatorReader.allowHTML property.
Both identified functions are directly involved in the processing of potentially malicious input and were modified in the security patches to add the necessary sanitization. Therefore, they are the key indicators of this vulnerability at runtime.