The analysis of commit 078bd4754905f5130eaa7bbe45f958eaeb7fd0d7 revealed fixes for a Reflected Cross-Site Scripting (XSS) vulnerability in two separate FreeMarker templates. The root cause is the lack of output encoding for user-supplied data when generating HTML responses.
-
The primary vulnerability, described in the advisory, is in the OAuth 2.0 form_post response mode. The FormPostResponse.ftl template was modified to add HTML escaping (?html) to the redirectUri and the formValues map, which contains the potentially malicious state parameter. The Java method responsible for preparing this data and rendering the template is org.forgerock.openam.oauth2.handlers.FormPostResponseHandler.buildResponse. This function would appear in a runtime profile when the vulnerability is triggered.
-
A similar XSS flaw was fixed in the checkSession.ftl template, which is used for OpenID Connect session management. The baseUrl variable was not escaped before being included in a <script> tag. The org.forgerock.openam.oauth2.CheckSessionIFrame.service method is the server-side function that prepares the data for this template.
Both identified functions are the points where unsanitized data is passed to the vulnerable templates, making them the key runtime indicators for this vulnerability.