Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency carrierwave to v2.2.6 [SECURITY] #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

renovate[bot]
Copy link
Contributor

@renovate renovate bot commented Nov 29, 2023

This PR contains the following updates:

Package Change Age Adoption Passing Confidence
carrierwave 2.2.0 -> 2.2.6 age adoption passing confidence

GitHub Vulnerability Alerts

CVE-2023-49090

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

CVE-2024-29034

Impact

The vulnerability CVE-2023-49090 wasn't fully addressed.

This vulnerability is caused by the fact that when uploading to object storage, including Amazon S3, it is possible to set a Content-Type value that is interpreted by browsers to be different from what's allowed by content_type_allowlist, by providing multiple values separated by commas.

This bypassed value can be used to cause XSS.

Patches

Upgrade to 3.0.7 or 2.2.6.

Workarounds

Use the following monkey patch to let CarrierWave parse the Content-type by using Marcel::MimeType.for.

# For CarrierWave 3.x
CarrierWave::SanitizedFile.class_eval do
  def declared_content_type
    @​declared_content_type ||
      if @​file.respond_to?(:content_type) && @​file.content_type
        Marcel::MimeType.for(declared_type: @​file.content_type.to_s.chomp)
      end
  end
end
# For CarrierWave 2.x
CarrierWave::SanitizedFile.class_eval do
  def existing_content_type
    if @​file.respond_to?(:content_type) && @​file.content_type
      Marcel::MimeType.for(declared_type: @​file.content_type.to_s.chomp)
    end
  end
end

References

OWASP - File Upload Cheat Sheet


Release Notes

carrierwaveuploader/carrierwave (carrierwave)

v2.2.6: 2.2.6

Compare Source

Security

v2.2.5: 2.2.5

Compare Source

Security

v2.2.4: 2.2.4

Compare Source

Fixed

v2.2.3: 2.2.3

Compare Source

Fixed

v2.2.2: 2.2.2

Compare Source

Fixed

v2.2.1: 2.2.1

Compare Source

Changed
Fixed

Configuration

📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate bot added dependencies Pull requests that update a dependency file Ruby SemVer Patch labels Nov 29, 2023
@renovate renovate bot changed the title Update dependency carrierwave to v2.2.5 [SECURITY] Update dependency carrierwave to v2.2.6 [SECURITY] Mar 25, 2024
@renovate renovate bot changed the title Update dependency carrierwave to v2.2.6 [SECURITY] Update dependency carrierwave to v2.2.6 [SECURITY] - autoclosed Jul 13, 2024
@renovate renovate bot closed this Jul 13, 2024
@renovate renovate bot deleted the renovate/rubygems-carrierwave-vulnerability branch July 13, 2024 12:07
@renovate renovate bot changed the title Update dependency carrierwave to v2.2.6 [SECURITY] - autoclosed Update dependency carrierwave to v2.2.6 [SECURITY] Jul 14, 2024
@renovate renovate bot restored the renovate/rubygems-carrierwave-vulnerability branch July 14, 2024 08:04
@renovate renovate bot reopened this Jul 14, 2024
@renovate renovate bot force-pushed the renovate/rubygems-carrierwave-vulnerability branch from 084f793 to c2ae1d4 Compare July 14, 2024 08:05
Copy link
Contributor Author

renovate bot commented Nov 17, 2024

⚠️ Artifact update problem

Renovate failed to update an artifact related to this branch. You probably do not want to merge this PR as-is.

♻ Renovate will retry this branch, including artifacts, only when one of the following happens:

  • any of the package files in this branch needs updating, or
  • the branch becomes conflicted, or
  • you click the rebase/retry checkbox if found above, or
  • you rename this PR's title to start with "rebase!" to trigger it manually

The artifact failure details are included below:

File name: Gemfile.lock
[17:43:21.308] INFO (923): Installing tool ruby@2.6.3...
installing v2 tool ruby v2.6.3
Download failed: https://github.com/containerbase/ruby-prebuild/releases/download/2.6.3/ruby-2.6.3-jammy-x86_64.tar.xz
Download failed, retrying
Download failed: https://github.com/containerbase/ruby-prebuild/releases/download/2.6.3/ruby-2.6.3-jammy-x86_64.tar.xz
Download failed, retrying
Download failed: https://github.com/containerbase/ruby-prebuild/releases/download/2.6.3/ruby-2.6.3-jammy-x86_64.tar.xz
Download failed: https://github.com/containerbase/ruby-prebuild/releases/download/2.6.3/ruby-2.6.3-jammy-x86_64.tar.xz
[17:43:22.945] INFO (992): Downloading file ...
    url: "https://github.com/containerbase/ruby-prebuild/releases/download/2.6.3/ruby-2.6.3-jammy-x86_64.tar.xz"
    output: "/tmp/renovate/cache/containerbase/a2b7bf179a08cb5071f4ea059d3882dbab163ac3364681e8dbb0684386a1c88d/ruby-2.6.3-jammy-x86_64.tar.xz"
[17:43:23.206] ERROR (992): Response code 404 (Not Found)
[17:43:23.206] FATAL (992): Download failed in 262ms.
[17:43:23.279] ERROR (923): Command failed with exit code 1: /usr/local/containerbase/bin/install-tool.sh ruby 2.6.3
[17:43:23.280] FATAL (923): Install tool ruby failed in 1.9s.


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file Ruby SemVer Patch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

0 participants