The vulnerability is a reflected Cross-Site Scripting (XSS) issue in Liferay Portal, triggered through the referer and FORWARD_URL parameters. The core of the problem is the insufficient sanitization of these parameters, which can be bypassed using a null byte (%00).
The analysis of the provided commits reveals that the function com.liferay.portal.kernel.util.HtmlUtil.escapeJSLink is the security control responsible for preventing this type of XSS. The patches directly modify the logic within this function to address the vulnerability.
The commit bf20bc07e3e3421d39eaacff052418ce26d791f2 is particularly revealing. It removes a flawed check that relies on the position of the colon character (:). This check was too specific and could be easily bypassed with a null byte, as the null byte would shift the position of the colon, causing the check to fail and the malicious script to pass through unsanitized.
The patch replaces the weak check with link.contains("javascript:"). The commit message, "Simplifly and prevent null byte injection," indicates that this change is intended to correctly handle strings containing null bytes and prevent the bypass.
Therefore, com.liferay.portal.kernel.util.HtmlUtil.escapeJSLink is the vulnerable function. During an exploit, this function would be present in the runtime profile, as it is the point where the malicious input is processed. The vulnerability is not that the function is inherently malicious, but that its sanitization logic was inadequate and could be circumvented.