Skip to content
Business logic Write-up Intermediate

Payment Bypass in Munshi: Forging a PhonePe Webhook to Activate an Unpaid Subscription

Munshi's payment webhook accepted forged PhonePe success notifications without authenticating them or confirming the transaction with the provider. An attacker could therefore activate a paid subscription after a failed or cancelled payment, changing the stored subscription state to active.

TheWildEye Follow

Published on medium.com

Cybersecurity

TheWildEye, 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. 6 min read.

Context

Munshi is a hosted web application by Petpooja that handles subscription billing for tenants. Payments are processed through PhonePe: a tenant starts a purchase, the user goes through the PhonePe payment flow, and the backend is supposed to establish the transaction outcome before granting the subscription entitlement.

The component that decides this is a payment webhook:

HTTP
POST /api/payment/order/webhook

In the intended workflow, PhonePe notifies the backend about the payment result, and the backend uses that notification to decide whether the tenant's subscription should become active. The security of the whole billing model therefore rests on the backend being able to tell an authentic PhonePe notification from anything else that reaches that endpoint.

From the original on medium.com

Setup

The assessment was a security review of Munshi by Petpooja. The researcher used the normal subscription purchase flow, letting payment attempts fail or be cancelled and then observing what the backend did with the resulting transaction.

The report does not describe any special accounts, roles or tooling beyond the application itself and the ability to send requests to the webhook.

Finding it

The normal payment flow behaved as expected. After a payment attempt failed or was cancelled, Munshi displayed the unsuccessful payment status, so the front end was honest about the outcome.

What looked wrong was the separate webhook processing path. The endpoint accepted caller-controlled payment-event data referencing a transaction, and it did not enforce webhook authentication, cryptographic signature verification, source validation, or independent server-side payment confirmation before processing the event. The assessment also documented that the endpoint was exempt from API-key enforcement and tenant authentication.

That combination breaks the trust boundary between the payment provider and the application backend. A transaction reference can associate an event with an order, but it cannot prove that a payment succeeded, and a caller-supplied success value is not evidence that PhonePe issued an authentic confirmation. The backend was accepting an event that claimed a payment had succeeded without establishing that the payment had actually occurred.

Exploitation

Step 1: Fail or cancel a payment and capture the order reference

The researcher first let a payment attempt fail or be cancelled. Munshi correctly showed the unsuccessful status.

Figure 1: Payment Failed After Returning from PhonePe

From the original on medium.com

The transaction reference was exposed through the browser redirect:

Text
https://munshi.petpooja.com/payment-status?orderId=[REDACTED]

The URL carries the order reference that the application workflow uses. Its availability in the URL does not make it authoritative proof of payment; the backend still needs to establish the actual payment state independently. But it gives an attacker an identifier that can tie a forged event to a real order.

Figure 2: Transaction Reference Exposed in the Browser URL

From the original on medium.com

Step 2: Send a forged success notification to the webhook

With the failed or cancelled transaction in hand, the researcher tested the webhook's handling of a forged success notification referencing that transaction:

HTTP
POST /api/payment/order/webhook

The backend accepted the notification and returned a success response.

Figure 3: Forged Webhook Accepted

From the original on medium.com

Step 3: Observe the persistent state change

The impact went beyond the API response. After processing the event, the backend changed the subscription record in MongoDB to the paid or active state. The application then displayed the upgraded plan as active and removed the billing restriction. No successful PhonePe transaction existed for the tested order.

Figure 4: Final Active State on the Pricing Page

From the original on medium.com

The database change is the important part. An HTTP success response alone would not prove a payment bypass. Here the application accepted the event, modified its stored subscription state, and treated the upgraded plan as active.

Root cause

The vulnerability is a failure to authenticate payment notifications and enforce authoritative payment verification before a sensitive state transition. The webhook accepted incoming event data without establishing that the event was authentic, then allowed that data to drive subscription activation without independently confirming the transaction with PhonePe.

