Skip to content
Business logic Write-up Intermediate

Exploiting Payment Gateways

The write-up describes several payment gateway vulnerabilities, including replaying a wallet top-up request to add money repeatedly, manipulating coupon responses to change order totals, using negative quantities to reduce prices, and abusing encoded price parameters. An attacker could obtain goods or wallet balance without paying the correct amount.

letmeslidein Follow

Published on medium.com

Thank you for showing a lot of support and appreciation for my first write-up. Please check it out if you haven’t yet “https://twitter.com/VasuYadaav/status/1310161326157762562?s=20”.

Vasuyadav, on 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

This write-up collects several ways to tamper with the money side of an e-commerce or payment flow. The first and longest case is a wallet feature: the application let a user top up a stored balance by paying through a payment gateway, and the balance was credited when the gateway called back to the application. The other cases are coupon application, item quantity, encoded prices and a few related parameter tricks. The target of the first case is not named in the report, and the report gives no program, bounty or severity details.

The common thread is that the value the user pays, or the value the application credits, is taken from something the client controls rather than from something the server can verify.

Setup

The researcher was testing an application where they had already found several account takeover vulnerabilities. They used an intercepting proxy to capture and replay requests, and Burp Repeater to resend them. No versions, accounts or roles beyond a normal user wallet are described.

Finding it

Before the wallet, the researcher tried the obvious financial tampering: changing the order price, the amount and the quantity. None of it worked. The wallet top-up was the feature that did respond to tampering.

From the original on medium.com

The screenshot shows the option to add money to the wallet, which is the entry point for the first case.

Exploitation

Step 1: a normal top-up and the callback request

The researcher added 1 Rupee to the wallet, selected a payment method and paid 1 Rupee. While intercepting, they saw a POST request to the callback endpoint.

From the original on medium.com

The image shows the intercepted POST request to the callback endpoint. The report does not reproduce the request body, headers or parameters, so the exact fields that carry the amount are not shown here.

Step 2: replaying the callback

The researcher sent the POST request to Repeater and checked the wallet: it had 1 Rupee, as expected. They then forwarded the same POST request again from Repeater. The response was 200 OK and the application reported that 1 Rupee had been added.

This is the core of the bug: the callback that credits the wallet can be replayed, and each replay credits the balance again without a new payment.

Step 3: changing the amount

The researcher then changed the amount in the request to 10K. It worked. Repeating this left them with 3,000,000+ Rupees in the wallet.

From the original on medium.com

The screenshot shows the wallet balance after the tampering. The report does not show the modified request, so the exact parameter name and value are not available.

Step 4: what was done with the balance

The researcher said they bought an Air Conditioner, then admitted they did not place the order.

From the original on medium.com

They did not place the order. The screenshots were sent to friends as a joke. The report is explicit that the ethical route is to report the issue to the company, and notes that the company later deducted the 3 Million from the wallet.

From the original on medium.com

Root cause

The callback endpoint that credits the wallet does not tie a credit to a single, verified payment. Two things are missing, based on what the report shows: the callback can be replayed, and the amount credited is taken from the request rather than from the payment record. A server-side check that the payment reference exists, has not been used before and matches the credited amount would have stopped both the replay and the amount change. The report does not describe the server-side code, so this is inferred from the behaviour.

Impact

An authenticated user with a wallet can credit their balance without paying, and can choose the amount. In this case the researcher reached 3,000,000+ Rupees. Whether the balance can be spent depends on the application; the researcher chose not to place an order.

Variants to test

Coupon response manipulation

The website allowed coupon codes for discounts. The researcher intercepted the POST request that applies the coupon.

From the original on medium.com

Changing the final amount directly did not work. Instead, the researcher added a cheap item, applied the coupon and copied the entire response. They then removed that item, added an expensive one, applied the coupon and replaced the response with the copied one. The whole order bill changed, and it worked.

From the original on medium.com

The order confirmation email is the proof.

Negative quantity

On an e-commerce application, the researcher changed the quantity from 1 to -1 and forwarded the request.

From the original on medium.com

The order summary total is calculated by multiplying the dealid parameter by the qty parameter, so a negative quantity produced a negative order summary.

From the original on medium.com

The negative total prevented checkout on its own. Adding another item to the cart deducted the -175.00 from that item's price, giving a checkout cost of $264.00 ($439.00 - $175.00 = $264.00).

From the original on medium.com

