Bug Bounty — Advanced Manual Penetration Testing Leading to Price Manipulation Vulnerability
The application used a client-side generated token to protect order parameters from tampering, but the token was a simple hash of the request body. An attacker could recompute the token and manipulate the price and exchange rate to buy a higher-value card for fewer points.
Published on medium.com
{{media:0}}
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.
Context
This is a write-up about a price manipulation vulnerability, which the author describes as a type of parameter tampering where an attacker can change the price of a placed order, noting that it is common in eCommerce websites. The target is referred to only as vulnsite.com; the report gives no further detail about the product or the company behind it.
The feature involved is a purchase flow in which a user buys a card using points. In the normal flow, 500 points buy a card of value $100, and the order request carries both the price and the card value, together with a secret_key that acts as an anti parameter tampering token.

Setup
The report does not describe any accounts, roles, tools or versions. The author states only that they traversed the application and analysed every API request, and that the token was generated in the browser by JavaScript, which is why they searched the included JS files for the generating code.

Finding it
After traversing the application and analysing every API request, the author found a request that contained the price of the order. The request is shown in the figure below.

Figure 1: Request Vulnerable to Price Manipulation
For 500 points, the author could buy a card of value $100. Changing any of these values looked like it should be enough to report the vulnerability. When the parameters were tweaked, however, the server responded with Invalid Request.
The author realised that the secret_key parameter was acting as an anti parameter tampering token that had to be cracked first. Because the token is generated in the browser, there had to be JavaScript that generates it, so the author searched all included JS files. After hours of searching, the JS file and the function that generated the token were found.
Figure 2: JS code to generate token
Exploitation
Step 1: Understand how the token is built
From the generating function, the author identified that the token is produced in three steps:
- The request body is converted into a string using the JSON stringify function.
- The string is then converted into a SHA256 hash.
- The hash is encoded via Base64 encoding.
Step 2: Generate a valid token locally
With those three steps reproduced, the author was able to generate their own token, and the server responded correctly to it.
Step 3: Change the card value
With a valid token in hand, the author manipulated the card value, setting 500 points for a $200 card value. The server responded with Response Code: 422 (Unprocessable Entity).
Step 4: Change the exchange rate
The author then found another interesting parameter in the request, current_exchange_rate=1. The original ratio was 500 points to $100 of value. The author changed current_exchange_rate from 1 to 0.5 and the card value from $100 to $200, and the price of the card was successfully manipulated.
Root cause
The order request carries the price and the card value as client-supplied parameters, and the only protection against tampering is a secret_key token. That token is generated entirely on the client side, from the request body itself, using a publicly retrievable JavaScript function: JSON stringify, then SHA256, then Base64. Anyone who reads the JS can recompute a valid token for any body they choose, so the token provides integrity only against someone who does not know the algorithm, not against an attacker.
With a valid token, the server still rejected the first attempt to raise the card value, returning 422 Unprocessable Entity. The successful manipulation came from also changing current_exchange_rate, which the server apparently trusted when deriving the price from the points. The report does not describe the server-side validation logic, so the exact check that the 422 came from, and why the exchange rate bypassed it, is not stated.
Impact
The author demonstrated buying a card of $200 value for 500 points, where the normal ratio is 500 points for $100. In the author's words, the price of the card was successfully manipulated.
Fix
Based on the described behaviour, the token check is only meaningful if the token is generated and verified server-side with a secret the client does not hold, and if the server derives the price and card value from its own data rather than trusting client-supplied values such as current_exchange_rate.
Variants to test
- Look for order or checkout requests that carry price, amount, quantity or value fields, and try changing them. A positive result is an order accepted at the altered value.
- Look for an integrity token in the request (names like
secret_key,hash,signature,checksum) and search the included JS files for the function that builds it. A positive result is a client-side algorithm you can reproduce, after which a modified body with a recomputed token is accepted. - Look for rate or conversion parameters such as
current_exchange_ratealongside the price. A positive result is that changing the rate, rather than the price directly, changes what you pay. - When a modified request returns 422 or another validation error, keep changing other parameters in the same request rather than stopping; the report's successful step came only after the first attempt was rejected.
Conclusion
The author's own takeaways:
- Always tweak with all the parameters in the request.
- If a token is generated on client-side, you can always try to crack it.
- Determination is the key. Never give up too early.
What happened, in plain words
A security researcher found a way to buy a gift card worth $200 for only 500 points, when normally 500 points buy a card worth $100. The site tried to stop this by attaching a secret code (a token) to each order, but the code was generated in the visitor's own browser, so the researcher worked out how it was made and produced a valid code for a modified request. The site still rejected the first attempt, but by also changing a second field called the exchange rate, the order went through. This kind of bug is called price manipulation, a form of parameter tampering: the price is a value sent from the browser, and the browser can be told to send a different one.

The target is referred to only as vulnsite.com. The report gives no further detail about the product or the company behind it.
The feature involved is a purchase flow in which a user buys a card using points. In the normal flow, 500 points buy a card of value $100, and the order request carries both the price and the card value, together with a secret_key that acts as an anti parameter tampering token.

Setup
The report does not describe any accounts, roles, tools or versions. The author states only that they traversed the application and analysed every API request, and that the token was generated in the browser by JavaScript, which is why they searched the included JS files for the generating code.
Finding it
After traversing the application and analysing every API request, the author found a request that contained the price of the order. The request is shown in the figure below.