In other words, the backend treated a caller-controlled event as equivalent to a verified payment-provider result. This is a failure of server-side payment-state enforcement.

The relevant weakness classifications are:

  • CWE-306: Missing Authentication for Critical Function (Primary)
  • CWE-345: Insufficient Verification of Data Authenticity

The webhook path did not enforce webhook authentication, signature verification, source validation, independent payment confirmation, or API-key and tenant authentication. The report also notes that the codebase contained a payment verification route elsewhere, but the vulnerable webhook path did not use it before changing subscription state. A verification mechanism that the vulnerable path can bypass provides no protection.

The exposed transaction reference is relevant to the attack path but is not the root cause by itself. Hiding the identifier would not fix the vulnerability if the backend continued to accept forged payment events.

Impact

An attacker who can reach the webhook and supply a transaction reference accepted by the workflow may be able to obtain a paid subscription without completing payment. The directly demonstrated impact includes unauthorised subscription activation, potential revenue loss, and inconsistent billing records: the application's subscription record can indicate an active paid plan even when the payment provider has no successful transaction for that order.

Subscription activation is an authorisation decision linked to a financial transaction, so this is a payment bypass rather than simply a webhook bug. The report is careful about scope: duplicate and out-of-order notification risks should be evaluated through separate testing, and the demonstrated bypass does not by itself establish that every possible replay scenario is exploitable.

Fix

The remediation must be enforced at the server-side subscription activation boundary. The report lists the following requirements:

  1. Authenticate incoming notifications using the payment provider's documented cryptographic verification mechanism.
  2. Before granting access, independently confirm the transaction with the provider and verify that it matches the expected order, tenant, merchant, amount, currency, and subscription.
  3. Reject invalid signatures, unsuccessful payment states, and transaction mismatches before any entitlement changes occur. A transaction should not become paid merely because an incoming event contains a success value.
  4. Enforce strict payment-state transitions and idempotency: duplicate notifications must not cause repeated processing, and out-of-order events must not allow a failed or cancelled transaction to become active without valid payment confirmation.
  5. Use network restrictions as additional defence in depth where the payment provider supports them, but not as a replacement for cryptographic verification or authoritative server-side payment checks.
  6. Minimise browser-visible transaction identifiers where practical, without relying on their secrecy for security.

Regression testing should include failed and cancelled transactions, forged success notifications, invalid signatures, mismatched transaction details, duplicate callbacks, and out-of-order events. Every invalid or unsuccessful case must leave the subscription inactive.

The vulnerability reference lists the remediation status as Fixed. The application does not identify a traditional software version or build number; the vulnerable implementation was documented in the report dated 30 June 2026. The CVE ID is listed as to be issued.

Variants to test

  • Webhook without signature verification. Send a success event for a real order with no signature header, or with a random one. A positive result is a 2xx response and the subscription becoming active.
  • Signature verification that is present but not enforced. Send a valid-looking event with a deliberately wrong signature. A positive result is acceptance rather than rejection.
  • Trusting the event body over the provider. Send an event claiming success for an order whose payment actually failed or was cancelled. A positive result is the subscription record moving to paid.
  • Mismatched transaction details. Reuse a successful transaction from one order, tenant, amount or currency against another. A positive result is activation of the wrong subscription.
  • Duplicate callbacks. Replay the same notification several times. A positive result is repeated processing, such as multiple entitlements or billing records.
  • Out-of-order events. Deliver a failure or cancellation after a success, or a success after a failure, and check the final state. A positive result is a failed or cancelled transaction ending up active without valid payment confirmation.
  • Exposed order references. Look for order identifiers in redirect URLs, then test whether the webhook accepts events referencing them. A positive result is a forged event tied to a real order being processed.

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. 15 min read.

What happened, in plain words

Munshi is a web application made by Petpooja. It handles subscription billing for tenants. A tenant is a business that uses the application, and a subscription is a paid plan that gives that business access to features. When a tenant wants a paid plan, they start a purchase, they are sent to PhonePe to pay, and the application is supposed to check whether the payment really succeeded before switching the paid plan on.