In effect, free items. The researcher also notes that blocking negative quantities is not enough: setting qty to 0.5 gives half off the total price.

Encoded prices

A company selling domain names used encoding to define the cost of a domain.

From the original on medium.com

The researcher captured the request for a cheaper domain, copied the encoded value of the amount parameter and replaced the more expensive domain's amount value with it.

Other parameter tricks

  1. Changing the price parameter directly. This works only when price validation happens on the client side and not on the server side.
  2. Changing the shipping price to a negative amount, which also deducts from the total order price.
  3. Race condition on coupon codes: if a coupon is not invalidated on use, the same code can be applied multiple times. The report notes turbo intruder can be used for checking race conditions.

Fix

The measures that would address each case are: verify the payment callback server-side against the payment provider's record, reject replays and take the credited amount from that record; validate coupon responses and totals on the server; reject zero or negative quantities and compute totals server-side; and stop relying on encoding to protect prices, validating the amount server-side instead.

Conclusion

Parameter tampering on payment features is worth trying even when the obvious price fields are protected. The wallet callback, the coupon response, the quantity and the encoded amount were all places where the client's value was trusted.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

This is a collection of stories about the same basic mistake, made in different places on shopping and payment websites. The mistake is simple to describe: the website trusts a number that the visitor's own computer sends to it, instead of checking that number against something the website itself knows to be true.

Think of a cloakroom. You hand in your coat and get a ticket with a number on it. If the attendant handed you a blank ticket and a pen, and then accepted whatever number you wrote on it when you came back, you could write "100" and walk out with a hundred coats. A well-run cloakroom writes the number itself and keeps its own copy. Several of the sites in this write-up behaved like the attendant with the pen.

The first and longest case is a wallet feature. A wallet, in this context, is a balance stored on the website: you put money in, and later you spend it on the site. To top it up, you pay through a payment gateway, which is the outside service that actually moves money from your card or bank. When the payment succeeds, the gateway tells the website "this person paid", and the website adds the money to the wallet. That message from the gateway to the website is called a callback.

The researcher found that the callback could simply be sent again and again, and that the amount credited came from the request itself. So they could add money to their wallet without paying for it, and choose how much.

The other cases are variations on the same theme: a discount coupon whose reply from the server could be swapped for a different one, a quantity field that accepted a negative number, and a price that was hidden behind encoding rather than actually protected.

The target of the first case is not named, and no program, bounty or severity details are given.

Some words you will meet constantly

Before the steps, a few ideas that come up again and again.

  • A request is the message your browser sends to a website when you click something or load a page. A response is the message the website sends back. Every interaction on the web is a pair of these.
  • An endpoint is a specific address on a website that does one job, for example the address that applies a coupon or the address that a payment gateway calls when a payment finishes.
  • A parameter is a named value carried inside a request, such as qty=1 or amount=500. The name is the label, the value is what follows the equals sign.
  • An intercepting proxy is a tool that sits between your browser and the website. Instead of the request going straight out, it stops in the tool, where you can read it, change it, and then let it continue. Burp Suite is a well-known one, and Repeater is a part of it that lets you send the same request again as many times as you like, with or without changes.
  • Parameter tampering is the act of changing one of those values before it reaches the server, to see whether the server notices.
  • Client-side means the work happens in your browser, on your computer, where you are in control. Server-side means it happens on the website's own machines, where you are not. A check done only client-side can usually be undone by the person using the browser.

The setup

The researcher was already testing an application and had found several account takeover vulnerabilities there. Account takeover means finding a way to get into someone else's account, which is a serious problem in itself. But the goal here was different: to attack a feature that handles money.

To do that, they used an intercepting proxy to capture requests and Repeater to resend them. Nothing else about the setup is described: no versions, no special accounts, just a normal user with a wallet.

Finding the weak spot

Before the wallet, the researcher tried the obvious things. On a shopping site, the obvious financial attack is to change the price of what you are buying: lower the order price, lower the amount, change the quantity. None of it worked. That is worth noticing, because it tells you the site had at least some protection on the normal checkout path.

The wallet top-up was the feature that did respond to tampering.

From the original on medium.com

The screenshot shows the option to add money to the wallet. This is the door into the first case: a button that lets you put a chosen amount into your balance.

Case 1: the wallet top-up

Step 1: pay normally and watch the traffic

The researcher added 1 Rupee to the wallet, picked a payment method and actually paid 1 Rupee. While the payment was completing, the proxy was watching, and it caught a POST request going to the callback endpoint.

