Invia #979872: macrozheng mall 1.0.3 Time-of-check Time-of-useinformazioni

Titolomacrozheng mall 1.0.3 Time-of-check Time-of-use
DescrizioneA race condition in macrozheng/mall affects coupon redemption through POST /order/generateOrder in mall-portal. The relevant implementation is present in v1.0.3 and commit 0504e86. Although generateOrder is declared transactional, coupon availability checking and subsequent consumption do not enforce exclusive redemption of a coupon claim. The application queries unused coupon-history records and later updates a selected record by primary key, without requiring use_status=0 in the update predicate or verifying that the request exclusively consumed an unused claim. Concurrent transactions can therefore grant coupon deductions based on the same unused state. In the reported concurrent test, five requests from the same authenticated member using couponId=32 returned successful order-creation responses for distinct order IDs 97–101, each carrying a CNY 1,000.00 coupon deduction. The before-and-after database snapshots show only one displayed coupon-history record changing from unused to used. These observations are consistent with repeated coupon application without corresponding consumption of distinct coupon claims. Remediation should conditionally consume a specific eligible claim using an update that requires use_status=0, verify that exactly one row was updated, and roll back order creation if consumption fails. The claim update and order creation must occur within the same transaction. Alternatively, lock and revalidate the selected claim using SELECT ... FOR UPDATE before granting the deduction, retaining the lock until the transaction completes. Full reproduction evidence is provided in the linked advisory.
Fonte⚠️ https://github.com/macrozheng/mall/issues/1003
Utente
 Anonymous User
Sottomissione15/09/2026 11:59 (28 giorni fa)
Moderazione12/10/2026 16:47 (27 days later)
StatoAccettato
Voce VulDB416949 [macrozheng mall fino a 1.0.3 Coupon Redemption /order/generateOrder couponId race condition]
Punti20

Do you need the next level of professionalism?

Upgrade your account now!