# GHSA-VVG7-P7JW-8QR3: BFF session cookie forwarded to remote APIs proxied through YARP

- Database: GitHub
- Severity: CVSS 6.8 (Medium)
- Published: 2026-10-07
- Modified: 2026-10-07

## Affected versions

- Duende.BFF.Yarp (NuGet): 4.3.0
- Duende.BFF.Yarp (NuGet): from 4.2.0-preview.1, fixed in 4.2.1
- Duende.BFF.Yarp (NuGet): from 4.1.0, fixed in 4.1.3
- Duende.BFF.Yarp (NuGet): from 4.0.0-preview1, fixed in 4.0.4
- Duende.BFF.Yarp (NuGet): from 3.1.0-preview.1, fixed in 3.1.1
- Duende.BFF.Yarp (NuGet): from 3.0.0-preview.1, fixed in 3.0.1
- Duende.BFF.Yarp (NuGet): 2.3.0
- Duende.BFF.Yarp (NuGet): fixed in 2.2.1

## Description

### Impact

Duende.BFF can proxy calls to remote APIs through YARP (`AddYarpConfig` or `AddBffExtensions` together with `MapReverseProxy` or `MapBffReverseProxy`). On routes with BFF metadata, the BFF adds the user's access token to the proxied request. It does not remove the browser's inbound `Cookie` header, and YARP forwards that header by default. As a result, every request to these routes sends all of the browser's cookies for the BFF's origin to the remote API. That includes the BFF session cookie (by default `__Host-bff-auth`, or `__Host-<frontend>` for multi-frontend setups), along with any other first-party cookies such as the antiforgery cookie and application cookies.

The BFF session cookie is a bearer credential. Anyone who can read request headers at the remote API or on the network path to it can replay the cookie directly against the BFF. Examples include the API itself, its request logs, APM or tracing tools, and intermediary proxies. A replayed cookie lets the attacker call BFF endpoints as the user, including other proxied APIs that the BFF calls with the user's tokens, for as long as the session stays valid. The BFF's antiforgery header check does not stop this attack, because the attacker sends requests directly and can add the header.

The risk is highest when a remote API is run by a different team, a separate tenant, or a third party, or when the API's request headers are logged or sent to observability tools.

The following are not affected:

- Remote APIs mapped with `MapRemoteBffApiEndpoint`, which already removes the `Cookie` header.
- Remote APIs configured on a frontend with `WithRemoteApis`.
- Local APIs.

### Are you affected?

You are affected if your BFF uses the YARP integration and at least one route has BFF access-token metadata. Vulnerable configurations look like one of the following:

```cs
builder.Services.AddBff()
    .AddRemoteApis()
    .AddYarpConfig(routes, clusters); // or AddYarpConfig(configuration)

// or
builder.Services.AddReverseProxy()
    .AddBffExtensions()
    .LoadFromConfig(configuration.GetSection("ReverseProxy"));

app.MapBffReverseProxy(); // or app.MapReverseProxy()
```

The route also has a token requirement. It can be set in code:

```cs
new RouteConfig { RouteId = "api", ClusterId = "api", /* ... */ }
    .WithAccessToken(RequiredTokenType.User);
```

or in configuration:

```json
"Routes": {
  "api": {
    "ClusterId": "api",
    "Match": { "Path": "/api/{**catch-all}" },
    "Metadata": { "Duende.Bff.Yarp.TokenType": "User" }
  }
}
```

### Patches

This vulnerability is fixed in all supported versions of Duende.BFF.Yarp.

After you apply the fix, the BFF removes the `Cookie` header from all requests it forwards through YARP. You can opt out of the new behavior globally with `BffOptions.RemoveCookieHeaderFromYarpRequests = false`. After opting out, YARP behaves as before, and standard YARP transforms (for example RequestHeaderRemove: Cookie) control cookie forwarding per route.

### Workarounds

If you cannot upgrade right away, add a transform that removes the `Cookie` header to each YARP route that has BFF metadata.

In code:

```cs
using Yarp.ReverseProxy.Transforms;

new RouteConfig { RouteId = "api", ClusterId = "api", /* ... */ }
    .WithAccessToken(RequiredTokenType.User)
    .WithTransformRequestHeaderRemove("Cookie");
```

In configuration:

```json
"Routes": {
  "api": {
    "ClusterId": "api",
    "Match": { "Path": "/api/{**catch-all}" },
    "Metadata": { "Duende.Bff.Yarp.TokenType": "User" },
    "Transforms": [
      { "RequestHeaderRemove": "Cookie" }
    ]
  }
}
```

### Remediation of possibly exposed sessions

Upgrading or applying the workaround stops future leaks. It does not invalidate cookies that were already forwarded. If you are affected, we recommend the following steps:

1. **Scrub logs.** Find and delete BFF cookies in request logs, traces, and APM data kept by the remote APIs and any intermediaries between the BFF and those APIs.
2. **Revoke sessions.**
   - *If you use server-side sessions* (`AddServerSideSessions`), revoke all active sessions. This makes every leaked cookie invalid.
   - *If you do not use server-side sessions*, the session and its tokens live in the encrypted cookie, so the BFF has no session to revoke. Rotate your ASP.NET Core Data Protection keys and revoke the old keys, so existing cookies can no longer be decrypted. Also revoke the users' refresh tokens at your identity provider, because the leaked cookies contain them. Both steps sign all users out.

### CVE ID Note

GitHub is currently experiencing a several week backlog on issuing CVE IDs. We'll update this advisory as soon as one is issued to us.

## References

- https://github.com/DuendeSoftware/products/security/advisories/GHSA-vvg7-p7jw-8qr3

Page: https://cve.now/GHSA-VVG7-P7JW-8QR3

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