A POST request is the kind the browser uses when it is sending data to the server rather than just asking for a page. The callback endpoint is the address the payment gateway uses to tell the site that a payment has happened.

From the original on medium.com

The image shows that intercepted POST request to the callback endpoint. The request body, headers and parameter names are not reproduced in the report, so we cannot see here exactly which field carries the amount. What matters is that the request exists and can be captured.

Why capture it at all? Because once a request is in your hands, you can send it again. And a message that says "credit this wallet" is a very interesting message to be able to send again.

Step 2: send the same message twice

The researcher sent the POST request to Repeater and looked at the wallet. It had 1 Rupee, exactly as expected. Then they forwarded the very same POST request again from Repeater. The response came back 200 OK, which is the standard code for "the request succeeded", and the application announced that 1 Rupee had been added.

This is the heart of the bug. The callback that credits the wallet can be replayed. Replaying means sending a copy of a message that was already sent once. Each replay credited the balance again, with no new payment behind it.

A useful comparison: a cinema ticket is checked and torn at the door. If the doorman just looked at the ticket and handed it back, you could walk in again and again with the same ticket. Here, the website looked at the payment message and handed it back.

Step 3: change the amount

Having established that the message could be repeated, the researcher changed the amount inside it to 10K. It worked. Repeating this left them with 3,000,000+ Rupees in the wallet.

From the original on medium.com

The screenshot shows the wallet balance after the tampering. The modified request itself is not shown, so the exact parameter name and the exact value used are not available in the report.

Why did this work? Because the amount being credited was read from the request, which the client controls, rather than from the payment record held by the payment gateway. The site was effectively asking the visitor "how much did you pay?" and believing the answer.

Step 4: what was done with the balance

The researcher said they bought an Air Conditioner, then admitted they did not place the order.

From the original on medium.com

They did not place the order. The screenshots were sent to friends as a joke. The report is explicit that the right thing to do with a finding like this is to report it to the company, and it notes that the company later deducted the 3 Million from the wallet.

From the original on medium.com

That last point is worth pausing on. A balance that appears in your account is not yours, and spending it would be taking money that was never paid. Reporting it is the whole point of the exercise.

Why the wallet bug worked

The callback endpoint that credits the wallet does not tie a credit to one single, verified payment. Two things are missing, judging by the behaviour: the callback can be replayed, and the amount credited is taken from the request rather than from the payment record.

A server-side check would have stopped both. The server could look up the payment reference at the payment provider, confirm it exists, confirm it has not been used before, and confirm that the amount matches. Then it would credit that amount, not the one in the request. The report does not describe the server-side code, so this is inferred from what the site did.

What it means in practice

A logged-in user with a wallet can add to their balance without paying, and can choose the amount. In this case the researcher reached 3,000,000+ Rupees. Whether such a balance can actually be spent depends on the application; the researcher chose not to place an order. Beyond deducting the balance, the report does not say how the company responded.

Case 2: swapping the coupon reply

The feature

The website allowed coupon codes for discounts. A coupon code is a short string you type at checkout to get money off. The site sends it to the server, the server checks it and replies with the new total.

From the original on medium.com

The first image shows the coupon feature in use, and the second shows the POST request that applies the coupon as it appeared when intercepted. The report does not reproduce the body of that request, so the field names are not visible here.

What did not work, and what did

Changing the final amount directly did not work. This is the same lesson as the wallet: the server was not taking the total from the client, so editing it changed nothing.

Instead, the researcher did something cleverer, in four moves:

  1. Add a cheap item to the cart.
  2. Apply the coupon and copy the entire response the server sent back.
  3. Remove the cheap item and add an expensive one.
  4. Apply the coupon again, and replace the server's new response with the copied one.

A response, remember, is the message coming back from the server to your browser. If your browser is willing to accept a response that was recorded earlier, for a different cart, then the discounted total from the cheap cart gets carried into the expensive order. The whole order bill changed, and it worked.

From the original on medium.com

The order confirmation email is the proof.

Case 3: a negative quantity

The idea

On an e-commerce application, the researcher changed the quantity from 1 to -1 and forwarded the request to the server.

From the original on medium.com

Quantity is the number of items you are buying. Nobody buys minus one of something, so a site that accepts it has not thought the field through.

Why that produces a negative bill

The order summary total is calculated by multiplying the dealid parameter by the qty parameter. So a negative quantity produced a negative order summary.

