A06 Insecure Design – Negative Quantity
A fictional cart accepts negative quantities and uses them in its price calculation without enforcing business rules.
What is Insecure Design – Negative Quantity Validation Failure?
Business logic must define valid values and enforce them on the server. A quantity should normally be a positive bounded integer. If negative values are accepted, calculations can produce unintended credits, discounts or negative totals.
About this lab
Designed by the SecurityElites team specially for training.
How AI helps you find it
AI can explain the relevant workflow or HTTP behaviour, suggest test cases and help compare expected and observed responses. Confirm findings manually.
How to fix it
- Validate quantity as a positive integer on the server.
- Set reasonable minimum and maximum quantities per product.
- Recalculate prices and totals on the server using trusted product data.
- Reject negative, fractional, zero or excessively large quantities where invalid.
- Use decimal-safe arithmetic for currency calculations.
- Add boundary-value tests to checkout and cart workflows.
How AI helps you defend against it
AI can help review server-side validation, state transitions and authorization logic, then draft regression tests. A developer must validate the implementation.
Read the full OWASP LLM Top 10 guide · All free labs · AI red team certification