Skip to content

fix(login): strip URL lures from SSO_Message banner - #5681

Merged
norman-abramovitz merged 2 commits into
cloudfoundry:developfrom
nabramovitz:fix/sso-message-sanitize
Jul 22, 2026
Merged

fix(login): strip URL lures from SSO_Message banner#5681
norman-abramovitz merged 2 commits into
cloudfoundry:developfrom
nabramovitz:fix/sso-message-sanitize

Conversation

@nabramovitz

Copy link
Copy Markdown
Contributor

What

/login?SSO_Message=<text> is attacker-controllable and rendered in the login
alert banner (login-page.component.html:125, via {{ }}). Interpolation
already HTML-escapes, so this is not XSS — but the plain text can carry a
URL that reads like a trusted Stratos instruction, enabling social engineering:

/login?SSO_Message=SECURITY%20BREACH%20DETECTED.%20Please%20visit%20https://evil.com%20to%20resolve

Fixes the low-severity injection reported in #5672.

Change

Sanitize SSO_Message before display: strip URL-like tokens (schemes, www.,
bare domain.tld[/path]) → [link removed], then cap length to keep it a
status line. The banner stays plain-text-plus-template-styling by design — no
switch to [innerHTML], which would turn this into a real XSS surface.

Legitimate messages are untouched: the backend only emits short status text
(authuaa.go — "You have been logged out", raw UAA error strings), none of
which contain URLs.

Detection note

No new logging added: the crafted request is already captured operator-side in
the frontend (nginx) access log, whose default combined format records the
full request line including the query string, shipped via cf logs. Backend
logging would be redundant (jetstream's echo logger drops the query anyway) and
would reintroduce a log-injection concern.

Tests

login-page.component.spec.ts: strips scheme/www./bare-domain URLs, caps at
256 chars, and passes legit messages through unchanged. npx vitest run --project=core login-page.component → green; lint clean.

Closes #5672

The /login SSO_Message query param is attacker-controllable and rendered
in the login alert banner. Interpolation already escapes HTML, so this is
not XSS, but the plain text can carry a URL that reads as a trusted Stratos
instruction (social engineering) — e.g.
/login?SSO_Message=SECURITY+BREACH...+visit+https://evil.com.

Sanitize the value before display: replace URL-like tokens (schemes, www.,
bare domain.tld) with [link removed] and cap length. Legit messages
("You have been logged out", UAA errors) pass through unchanged.

Refs cloudfoundry#5672

@norman-abramovitz norman-abramovitz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - will look to improve later to see if we can keep some HTML formatting commands, but not now.

@norman-abramovitz
norman-abramovitz merged commit 5a1783f into cloudfoundry:develop Jul 22, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

query parameter SSO_Message for login is not validated and allows for malicious message/url injection

2 participants