[Security] CRITICAL voucher usage-limit race bypass + email-change account takeover + refund over-payment + partner IDOR
django-oscar — Voucher Usage Limit Race Bypass + Email Change Without Verification + Refund Over-Payment + Partner IDOR
This report documents multiple vulnerabilities in the main branch of django-oscar, verified against the current source.
Finding 1 — [CRITICAL] Voucher usage limit bypass via TOCTOU race
Location: src/oscar/apps/voucher/abstract_models.py:198, 247-254
is_available_to_user() (CHECK, L207: not self.applications.exists()) and record_usage() (USE, L252: self.applications.create(...)) run in separate request cycles with no database locking and no unique constraint on VoucherApplication. Two concurrent checkouts both pass the check and both create application records — a SINGLE_USE voucher is redeemed twice.
Finding 2 — [HIGH] Email change without verification/password confirmation
Location: src/oscar/apps/customer/views.py:225 (ProfileUpdateView)
A logged-in user changes their email (the USERNAME_FIELD) via form.save() immediately — no password confirmation, no verification of the new email. An attacker with momentary session access changes the victim's email to their own, then uses "forgot password" to set a new password → permanent takeover. (ProfileDeleteView correctly requires ConfirmPasswordForm; this one doesn't.)
Finding 3 — [HIGH] Refund over-payment
Location: src/oscar/apps/payment/abstract_models.py:refund()
refund() increments amount_refunded without checking against amount_debited. The amount_available_for_refund property computes the correct limit but is never enforced in refund(). A $100 debited source can be refunded $9999.
Finding 4 — [HIGH] Cross-partner product variant IDOR
Location: src/oscar/apps/dashboard/catalogue/views.py:293
Child product creation fetches the parent via get_object_or_404(Product, pk=parent_pk) using the default manager, bypassing the PartnerProductFilterMixin filter. A partner user injects child variants under another partner's product and mutates its structure to PARENT.
Finding 5 — [HIGH] Partner user link/unlink without authority
Location: src/oscar/apps/dashboard/partners/views.py:206
PartnerUserLinkView links any user to any partner by pk without verifying the requester's authority over that partner, auto-granting dashboard_access. A partner user grants themselves access to any other partner's resources.
Suggested fixes
- Enforce voucher single-use atomically:
SELECT FOR UPDATEon the voucher + unique constraint onVoucherApplication(voucher, or voucher+user) (Finding 1). - Require password confirmation + email verification before changing the email/USERNAME_FIELD (Finding 2).
- Validate
amount_refunded + amount <= amount_debitedinrefund()(Finding 3). - Apply the partner filter when fetching the parent product in child creation (Finding 4).
- Verify the requester's authority over the target partner in link/unlink (Finding 5).
All findings verified against the main branch source.
Source: django-oscar/django-oscar