CVE-2023-49090: Carrierwave Cross-Site Scripting Vulnerability
MODERATECVE-2023-49090 is a MODERATE (CVSS 6.8) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Carrierwave libraries in the RubyGems ecosystem. The issue involves carrierwave content-type allowlist bypass vulnerability, possibly leading to xss. Remediation is available by upgrading affected packages to version 3.0.5, 2.2.5.
CVE-2023-49090 at a Glance
Security Impact
CVSS: 6.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N).
How to Fix CVE-2023-49090
To remediate this vulnerability, upgrade all affected Carrierwave dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade carrierwave to 3.0.5
Upgrade carrierwave to 2.2.5
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for carrierwave
How to Check if You Are Affected
To determine whether your application is affected by CVE-2023-49090, inspect your project dependencies for Carrierwave:
inspect dependencies for carrierwave
Analyze the terminal output to locate any version of Carrierwave in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.5), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Carrierwave, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-49090 Affected Carrierwave Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
carrierwave
|
RubyGems |
≥ 3.0.0
< 3.0.5
|
3.0.5
|
|
carrierwave
|
RubyGems |
< 2.2.5
|
2.2.5
|
References
Frequently Asked Questions
What is CVE-2023-49090?
Which Carrierwave versions are affected?
What version fixes CVE-2023-49090?
Is carrierwave affected?
What is the CVSS score of CVE-2023-49090?
What CWE is associated with CVE-2023-49090?
How can I check RubyGems dependencies for CVE-2023-49090?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-gxhx-g4fq-49hj",
"modified" : "2023-11-29T21:33:27Z",
"published" : "2023-11-29T21:33:27Z",
"aliases" : [ "CVE-2023-49090" ],
"summary" : "CarrierWave Content-Type allowlist bypass vulnerability, possibly leading to XSS",
"details" : "### Impact\n[CarrierWave::Uploader::ContentTypeAllowlist](https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/uploader/content_type_allowlist.rb) has a Content-Type allowlist bypass vulnerability, possibly leading to XSS. \n\nThe validation in `allowlisted_content_type?` determines Content-Type permissions by performing a partial match.\nIf 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.\n\nIn 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.\n\n### Patches\nUpgrade to [3.0.5](https://rubygems.org/gems/carrierwave/versions/3.0.5) or [2.2.5](https://rubygems.org/gems/carrierwave/versions/2.2.5).\n\n### Workarounds\nWhen validating with `allowlisted_content_type?` in [CarrierWave::Uploader::ContentTypeAllowlist](https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/uploader/content_type_allowlist.rb) , 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`.\n\n### References\n[OWASP - File Upload Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/File_Upload_Cheat_Sheet.html#content-type-validation)\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:H/I:N/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "RubyGems",
"name" : "carrierwave"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.0.0"
}, {
"fixed" : "3.0.5"
} ]
} ]
}, {
"package" : {
"ecosystem" : "RubyGems",
"name" : "carrierwave"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "2.2.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/carrierwaveuploader/carrierwave/security/advisories/GHSA-gxhx-g4fq-49hj"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-49090"
}, {
"type" : "WEB",
"url" : "https://github.com/carrierwaveuploader/carrierwave/commit/39b282db5c1303899b3d3381ce8a837840f983b5"
}, {
"type" : "WEB",
"url" : "https://github.com/carrierwaveuploader/carrierwave/commit/863d425c76eba12c3294227b39018f6b2dccbbf3"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/carrierwaveuploader/carrierwave"
}, {
"type" : "WEB",
"url" : "https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/uploader/content_type_allowlist.rb"
}, {
"type" : "WEB",
"url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/carrierwave/CVE-2023-49090.yml"
}, {
"type" : "WEB",
"url" : "https://rubygems.org/gems/carrierwave/versions/2.2.5"
}, {
"type" : "WEB",
"url" : "https://rubygems.org/gems/carrierwave/versions/3.0.5"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-11-29T21:33:27Z",
"nvd_published_at" : "2023-11-29T15:15:08Z"
}
}