The part of the application that makes that decision is called a payment webhook. A webhook is a URL on a server that another service is meant to call automatically when something happens. In this case, PhonePe is meant to call Munshi's webhook and say "this payment succeeded" or "this payment failed". The backend, meaning the server-side code the user never sees, then decides whether to activate the subscription.

The problem was that this webhook believed whatever it was told. It did not check that the message really came from PhonePe. It did not check a cryptographic signature, which is a kind of tamper-proof stamp that proves who sent a message. It did not check where the message came from. It did not ask PhonePe directly whether the payment had actually gone through. So anyone who could send a request to that URL could claim a payment had succeeded, and the application would switch on a paid plan even though no money had been paid.

The researcher, Vyom Nagpal, found this during a security assessment of Munshi. The vulnerability reference gives a report date of 30 June 2026 and lists the remediation status as Fixed.

From the original on medium.com

The pieces you need to know first

Before walking through the attack, here are the basic ideas it relies on, explained from zero.

  • A web application is a program you use through your browser. The pages you see are only the front end. Behind them sits a server, a computer that stores data and makes decisions. When you click something, your browser sends a request to that server and the server sends back a response.
  • An API is the set of URLs a server exposes so that programs, not just people clicking, can talk to it. Think of it as the service counter at a shop: you hand over a specific request at a specific window and get a specific answer back. An API endpoint is one such window, identified by a URL and a method such as POST (send data) or GET (fetch data).
  • A webhook is an API endpoint that is designed to be called by another company's system rather than by a person. It is like a letterbox on your front door that the postman is supposed to use. If you never check who is posting letters, anyone can drop one in.
  • A payment gateway such as PhonePe is the service that actually moves the money. The application hands the user over to the gateway, the user pays there, and the gateway tells the application what happened.
  • A transaction is one payment attempt. It has an identifier, often called an order reference or order ID, so that the application and the gateway can talk about the same attempt.
  • A signature is a value computed with a secret key that only the sender and receiver know. If the message is changed, or if someone without the key writes a message, the signature will not match. Checking it is how a receiver knows a message is genuine. It is like a wax seal on an envelope: easy to check, hard to forge without the stamp.
  • Authentication means proving who you are. Authorisation means deciding what you are allowed to do. Activating a paid plan is an authorisation decision: the application is deciding that this tenant is allowed paid features.
  • A vulnerability class is a family of bugs that share the same underlying mistake. This report names two: CWE-306, missing authentication for a critical function, and CWE-345, insufficient verification of data authenticity. In plain words: the webhook did not check who was calling, and it did not check whether the data was genuine.
  • MongoDB is a database, a program that stores records. The subscription state lives there, which is why a successful attack changes something persistent rather than just producing a message on screen.

The endpoint at the centre of it

The affected endpoint was:

HTTP
POST /api/payment/order/webhook

Line by line:

  • POST is the HTTP method. It means "here is some data, please process it". It is the method used when you submit a form or send an event.
  • /api/payment/order/webhook is the path on the server. It says: this is part of the API, it is about payments, it is about an order, and it is the webhook.

In the intended workflow, PhonePe calls this URL after a payment attempt and tells Munshi the result. The backend then decides whether the tenant's subscription should become active. The security of the whole billing model therefore rests on the backend being able to tell a real PhonePe notification from anything else that reaches that endpoint. If it cannot tell the difference, the billing model is only as strong as the honesty of whoever sends the request.

How the assessment was set up

The assessment was a security review of Munshi by Petpooja. The researcher worked against the hosted application, meaning the live version running on the internet, not a copy on a laptop. He used the normal subscription purchase flow: he started a purchase like any customer would, let payment attempts fail or be cancelled, and then watched what the backend did with the resulting transaction.

The report does not describe any special accounts, roles or tooling beyond the application itself and the ability to send requests to the webhook.

