19.09.2017 Views

the-web-application-hackers-handbook

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

418 Chapter 11 n Attacking Application Logic<br />

Example 7: Cheating on Bulk Discounts<br />

The authors encountered this logic flaw in <strong>the</strong> retail <strong>application</strong> of a software<br />

vendor.<br />

The Functionality<br />

The <strong>application</strong> allowed users to order software products and qualify for bulk<br />

discounts if a suitable bundle of items was purchased. For example, users who<br />

purchased an antivirus solution, personal firewall, and antispam software were<br />

entitled to a 25% discount on <strong>the</strong> individual prices.<br />

The Assumption<br />

When a user added an item of software to his shopping basket, <strong>the</strong> <strong>application</strong><br />

used various rules to determine whe<strong>the</strong>r <strong>the</strong> bundle of purchases he had chosen<br />

entitled him to a discount. If so, <strong>the</strong> prices of <strong>the</strong> relevant items within <strong>the</strong> shopping<br />

basket were adjusted in line with <strong>the</strong> discount. The developers assumed<br />

that <strong>the</strong> user would go on to purchase <strong>the</strong> chosen bundle and <strong>the</strong>refore would<br />

be entitled to <strong>the</strong> discount.<br />

The Attack<br />

The developers’ assumption is ra<strong>the</strong>r obviously flawed because it ignores <strong>the</strong><br />

fact that users may remove items from <strong>the</strong>ir shopping baskets after <strong>the</strong>y have<br />

been added. A crafty user could add to his basket large quantities of every<br />

single product on sale from <strong>the</strong> vendor to attract <strong>the</strong> maximum possible bulk<br />

discounts. After <strong>the</strong> discounts were applied to items in his shopping basket, he<br />

could remove items he did not want and still receive <strong>the</strong> discounts applied to<br />

<strong>the</strong> remaining products.<br />

HACK STEPS<br />

1. In any situation where prices or o<strong>the</strong>r sensitive values are adjusted based<br />

on criteria that are determined by user-controllable data or actions, first<br />

understand <strong>the</strong> algorithms that <strong>the</strong> <strong>application</strong> uses and <strong>the</strong> point within<br />

its logic where adjustments are made. Identify whe<strong>the</strong>r <strong>the</strong>se adjustments<br />

are made on a one-time basis or whe<strong>the</strong>r <strong>the</strong>y are revised in response to<br />

fur<strong>the</strong>r actions performed by <strong>the</strong> user.<br />

2. Think imaginatively. Try to find a way of manipulating <strong>the</strong> <strong>application</strong>’s<br />

behavior to cause it to get into a state where <strong>the</strong> adjustments it has<br />

applied do not correspond to <strong>the</strong> original criteria intended by its designers.<br />

In <strong>the</strong> most obvious case, as just described, this may simply involve<br />

removing items from a shopping cart after a discount has been applied!

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!