corydolphin / flask-cors

Cross Origin Resource Sharing ( CORS ) support for Flask
https://flask-cors.readthedocs.io/en/latest/index.html
MIT License
889 stars 140 forks source link

All private network requests unintentionally allowed #337

Open lmm-git opened 1 year ago

lmm-git commented 1 year ago

With #318 the Access-Control-Allow-Private-Network was introduced to this package, which now sets the header seemingly unconditionally when Access-Control-Allow-Private-Network: true is set in the client request.

This renders the whole private network requests initiative useless as it basically restores the "classic" behavior of allowing all requests as before introducing this feature by Chrome. For more information, please check the standard.

As the Chrome devs have introduced this feature as a security measure, I would consider this a security vulnerability. The newly introduced security measure is getting explicitly deactivated by this package, probably unknown to most users of this package.

My recommendation is to allow users of this package to decide whether the Access-Control-Allow-Private-Network is being set. This might incur breaking changes in some projects, but should be fine for most as it only impacts projects which are called from publicly available web pages hosted in private networks. For example, in some projects we are using this package, we would like to not set the Access-Control-Allow-Private-Network header as we are hosting an internal API with this library, but it does not have to be available to external web pages. As I would propose to be secure by default, this header should not be sent by default.

JoshuaPeddle commented 2 months ago

Good call

https://nvd.nist.gov/vuln/detail/CVE-2024-6221

https://huntr.com/bounties/a42935fc-6f57-4818-bca4-3d528235df4d