Skip to content

🛡️ Sentinel: [HIGH] Fix open-redirect bypass in sign-in return path - #141

Merged
jnnngs merged 1 commit into
mainfrom
claude/magical-carson-xwm3mw
Nov 13, 2026
Merged

jnnngs merged 1 commit into
mainfrom
claude/magical-carson-xwm3mw

Conversation

@jnnngs

@jnnngs jnnngs commented Nov 12, 2026

Copy link
Copy Markdown
Collaborator

🚨 Severity

HIGH. Open redirect on the sign-in flow, which is the most convincing place in the application to have one — a user who has just typed a password is primed to trust whatever page they land on.

💡 Vulnerability

safeReturnPath in authlogin.go gates the ?next= parameter the login page replays after a successful sign-in. It rejects a URL, a protocol-relative //host, and a value containing a backslash, but it does not reject ASCII tab (\t), carriage return (\r) or line feed (\n).

The WHATWG URL spec strips those three characters when a browser parses a URL. A value like "/\t//evil.example" therefore passes the guard — it starts with /, is not //, and contains no \ — but once the browser receives a Location: /\t//evil.example header it parses the string, drops the tab, and navigates to //evil.example, an attacker-controlled host over the same scheme as the sign-in page.

🎯 Impact

  • An attacker who can get a victim to click …/login?next=/%09//evil.example can redirect them to an arbitrary host immediately after they sign in. The URL still points at the real console and the landing page can be made to look like the console that was just left.
  • Scripted callers (curl, CI, the installer's own checks) are unaffected: this path is only used by the browser sign-in flow.
  • All three AUTH_MODE settings that render the sign-in page (local, oidc) are affected. AUTH_MODE=none does not render it, so that default deployment is not in scope.

🔧 Fix

One refusal added to the existing guard: strings.ContainsAny(raw, "\t\r\n"). The docstring records why the three characters specifically, and the existing TestSafeReturnPath table gains three rows pinning the new refusal in place alongside the other open-redirect bypasses it already covers.

Change size: 14 lines across two files.

✅ Verification

  • go test -run TestSafeReturnPath ./... — passes with the new cases, including a run with the refusal removed from the guard that failed them (so the test was seen to fail).
  • go test -short -count=1 ./... — full short suite green (cmd package, connect3270, every internal/*).
  • go vet ./... — clean.
  • gofmt -l authlogin.go auth_test.go — clean.

The compat suite is skipped under -short as expected; this change does not touch the emulator path.


Generated by Claude Code

WHATWG URL parsing strips ASCII tab, carriage return and line feed from
a URL before using it. A Location header carrying "/\t//evil.example"
therefore lands the browser on "//evil.example" once it has been parsed,
turning the sign-in return path into an open redirect even though the
value began with the single leading "/" the previous check demanded.

Reject any of the three characters outright, and extend the test covering
the other open-redirect bypasses to pin the new refusal in place.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011MNNzo94dUq2kHjjRCLgAW
@jnnngs
jnnngs marked this pull request as ready for review November 13, 2026 07:50
@jnnngs
jnnngs merged commit ae0d129 into main Nov 13, 2026
3 checks passed
@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-13T07:50:58.944877Z
We couldn’t complete this review. Comment @codex review to try again.
753aef7 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

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.

2 participants