Skip to content

Insecure currencyCode handling allows wrong payment amounts

Moderate
michaelbromley published GHSA-wm63-7627-ch33 Nov 17, 2023

Package

npm @vendure/core (npm)

Affected versions

< 2.1.3

Patched versions

2.1.3

Description

Impact

Original report:

Currently, in a lot of Vendure deployments it's possible to select any currencyCode (really any, doesn't need to be assigned to the channel) and pay through Mollie and Stripe in that particular currencyCode.
The prices are not transformed. The result is the Order is in Payment Settled in the foreign currency.
See SS, CZK is not in the channel.
I've tested with Mollie and Stripe it both works.

Further notes

After looking into this further and with help from the comments below, the root cause of this vulnerability is the ability to specify an arbitrary currencyCode as a query parameter to an API call, and then Vendure will use this and pass it to the rest of the system as RequestContext.currencyCode.

The solution is to add validation to the passed currencyCode to ensure that it matches one of the available availableCurrencyCodes of the active Channel.

Furthermore, an additional check has been added for when the currencyCode changes during the AddingItems stage - in this case we need to re-calculate the prices in the new currency.

Patches

v2.1.3

Workarounds

You can define a custom OrderProcess onTransitionStart function which can verify the order's currencyCode is as expected before allowing the transition to the ArrangingPayment state.

Severity

Moderate

CVSS overall score

This score calculates overall vulnerability severity from 0 to 10 and is based on the Common Vulnerability Scoring System (CVSS).
/ 10

CVSS v3 base metrics

Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
None

CVSS v3 base metrics

Attack vector: More severe the more the remote (logically and physically) an attacker can be in order to exploit the vulnerability.
Attack complexity: More severe for the least complex attacks.
Privileges required: More severe if no privileges are required.
User interaction: More severe when no user interaction is required.
Scope: More severe when a scope change occurs, e.g. one vulnerable component impacts resources in components beyond its security scope.
Confidentiality: More severe when loss of data confidentiality is highest, measuring the level of data access available to an unauthorized user.
Integrity: More severe when loss of data integrity is the highest, measuring the consequence of data modification possible by an unauthorized user.
Availability: More severe when the loss of impacted component availability is highest.
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N

CVE ID

No known CVE

Weaknesses

No CWEs

Credits