spree_core is vulnerable to Race Condition (TOCTOU)
54
Medium Risk
The gift card apply service computes the redeemable amount from gift_card.amount_remaining and order.total then creates store credits without holding a lock that covers both the gift card and the order. Under concurrent requests (e.g. the same gift card applied to multiple orders at once), the check and the credit creation can interleave so that the total store credits created exceed the gift card value, allowing overspend. The fix wraps the read and the store credit creation in order.with_lock and acquires gift_card.lock! inside it so the critical section is serialized.
You are affected if you are using a version that falls within the vulnerable range.
spree_core is vulnerable to Race Condition (TOCTOU) in versions 5.0.0 - 5.3.4.
Upgrade the spree_core or spree library to the patch version.
Secure your code, cloud, and runtime environments in one central system. Find and fix vulnerabilities automatically.
No credit card required | Scan results in 32secs.
SOC 2Compliant
ISO 27001Compliant