Course contentsShow
← Security
Lesson 940 of 3,05219. Web Security - Business Logic VulnerabilitiesFree lesson

Testing Pricing and Calculation Logic

Techniques for manipulating prices, quantities, discounts, and mathematical operations to exploit business calculations.

Testing Pricing and Calculation Logic

You'll learn how attackers manipulate prices, quantities, and calculations to exploit business logic in payment flows.

When you shop online, the application performs math: price × quantity, minus discounts, plus tax. Attackers treat these calculations as opportunities. By tampering with request parameters, they can manipulate values the server uses to compute totals—often paying pennies for expensive items.

How Pricing Logic Gets Exploited

Think of a restaurant menu where you tell the waiter your own price. That's what happens when applications trust client-side calculations or allow users to control critical financial parameters.

Common attack vectors include:

Price Manipulation

Changing the price parameter from $100.00 to $1.00 in checkout requests. If the server doesn't validate against authoritative product data, it accepts the attacker's value.

Quantity Tampering

Setting negative quantities (quantity=-1) to create credits, or using decimals (quantity=0.01) if validation checks only for non-zero values.

Discount Abuse

Modifying discount percentages (discount=100 instead of discount=10), stacking non-stackable codes, or applying discounts to ineligible items.

Mathematical Operation Manipulation

Exploiting missing validation on multiplication, division, or subtraction operations—like setting a "tax" field to a negative number to reduce the total.

Testing Approach

Intercept checkout requests and modify every numeric field: prices, quantities, discounts, tax rates. Test edge cases like zero, negative values, decimals, and very large numbers. Check if the server recalculates totals from authoritative sources or blindly trusts the client.

Key Takeaway:
Always validate pricing calculations server-side against authoritative data sources—never trust client-provided prices, quantities, or mathematical results in financial transactions.