CarrierWave Content-Type allowlist bypass vulnerability, possibly leading to XSS
GHSA-gxhx-g4fq-49hj · CVE-2023-49090
Published · Modified
Description
Impact
CarrierWave::Uploader::ContentTypeAllowlist has a Content-Type allowlist bypass vulnerability, possibly leading to XSS.
The validation in allowlisted_content_type? determines Content-Type permissions by performing a partial match.
If the content_type argument of allowlisted_content_type? is passed a value crafted by the attacker, Content-Types not included in the content_type_allowlist will be allowed.
In addition, by setting the Content-Type configured by the attacker at the time of file delivery, it is possible to cause XSS on the user's browser when the uploaded file is opened.
Patches
Workarounds
When validating with allowlisted_content_type? in CarrierWave::Uploader::ContentTypeAllowlist , forward match(\A) the Content-Type set in content_type_allowlist, preventing unintentional permission of text/html;image/png when you want to allow only image/png in content_type_allowlist.
References
References
- WEB https://github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-gxhx-g4fq-49hj
- ADVISORY https://nvd.nist.gov/vuln/detail/CVE-2023-49090
- WEB https://github.com/carrierwaveuploader/carrierwave/commit/39b282db5c1303899b3d3381ce8a837840f983b5
- WEB https://github.com/carrierwaveuploader/carrierwave/commit/863d425c76eba12c3294227b39018f6b2dccbbf3
- PACKAGE https://github.com/carrierwaveuploader/carrierwave
- WEB https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/uploader/content_type_allowlist.rb
- WEB https://github.com/rubysec/ruby-advisory-db/blob/master/gems/carrierwave/CVE-2023-49090.yml
- WEB https://rubygems.org/gems/carrierwave/versions/2.2.5
- WEB https://rubygems.org/gems/carrierwave/versions/3.0.5
Ready to move
Start Securing
Free, no credit card | First findings in minutes