The vulnerability is a stored Cross-Site Scripting (XSS) issue in the Liferay Portal's mentions functionality. The root cause is the failure to properly sanitize user-provided data, specifically a user's first, middle, or last name, before it is rendered on a page. The provided patch, commit 4218ecd902dbd860d3f9ee233b0ffa4c822a49ee, clearly shows the fix for this vulnerability. The changes are located in the _getJSONArray method of the com.liferay.mentions.web.internal.portlet.MentionsPortlet class. Before the patch, the method directly used the values from user.getScreenName() and user.getFullName() and placed them into a JSON object. This JSON object is then used to display the user's name when they are mentioned. The patch rectifies this by wrapping these calls with HtmlUtil.escape(), which neutralizes any embedded HTML or script content. Therefore, the _getJSONArray function is the specific vulnerable function where the unsanitized data was processed, leading to the XSS vulnerability.