From the original on medium.com

In plain terms: price times quantity. If quantity is -1, the line total is minus the price. The order summary then shows a negative amount, as if the shop owed the customer money.

Making it pay

The negative total on its own prevented checkout. The site would not let the order go through while the total was below zero. So the researcher added another item to the cart, and the -175.00 was deducted from that item's price, giving a checkout cost of $264.00 ($439.00 - $175.00 = $264.00).

From the original on medium.com

In effect, free items. The negative line cancelled out part of the price of something real.

The researcher also notes that blocking negative quantities is not enough. Setting qty to 0.5 gives half off the total price, because the multiplication still happens and still produces a smaller number. A shop that only checks for "less than zero" has not fixed the underlying problem, which is that the total is being computed from a number the customer supplies.

Case 4: prices hidden behind encoding

A company selling domain names used encoding to define the cost of a domain. Encoding means turning data into a different format, for example turning readable text into a string of letters and digits that looks meaningless. It is a way of representing information, not a way of protecting it.

From the original on medium.com

The researcher captured the request for a cheaper domain, copied the encoded value of the amount parameter, and replaced the more expensive domain's amount value with it. The researcher replaced the more expensive domain's amount value with the cheaper domain's encoded value.

Why does this work? Because anyone can decode an encoded value, and anyone can copy one value into another request. If the only thing standing between a cheap domain and an expensive one is that the price looks scrambled, there is nothing standing there at all. The comparison is a locked box with the key taped to the lid.

Case 5: other ways the same idea shows up

The report lists a few more places where the client's value gets trusted:

  1. Changing the price parameter directly. This works only when price validation happens on the client side and not on the server side. If the browser is the only thing checking the price, the browser can be told to stop checking.
  2. Changing the shipping price. The researcher once changed the shipping parameter to a negative amount, and it deducted from the total order price, just like the negative quantity did.
  3. Race condition on coupon codes. A race condition is when two actions happen at almost the same moment and the system handles them in a way it would not handle them one after another. If a coupon is not invalidated on use, the same code can be applied multiple times, and the price drops each time. The report notes turbo intruder can be used for checking race conditions.

How to fix it

The measures that would address each case are:

  • Verify the payment callback on the server against the payment provider's record, reject replays, and take the credited amount from that record.
  • Validate coupon responses and totals on the server, so a recorded response cannot be reused for a different cart.
  • Reject zero or negative quantities, and compute totals on the server.
  • Stop relying on encoding to protect prices, and validate the amount on the server instead.

The lesson

Parameter tampering on payment features is worth trying even when the obvious price fields are protected. The wallet callback, the coupon response, the quantity and the encoded amount were all places where the client's value was trusted. The pattern to remember is a question: when the site decides how much money is involved, where did that number come from? If the answer is "from my browser", there is probably something to report.

Glossary

  • Account takeover: a vulnerability that lets an attacker get into another person's account.
  • Amount parameter: a named value in a request that carries a sum of money.
  • Burp Suite: a tool used to intercept, inspect and resend web traffic.
  • Callback: a message a payment provider sends to a website to say a payment has happened.
  • Client-side: work done in the user's browser, on the user's own computer.
  • Coupon code: a short string entered at checkout to get a discount.
  • Encoding: converting data into another format, such as scrambled-looking text; it hides nothing from anyone who knows the format.
  • Endpoint: a specific address on a website that performs one job.
  • Intercepting proxy: a tool placed between browser and website that lets you read and change requests.
  • Parameter: a named value carried in a request, written as name=value.
  • Parameter tampering: changing a parameter's value before it reaches the server to see whether the server notices.
  • Payment gateway: the outside service that moves money from a card or bank account.
  • POST request: a request that sends data to the server rather than just asking for a page.
  • Race condition: a flaw that appears when two actions happen at nearly the same moment.
  • Repeater: the part of Burp Suite that resends a captured request, unchanged or edited.
  • Replay: sending a copy of a request that was already sent once.
  • Request: the message a browser sends to a website.
  • Response: the message a website sends back to a browser.
  • Server-side: work done on the website's own machines, where the user has no control.
  • Status code 200 OK: the standard reply meaning the request succeeded.
  • Turbo intruder: a tool for sending many requests at high speed, used to test race conditions.
  • Wallet: a balance stored on a website that a user tops up and spends there.

More by letmeslidein

View all

2 more disclosed reports, 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.