CarrierWave::RMagick has a Code Injection vulnerability. Its #manipulate!
method inappropriately evals the content of mutation option(:read
/:write
), allowing attackers to craft a string that can be executed as a Ruby code.
If an application developer supplies untrusted inputs to the option, it will lead to remote code execution(RCE).
(But supplying untrusted input to the option itself is dangerous even in absence of this vulnerability, since is prone to DoS vulnerability - attackers can try to consume massive amounts of memory by resizing to a very large dimension)
class MyUploader < CarrierWave::Uploader::Base
include CarrierWave::RMagick
end
MyUploader.new.manipulate!({ read: { density: "1 }; p 'Hacked'; {" }}) # => shows "Hacked"
Stop supplying untrusted input to #manipulate!
's mutation option.
Code Injection Software Attack
If you have any questions or comments about this advisory: * Open an issue in CarrierWave repo * Email me at mit.shibuya@gmail.com
{ "nvd_published_at": "2021-02-08T20:15:00Z", "github_reviewed_at": "2021-02-08T18:51:46Z", "severity": "HIGH", "github_reviewed": true, "cwe_ids": [ "CWE-74", "CWE-94" ] }