8000 JavaScript Injection in frontchannel-logout.ftl via frontchannel-logout.title · Issue #48241 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

JavaScript Injection in frontchannel-logout.ftl via frontchannel-logout.title #48241

Closed

Description

@rmartinc

Before reporting an issue

  • I have read and understood the above terms for submitting issues, and I understand that my issue may be closed without action if I do not follow them.

Area

authentication

Describe the bug

The file frontchannel-logout.ftl uses a properties directly in javascript. Messages are controlled by realm administrators, so low risk, but better if we improve this.

We can use a javascript output <#outputformat "JavaScript"> and use "${msg("frontchannel-logout.title")?c} to properly escape the message or add a title parameter to the templates and add it normally in the HTML part.

Version

26.6.1

Regression

  • The issue is a regression

Expected behavior

The message should be escaped or added not in JS.

Actual behavior

The msg is added using JS and not properly escaped in the ftl file.

How to Reproduce?

N/A

Anything else?

No response

Activity

  1. added
    area/authenticationAuth flows, authenticators, required actions, OTP, password policies, brute force
    kind/bugCategorizes a PR related to a bug
    on Apr 20, 2026
  2. added theissue type on Apr 20, 2026
  3. self-assigned this
    on Apr 20, 2026
  4. ahus1 commented on Apr 20, 2026

    @ahus1
    Member

    add a title parameter to the templates and add it normally in the HTML part.

    @rmartinc - I would prefer the setup as it would allow a version without JavaScript handling this. I'd be happy to provide pointers.

  5. added a commit that references this issue on Apr 21, 2026
    962d834
  6. added a commit that references this issue on Apr 21, 2026
    720b899
  7. 7 remaining items

  8. dominiktopp commented on Jun 23, 2026

    @dominiktopp
    Contributor

    Hi @rmartinc,

    unfortunately your fix is introducing an new bug one or is a breaking change:
    When realm display name is a placeholder, e.g. ${myRealmDisplayNameKey} and a localization (either in realm overrides or in theme) for this key My browser tab title for myRealm:

    • Before your change: HTML title attribute has been correctly resolved to My browser tab title for myRealm.
    • After your change: HTML title is set to unresolved ${myRealmDisplayNameKey}

    The old Keycloak version used <title>${msg("loginTitle",(realm.displayName!''))}</title> and msg (MessageFormatterMethod.java) also resolves placeholders in the params.
    The new Keycloak version uses getMessage("loginTitle", realmBean.getDisplayName()) but FreeMarkerLoginFormsProvider#getMessage does NOT resolve placeholders in the params array.

    Our workaround is to reset the title attribute in template.ftl to using msg.

    Should we reopen this issue or create a new one?

  9. added a commit that references this issue on Jul 20, 2026
    92bf13e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

Fields

No fields configured for bug.

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    0