dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.38k stars 9.99k forks source link

[Blazor] Security recommendations for Blazor apps using Server Components with Websocket compression enables #53640

Open javiercn opened 9 months ago

javiercn commented 9 months ago

Placeholder issue so that we can track adding this to the docs.

Compression can expose the application to side-channel attacks against the TLS encryption of the connection like CRIME and BREACH. These types of attacks require that the attacker can force a browser to issue requests to the vulnerable site (via cross-site form posting or by embedding the site inside an iframe of another site) with a payload they control, and that they can observe the length of the compressed and encrypted response over the network.

For the app to be vulnerable, it needs to reflect the payload from the attacker into the response. For example, by writing out the path or the query string into the response. Using the length of the response as an oracle, the attacker can "guess" any information on the response, bypassing the encryption of the connection.

Generally speaking, it should be fine for Blazor apps to turn compression over the WebSocket connection with the appropriate security measures:

In general, it is recommended that you avoid rendering components that contain sensitive information alongside components that can render data from untrusted sources as part of the same render batch.

ghost commented 9 months ago

Thanks for contacting us.

We're moving this issue to the .NET 9 Planning milestone for future evaluation / consideration. We would like to keep this around to collect more feedback, which can help us with prioritizing this work. We will re-evaluate this issue, during our next planning meeting(s). If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues. To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.

danroth27 commented 7 months ago

In general, it is recommended that you avoid rendering components that contain sensitive information alongside components that can render data from untrusted sources as part of the same render batch.

@javiercn Is this security guidance really practical?