Finding it

The normal payment flow behaved as expected. After a payment attempt failed or was cancelled, Munshi displayed the unsuccessful payment status. The front end, the part you see in the browser, was honest about the outcome. If the payment failed, the page said so.

What looked wrong was the separate webhook processing path. The endpoint accepted payment-event data that the caller controlled, referencing a transaction, and it did not enforce:

  1. webhook authentication, meaning it did not check who was calling;
  2. cryptographic signature verification, meaning it did not check a tamper-proof stamp from PhonePe;
  3. source validation, meaning it did not check where the request came from;
  4. independent server-side payment confirmation, meaning it did not ask PhonePe whether the payment had actually succeeded.

The assessment also documented that the endpoint was exempt from API-key enforcement and tenant authentication. An API key is a secret string a program includes with its requests to prove it is allowed to call the API. Tenant authentication is the check that the request comes from the right tenant. This endpoint skipped both.

That combination breaks the trust boundary between the payment provider and the application backend. A trust boundary is the line between two parties where one is supposed to verify the other before believing it. A transaction reference can associate an event with an order, but it cannot prove that a payment succeeded. A caller-supplied success value is not evidence that PhonePe issued an authentic confirmation. The backend was accepting an event that claimed a payment had succeeded without establishing that the payment had actually occurred.

A useful comparison: a hotel receptionist who hands out room keys to anyone who can name a room number has confused knowing the room number with being entitled to the room. The order reference is the room number. It is useful for talking about the right order, but it is not proof of payment.

Exploitation

Step 1: Fail or cancel a payment and capture the order reference

The researcher first let a payment attempt fail or be cancelled. Munshi correctly showed the unsuccessful status.

Figure 1: Payment Failed After Returning from PhonePe

From the original on medium.com

Why this step? Because the whole point is to show that a subscription can be activated when no successful payment exists. Starting from a failed or cancelled payment makes the result unambiguous: if the plan later becomes active, it cannot be because money was actually paid.

The transaction reference was exposed through the browser redirect:

Text
https://munshi.petpooja.com/payment-status?orderId=[REDACTED]

Line by line:

  • https:// is the protocol, the secure version of the language browsers use to talk to websites.
  • munshi.petpooja.com is the host, the specific server for the Munshi application.
  • /payment-status is the path of the page that shows the result of a payment attempt.
  • ?orderId=[REDACTED] is the query string. Everything after the ? is data passed to the page. orderId is the name of the value and [REDACTED] stands in for the actual order reference, which has been removed here.

The URL carries the order reference that the application workflow uses. Its availability in the URL does not make it authoritative proof of payment. The backend still needs to establish the actual payment state independently. But it gives an attacker an identifier that can tie a forged event to a real order.

Figure 2: Transaction Reference Exposed in the Browser URL

From the original on medium.com

Step 2: Send a forged success notification to the webhook

With the failed or cancelled transaction in hand, the researcher tested the webhook's handling of a forged success notification referencing that transaction:

HTTP
POST /api/payment/order/webhook

This is the same endpoint as before. The difference is what is sent to it: a message claiming the payment succeeded, for an order whose payment actually failed or was cancelled. The researcher is deliberately playing the role of PhonePe.

The backend accepted the notification and returned a success response.

Figure 3: Forged Webhook Accepted

From the original on medium.com

Why does a success response matter? Because it shows the server did not reject the message. Here it answered as if everything were in order. That is the moment the trust boundary is crossed: a message from outside is treated as if it came from the payment provider.

Step 3: Observe the persistent state change

The impact went beyond the API response. After processing the event, the backend changed the subscription record in MongoDB to the paid or active state. The application then displayed the upgraded plan as active and removed the billing restriction. No successful PhonePe transaction existed for the tested order.

Figure 4: Final Active State on the Pricing Page

From the original on medium.com

