Skip to content

Blazor samples use return URLs without validating them #692

Done

Description

@oroztocil

Several Blazor samples use a return URL from the query string or a form without checking that it points back to the app. A crafted link can send users to another site, and in some samples a javascript: return URL runs script on the app's origin.

Example: in BlazorWebAssemblyStandaloneWithIdentity, signing in via /login?ReturnUrl=javascript:alert(document.domain) runs the script. In the general Blazor samples, clicking the "Return" link on /pet-detail/1?ReturnUrl=javascript:alert(document.domain) runs it.

Affected:

  • GetAuthProperties in LoginLogoutEndpointRouteBuilderExtensions.cs in the OIDC and Entra BFF samples (8.0 to 10.0): ReturnUrl=//evil.example becomes the authentication redirect URI, so users land on that site after they sign in or out.
  • Login.razor in BlazorWebAssemblyStandaloneWithIdentity (8.0 to 10.0): navigates to ReturnUrl after sign-in without checking it (open redirect and javascript: URLs).
  • IdentityRedirectManager.cs in MauiBlazorWebIdentity (9.0 and 10.0): the same open redirect as the Blazor Web App template, tracked by Open redirect possible in Blazor template IdentityRedirectManager.RedirectTo aspnetcore#70797.
  • PetDetail.razor in the general Blazor samples (7.0 to 10.0): renders ReturnUrl directly as the "Return" link (open redirect and javascript: URLs).

The fix should follow the code in dotnet/aspnetcore#70796.

Activity

  1. self-assigned this
    on Nov 24, 2026
  2. changed the title [-]Blazor OIDC, Entra and Identity samples allow open redirects through return URLs[/-] [+]Blazor samples use return URLs without validating them[/+] on Nov 24, 2026
  3. added
    Bug
    and removed
    Not triaged
    on Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions