Skip to content
Business logic Write-up Beginner

The $0 Purchase Bug: How Perfectly Working Code Cost a Company Thousands

A combination of a discount code, referral credit, seasonal promotion, and wallet balance could make the total price negative, which the system converted to zero, allowing customers to buy products for free. The company shipped the products but received no payment.

su6osec Follow

Published on su6osec.medium.com

One of the biggest mistakes developers make is assuming that if every feature works correctly, the entire system must be secure.

Đeepanshu, on su6osec.medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the checkout logic did not validate that the final price remained non-negative after applying multiple discounts and credits, and it silently clamped negative totals to zero.

Impact

Customers could obtain products for free, causing the company to lose money on shipped orders without any security alert being triggered.

What the attacker needed

A customer account; access to discount and referral features

The fix

The checkout should reject any transaction where the final total is negative, rather than converting it to zero.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

This is a business logic bug: the checkout system allowed several discounts and credits to be stacked, and when the total went below zero, it was treated as zero instead of being rejected. So a customer could get a product for free while the company still shipped it. No hacking tools were needed, just combining normal features in an unexpected way.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by su6osec

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.