The database change is the important part. An HTTP success response alone would not prove a payment bypass. A server might answer "ok" to a message and still do nothing with it. Here the application accepted the event, modified its stored subscription state, and treated the upgraded plan as active. The change is persistent, meaning it survives a page reload and lives on the server, not just in the browser tab.

Root cause

The vulnerability is a failure to authenticate payment notifications and enforce authoritative payment verification before a sensitive state transition. In plain words: the webhook accepted incoming event data without establishing that the event was authentic, then allowed that data to drive subscription activation without independently confirming the transaction with PhonePe.

The backend treated a caller-controlled event as equivalent to a verified payment-provider result. This is a failure of server-side payment-state enforcement. The server is the only place that can make this decision safely, because the browser is under the user's control and anything the browser says can be changed.

The relevant weakness classifications are:

  • CWE-306: Missing Authentication for Critical Function (Primary)
  • CWE-345: Insufficient Verification of Data Authenticity

CWE stands for Common Weakness Enumeration, a public catalogue of bug types. CWE-306 says a function that matters, here activating a paid plan, had no check on who was calling it. CWE-345 says the data was not checked for authenticity, meaning the application did not verify that the message really came from the claimed sender.

The webhook path did not enforce webhook authentication, signature verification, source validation, independent payment confirmation, or API-key and tenant authentication. The report also notes that the codebase contained a payment verification route elsewhere, but the vulnerable webhook path did not use it before changing subscription state. A verification mechanism that the vulnerable path can bypass provides no protection. It is like having a lock on the front door but leaving the back door open.

The exposed transaction reference is relevant to the attack path but is not the root cause by itself. Hiding the identifier would not fix the vulnerability if the backend continued to accept forged payment events. The real fix is to stop believing unverified messages, not to make the order number harder to guess.

Impact

An attacker who can reach the webhook and supply a transaction reference accepted by the workflow may be able to obtain a paid subscription without completing payment. The directly demonstrated impact includes unauthorised subscription activation, potential revenue loss, and inconsistent billing records: the application's subscription record can indicate an active paid plan even when the payment provider has no successful transaction for that order.

Subscription activation is an authorisation decision linked to a financial transaction, so this is a payment bypass rather than simply a webhook bug. The report is careful about scope: duplicate and out-of-order notification risks should be evaluated through separate testing, and the demonstrated bypass does not by itself establish that every possible replay scenario is exploitable. A replay is when someone sends the same message again later; out-of-order means messages arriving in a different sequence from the one in which they were sent.

Fix

The remediation must be enforced at the server-side subscription activation boundary, meaning at the exact point where the server decides to switch the plan on. The report lists the following requirements:

  1. Authenticate incoming notifications using the payment provider's documented cryptographic verification mechanism. In practice, check the signature that PhonePe provides, using the method PhonePe documents.
  2. Before granting access, independently confirm the transaction with the provider and verify that it matches the expected order, tenant, merchant, amount, currency, and subscription. Do not take the message's word for it; ask PhonePe.
  3. Reject invalid signatures, unsuccessful payment states, and transaction mismatches before any entitlement changes occur. A transaction should not become paid merely because an incoming event contains a success value.
  4. Enforce strict payment-state transitions and idempotency: duplicate notifications must not cause repeated processing, and out-of-order events must not allow a failed or cancelled transaction to become active without valid payment confirmation. Idempotency means processing the same message twice has the same effect as processing it once.
  5. Use network restrictions as additional defence in depth where the payment provider supports them, but not as a replacement for cryptographic verification or authoritative server-side payment checks. Defence in depth means several independent layers of protection, so that one failure does not sink everything.
  6. Minimise browser-visible transaction identifiers where practical, without relying on their secrecy for security. Fewer identifiers in URLs is good hygiene, but it is not the fix.

Regression testing should include failed and cancelled transactions, forged success notifications, invalid signatures, mismatched transaction details, duplicate callbacks, and out-of-order events. Every invalid or unsuccessful case must leave the subscription inactive. Regression testing means re-running these checks after changes to make sure the bug has not come back.