Figure 1: Request Vulnerable to Price Manipulation
For 500 points, the author could buy a card of value $100. Changing any of these values looked like it should be enough to report the vulnerability. When the parameters were tweaked, however, the server responded with Invalid Request.
The author realised that the secret_key parameter was acting as an anti parameter tampering token that had to be cracked first. Because the token is generated in the browser, there had to be JavaScript that generates it, so the author searched all included JS files. After hours of searching, the JS file and the function that generated the token were found.
Figure 2: JS code to generate token
Exploitation
Step 1: Understand how the token is built
From the generating function, the author identified that the token is produced in three steps:
- The request body is converted into a string using the JSON stringify function.
- The string is then converted into a SHA256 hash.
- The hash is encoded via Base64 encoding.
Step 2: Generate a valid token locally
With those three steps reproduced, the author was able to generate their own token, and the server responded correctly to it.
Step 3: Change the card value
With a valid token in hand, the author manipulated the card value, setting 500 points for a $200 card value. The server responded with Response Code: 422 (Unprocessable Entity).
Step 4: Change the exchange rate
The author then found another interesting parameter in the request, current_exchange_rate=1. The original ratio was 500 points to $100 of value. The author changed current_exchange_rate from 1 to 0.5 and the card value from $100 to $200, and the price of the card was successfully manipulated.
Root cause
The order request carries the price and the card value as client-supplied parameters, and the only protection against tampering is a secret_key token. That token is generated entirely on the client side, from the request body itself, using a publicly retrievable JavaScript function: JSON stringify, then SHA256, then Base64. Anyone who reads the JS can recompute a valid token for any body they choose, so the token provides integrity only against someone who does not know the algorithm, not against an attacker.
With a valid token, the server still rejected the first attempt to raise the card value, returning 422 Unprocessable Entity. The successful manipulation came from also changing current_exchange_rate, which the server apparently trusted when deriving the price from the points. The report does not describe the server-side validation logic, so the exact check that the 422 came from, and why the exchange rate bypassed it, is not stated.
Impact
The author demonstrated buying a card of $200 value for 500 points, where the normal ratio is 500 points for $100. In the author's words, the price of the card was successfully manipulated.
Fix
Based on the described behaviour, the token check is only meaningful if the token is generated and verified server-side with a secret the client does not hold, and if the server derives the price and card value from its own data rather than trusting client-supplied values such as current_exchange_rate.
Variants to test
- Look for order or checkout requests that carry price, amount, quantity or value fields, and try changing them. A positive result is an order accepted at the altered value.
- Look for an integrity token in the request (names like
secret_key,hash,signature,checksum) and search the included JS files for the function that builds it. A positive result is a client-side algorithm you can reproduce, after which a modified body with a recomputed token is accepted. - Look for rate or conversion parameters such as
current_exchange_ratealongside the price. A positive result is that changing the rate, rather than the price directly, changes what you pay. - When a modified request returns 422 or another validation error, keep changing other parameters in the same request rather than stopping; the report's successful step came only after the first attempt was rejected.
Conclusion
The author's own takeaways:
- Always tweak with all the parameters in the request.
- If a token is generated on client-side, you can always try to crack it.
- Determination is the key. Never give up too early.
Glossary
- API: the set of addresses and rules a website's pages use to talk to its server in the background, like a service counter where each request asks for one specific thing.
- Parameter: one named value inside a request, such as a price or a quantity; think of it as one field on a paper order form.
- Parameter tampering: changing those values before the request reaches the server, hoping the server believes the changed version.
- Price manipulation: a parameter tampering attack where the attacker changes what an order costs.
- eCommerce: selling goods or services online.
- Token: a short piece of text attached to a request to prove it is genuine, like a wax seal on a letter.
- Anti parameter tampering token: a token whose purpose is to reveal whether any parameter was changed after the token was made.
secret_key: the name of the token parameter in this application's order request.- Client-side: happening in the visitor's own browser, on their computer, rather than on the server.
- Server-side: happening on the company's computer that stores data and makes decisions.
- JavaScript (JS): the programming language browsers run to make pages interactive; the code is downloaded to the browser, so anyone can read it.
- JS file: a separate file of JavaScript that a page loads.
- JSON: a text format for structured data, using curly braces and quoted names, easy for programs to read.
- JSON stringify: a function that turns a data object into a JSON text string.
- Hash: a fingerprint computed from data; the same data always gives the same fingerprint, and the fingerprint cannot practically be turned back into the data.
- SHA256: a common hash function that produces a 256-bit fingerprint.
- Base64: a way of writing arbitrary bytes using only ordinary letters, digits and a few symbols, so they can travel safely in text.
- Request body: the part of a request that carries the data being sent, as opposed to the address it is sent to.
- Exchange rate: a number used to convert one unit into another, here points into dollars.
current_exchange_rate: the name of the exchange rate parameter in this application's order request.- HTTP response code: a three-digit number a server sends back to say how the request went, such as 200 for success or 422 for a rejected request.
- 422 (Unprocessable Entity): the server understood the request but refused to process the values in it.
Invalid Request: the error message the server returned when the parameters were changed without a valid token.- Integrity: the property that data has not been altered; a token can be used to check it.
- Root cause: the underlying design or coding mistake that makes the vulnerability possible.
- Impact: what an attacker can actually achieve by exploiting the bug.
- Fix: the change that removes the vulnerability.
- Validation: checks a server performs on incoming data before acting on it.