CVE-2013-2060: OS Command Injection
Clayton Coleman reports:
Never use the form in ruby when the variables aren't known to be safe values
def self.downloadfromurl(url) maxdltime = (Rails.application.config.downloadedcartridges[:maxdownloadtime] rescue 10) || 10 maxfilesize = (Rails.application.config.downloadedcartridges[:maxcartsize] rescue 20480) || 20480 maxredirs = (Rails.application.config.downloadedcartridges[:maxdownloadredirects] rescue 2) || 2 curl --max-time #{maxdltime} --connect-timeout 2 --location --max-redirs #{maxredirs} --max-filesize #{maxfilesize} -k #{url} end
If 'URL' is not properly validated, then someone could inject " ; rm -rf /"
In this method, URL needs to be a properly formatted URI with a known whitelist of parameters.
In addition, we should only accept URI's that are of the following whitelisted criteria:
Parses URI successfully Protocol is 'http', 'https', 'git', 'ftp' (I can't think of others that are really safe). 'file' should NOT be allowed Host must be specified, and be non localhost (otherwise you allow a local injection attack). We need to be very careful here not to allow probing of the internal network, so we should only allow addresses that resolve outside of the exsrvs. Port should be valid Path should be valid
If the URI does not meet these criteria an error message should be returned to the user.
Other sources
The downloadfromurl function in OpenShift Origin allows remote attackers to execute arbitrary commands via shell metacharacters in the URL of a request to download a cart.
— MITRE
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2013-2060?
The severity of CVE-2013-2060 is classified as medium, as it can lead to potential data exposure.
How do I fix CVE-2013-2060?
To fix CVE-2013-2060, avoid using the ` form in Ruby unless you can ensure that the variables are safe values.
Which software versions are affected by CVE-2013-2060?
CVE-2013-2060 affects Red Hat OpenShift version 1.0.
What type of vulnerability is CVE-2013-2060?
CVE-2013-2060 is a security vulnerability related to unsafe variable handling in Ruby.
Who reported CVE-2013-2060?
CVE-2013-2060 was reported by Clayton Coleman.