The vulnerability reference lists the remediation status as Fixed. The application does not identify a traditional software version or build number; the vulnerable implementation was documented in the report dated 30 June 2026. The CVE ID is listed as to be issued. A CVE is a public identifier for a known vulnerability, so that people can refer to the same issue unambiguously.

Variants to test

These are the related checks the report suggests, each with what a positive result looks like. They are useful because a fix for one path can leave a neighbouring path open.

  • Webhook without signature verification. Send a success event for a real order with no signature header, or with a random one. A positive result is a 2xx response and the subscription becoming active. A 2xx response is the family of HTTP status codes that mean success.
  • Signature verification that is present but not enforced. Send a valid-looking event with a deliberately wrong signature. A positive result is acceptance rather than rejection.
  • Trusting the event body over the provider. Send an event claiming success for an order whose payment actually failed or was cancelled. A positive result is the subscription record moving to paid.
  • Mismatched transaction details. Reuse a successful transaction from one order, tenant, amount or currency against another. A positive result is activation of the wrong subscription.
  • Duplicate callbacks. Replay the same notification several times. A positive result is repeated processing, such as multiple entitlements or billing records.
  • Out-of-order events. Deliver a failure or cancellation after a success, or a success after a failure, and check the final state. A positive result is a failed or cancelled transaction ending up active without valid payment confirmation.
  • Exposed order references. Look for order identifiers in redirect URLs, then test whether the webhook accepts events referencing them. A positive result is a forged event tied to a real order being processed.

Glossary

  • API: the set of URLs a server exposes so that programs can send requests and get responses.
  • API endpoint: one specific URL and method on an API, such as POST /api/payment/order/webhook.
  • API key: a secret string a program includes with its requests to prove it is allowed to call the API.
  • Authentication: proving who you are.
  • Authorisation: deciding what you are allowed to do.
  • Backend: the server-side code and data that users do not see directly.
  • CWE: Common Weakness Enumeration, a public catalogue of bug types.
  • CWE-306: Missing Authentication for Critical Function, a bug type where an important function has no check on who is calling it.
  • CWE-345: Insufficient Verification of Data Authenticity, a bug type where data is not checked to confirm it came from the claimed sender.
  • CVE: a public identifier for a known vulnerability.
  • Database: a program that stores records, here MongoDB.
  • Defence in depth: several independent layers of protection so that one failure does not sink everything.
  • Front end: the part of an application you see and interact with in the browser.
  • Host: the specific server a URL points at, such as munshi.petpooja.com.
  • HTTP method: the verb of a request, such as POST (send data) or GET (fetch data).
  • Idempotency: processing the same message twice has the same effect as processing it once.
  • MongoDB: a database program that stores records.
  • Order reference / order ID: the identifier for one payment attempt, used to talk about the same order.
  • Out-of-order events: messages arriving in a different sequence from the one in which they were sent.
  • Path: the part of a URL after the host, such as /payment-status.
  • Payment gateway: the service that actually moves the money, here PhonePe.
  • Payment webhook: an API endpoint that a payment provider calls to report the result of a payment.
  • Persistent: stored on the server so that it survives a page reload.
  • Query string: the data after the ? in a URL, made of name and value pairs.
  • Regression testing: re-running checks after changes to make sure a fixed bug has not come back.
  • Replay: sending the same message again later.
  • Server: the computer that stores data and makes decisions behind a web application.
  • Signature: a value computed with a secret key that proves a message is genuine and unmodified.
  • Source validation: checking where a request came from.
  • Subscription: a paid plan that gives a tenant access to features.
  • Tenant: a business that uses the application.
  • Transaction: one payment attempt.
  • Trust boundary: the line between two parties where one is supposed to verify the other before believing it.
  • 2xx response: the family of HTTP status codes that mean success.
  • Vulnerability class: a family of bugs that share the same underlying mistake.
  • Webhook: a URL on a server that another service is meant to call automatically when something happens.

More by TheWildEye

View all

8 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.