CVE-2023-49090
JSON

6.8medium

CarrierWave has a content-type allowlist bypass vulnerability, possibly leading to XSS

Severity
6.8medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.76% (higher than 51% of CVEs)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-gxhx-g4fq-49hj

Description

CarrierWave is a solution for file uploads for Rails, Sinatra and other Ruby web frameworks. CarrierWave 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. This issue has been patched in versions 2.2.5 and 3.0.5.

Affected

Product or packageVersionsReported by
carrierwaveuploader carrierwave>= 2.2.0, < 2.2.5, >= 3.0.0, < 3.0.5CVE List
carrierwave (RubyGems)from 3.0.0 before 3.0.5, before 2.2.5GitHub Advisory Database
carrierwave_project carrierwavebefore 2.2.5, from 3.0.0 before 3.0.5NVD

All scores

GitHub_M6.8medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N
GitHub6.8medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N
NVD6.1medium CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N

Classification

CWE-79

SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.

What each source says

CVE List

CarrierWave is a solution for file uploads for Rails, Sinatra and other Ruby web frameworks. CarrierWave 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. This issue has been patched in versions 2.2.5 and 3.0.5.

GitHub Advisory Database
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

Upgrade to 3.0.5 or 2.2.5.

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

OWASP - File Upload Cheat Sheet

NVD (es)

CarrierWave es una solución para carga de archivos para Rails, Sinatra y otros frameworks web Ruby. CarrierWave tiene una vulnerabilidad de omisión de lista permitida de tipo de contenido, que posiblemente conduzca a XSS. La validación en `allowlisted_content_type?` determina los permisos de tipo de contenido realizando una coincidencia parcial. Si al argumento `content_type` de `allowlisted_content_type?` se le pasa un valor creado por el atacante, se permitirán los tipos de contenido no incluidos en `content_type_allowlist`. Este problema se solucionó en las versiones 2.2.5 y 3.0.5.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-49090 changed 2024-10-11CVE Terms of Use
GitHub Advisory DatabaseGHSA-gxhx-g4fq-49hj changed 2023-11-29CC-BY-4.0
NVDCVE-2023-49090 changed 2026-06-17Public domain