Lucene search
K

Ruby Gem Minimagic Command Execution Vulnerability

🗓️ 13 Mar 2013 00:00:00Reported by Larry CashdollarType 
zdt
 zdt
🔗 0day.today👁 19 Views

Ruby Gem Minimagic command execution vulnerability in image processing librar

Code
MiniMagic ruby gem remote code execution 

3/12/2013

https://github.com/hcatlin/mini_magick

A ruby wrapper for ImageMagick or GraphicsMagick command line.

Tested on both Ruby 1.9.2 and Ruby 1.8.7.

If a URL is from an untrusted source, commands can be injected into it for remote code execution with the ; character.

image = MiniMagick::Image.open(remoteurl) image.resize "5x5"
image.format "gif"
image.write "localcopy.gif"

./hcatlin-mini_magick-1.3.1/lib/mini_magick.rb

Lines

172 command = "#{MiniMagick.processor} #{command} {args.join(' ')}".strip 173

174       if ::MiniMagick.use_subexec
175         sub = Subexec.run(command, :timeout => MiniMagick.timeout)
176         exit_status = sub.exitstatus
177         output = sub.output
178       else 
179         output = `{command} 2>&1`
180         exit_status = $?.exitstatus
181       end

The .strip will only remove whitespace from the beginning and end of the command.

Larry W. Cashdollar
@_larry0
http://vapid.dhs.org

#  0day.today [2018-04-12]  #

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation