Why Subscription Top-Ups Get Drained by Fake IBANs: Fixing Payment Validation at the Root
This article breaks down a subscription top-up vulnerability where attackers used format-valid but non-existent IBANs to obtain premium access with zero real payment. It explains why IBANs pass offline checksum validation, why German IBANs are a favorite target, and how mixing card ("authorize = confirm") and EU direct-debit ("initiate first, settle later") semantics in a single benefit-granting flow created the gap. It then lays out four defense lines — payment-method risk policies, return monitoring with automatic downgrading, prepared dispute evidence, and coordinated approval/rate-limiting/blocklists — along with sizing advice for teams of different stages and a 2-minute self-check list.
1. Anatomy of a “Two-Hour Drain”: A Subscription Top-Up Vulnerability
On a weekend evening, an online service launched a promotional campaign: after users submitted their payment details, the system activated paid capabilities on the account within 30 seconds. By Sunday night, when the on-call engineer noticed the anomaly, hundreds of “completed, zero-payment” orders had already appeared. Each order was only worth tens of yuan, but because the benefits were immediately usable, the actual loss was amplified rapidly. The emergency fix looked blunt — taking the entire payment channel offline.
The common thread in these incidents is that the vulnerability itself is not sophisticated, but it landed on an unguarded timing window. To understand it, you first need to separate two things: “Is this IBAN well-formed?” and “Does this account really exist and actually have money?” are two completely different questions.
2. Why “Valid” IBANs Can Be Mass-Generated in Seconds
An IBAN is a self-validating string. Checking its validity requires no network access and no query to the bank — it is essentially a modulo operation:
The rule is to move the first four characters (country code + check digits) to the end, expand letters as A=10, B=11, …, Z=35 into digits, concatenate them into a large integer N, and require:
N mod 97 == 1
To generate one in reverse, first fill the check digits with 00, compute the intermediate value N′, and set the check digits directly as:
c = 98 - (N' mod 97) # pad result to two digits
Two lines of math are enough for an online generator to spit out format-perfect, 100% valid numbers in milliseconds.
Key takeaway: there is no “cracking” step anywhere in this process. The checksum algorithm is public, deterministic, and computable offline. Its purpose is to “detect data-entry errors,” not to “prove an account exists.” Treating it as identity verification is like using an ID number’s check digit to prove the person is actually alive.
Why attackers favor German IBANs
- Fixed length and simplest structure: German IBANs are always 22 characters, with positions 5–12 being an 8-digit bank code, and this lookup table is published by the central bank and downloadable by anyone. A generator can produce numbers “whose bank code is genuinely real,” directly bypassing a portion of merchants’ lightweight self-built checks — many teams’ so-called validation is just “mod 97 + a bank-code whitelist,” and that is where it stops.
- Least reversal information: for privacy reasons, German disputes of this kind provide no additional reason codes. In other words, this is one of the jurisdictions weakest for post-hoc forensics: the lowest front-end verifiability and the lowest back-end traceability — convenient on both ends.
- Legally hard to refuse by country: the EU’s single-payment rules contain explicit anti-IBAN-discrimination provisions — a payee may not require the payer to hold an account in a specific member state. This rule was intended to unify the internal market, but its consequence for risk control is that a company running EU direct-debit channels cannot make the fine-grained decision to “turn off Germany but keep the rest”; it can only choose between fully on and fully off.
This explains why the emergency action could only be “take the entire channel offline”: compliance constraints erased the middle ground, leaving only fully-on or fully-off; and the weekend happened to be the period with the longest approval chain and the thinnest on-call coverage.
3. The Real Root Cause: Three Payment Semantics Squeezed Into One Flow
A one-sentence technical summary: Card payments are “authorize = confirm,” while EU direct debit is “initiate first, settle later,” yet both paths shared the same benefit-granting logic.
- Card payment: after authorization succeeds, the funds are essentially locked, with chargeback being the main subsequent risk;
- Direct debit: the initiation is merely a “blank order”; actual settlement takes 1–5 business days. Non-existent accounts, frozen accounts, insufficient funds, or user-revoked mandates all arrive later as “returns.”
When these two semantics share the same callback branch — as long as the gateway returns succeeded, grant the benefit — the problem is inevitable. Because direct debit’s succeeded only means “the instruction has been accepted,” not “the money has arrived.” Add instant benefit delivery, and attackers get a free window of high-value usage.
Breakdown of the exploit path
- A user submits a well-formatted, real-bank-code account that does not actually exist;
- Business-side validation passes (mod 97 + whitelist, or passed straight through to the gateway);
- The gateway accepts the instruction, and the callback status is marked successful;
- The benefit system completes provisioning within 30 seconds, making them a paying user;
- 1–5 business days later a return arrives, by which time the quota is long exhausted and the account may already be abandoned;
- The merchant can neither reclaim the benefits nor determine the responsible party from the return information.
4. Four Actionable Defense Lines (by priority)
Defense Line 1: Make “payment method” a first-class citizen
This is the highest return-on-investment measure. Risk rules cannot be designed along the single dimension of “amount”; they must be bound to the risk tier of the payment method.
# Example: configure risk policy per payment methodPAYMENT_POLICY = {"card": {"grant_mode": "sync", # grant once authorization succeeds"hold_period": 0,"max_amount": 50000,},"sepa_debit": {"grant_mode": "deferred", # must wait for settlement confirmation"hold_period": timedelta(days=7), # covers the return window"max_amount": 2000,},}
The key point is to change “grant first, validate later” into “validate first, grant later,” and validation must pass serially. Even if this sacrifices some conversion rate, high-risk payment methods should not enjoy the same instant benefits as card payments.
Defense Line 2: Return monitoring + automatic downgrading — don’t make risk control rely on manually digging through the backend
Relying on an on-call engineer to dig through the admin console to spot anomalies is the most common failure mode. The right approach is to let the system discover it itself:
- For each direct debit, build a complete state machine of “initiate — settle — return”;
- When a return event arrives, automatically trigger handling: revoke unused benefits, mark the account as high-risk, and freeze its future payment eligibility;
- Configure aggregate alerts, such as “return rate for a given payment method > 5% in the last hour” or “returns under the same device fingerprint > 3,” pushed directly to the on-call channel.
Note: refunds and revocations must be idempotent, because return notifications may be retried or delivered repeatedly; use the business transaction number as the unique key for deduplication.
Defense Line 3: Prepare evidence packages for disputes and chargebacks in advance
In cross-border disputes, merchants are often at an evidentiary disadvantage. Locking down the following materials in advance can significantly reduce losses:
- Service usage logs (login IPs, device fingerprints, feature-call records);
- Terms-acceptance records (registration time, checked options, version numbers);
- Benefit delivery receipts (activation time, quota-change transaction records).
For high-value orders, tiered quota release is recommended: open only the base quota on day one, and release the remainder after the 7-day return window closes. This way, even if drained, the loss is kept within a controllable range.
Defense Line 4: Approval flow, rate limiting, and blocklists must work together
- Don’t rely only on “someone being at their desk” for emergency approval: predefine downgrade plans (e.g., “if the return rate exceeds the threshold, automatically switch back to card-only”), so the system can protect itself even when unattended;
- Rate limiting: set thresholds for new-account counts per IP/device and for the number of initiations per day;
- Blocklists: write returned accounts into an internal blacklist, and also integrate public “dead account” reference data for front-end interception.
5. Pragmatic Advice for Teams of Different Sizes
- Early-stage projects: just turn off high-risk payment methods and keep only channels that authorize-and-confirm. This is not being conservative — it is spending limited engineering resources on the product itself;
- Growth stage: ship the trio of return-callback handling + automatic revocation + alerting, and pass the “payment method” field all the way through to the benefit system;
- At scale: build a complete risk-control event bus that unifies returns, chargebacks, disputes, and blocklist hits into a single event stream, using a rules engine to orchestrate policy — instead of scattered
if-elsebranches everywhere.
6. Extra Reminders for the Defense Layer
Once a vulnerability is publicly discussed, it often attracts bulk exploitation attempts. Beyond fixing the business logic, it is also advisable to tighten the attack surface: apply rate limiting and human/bot detection to registration and payment-submission endpoints; avoid echoing internal field names, stack traces, or un-masked request parameters in error responses; payment callback endpoints must verify signatures rather than trusting only the status field in the request body; and centralize the collection of relevant logs with anomaly detection configured, so that critical evidence is not scattered across local files on multiple machines.
7. A 2-Minute Self-Check List
- Does your benefit-granting logic distinguish between “card” and “direct debit”?
- In your system, is direct debit’s
succeededtreated as “received” or as “accepted”? - Is there automatic revocation on return callbacks, or is it handled manually?
- Do you have aggregate alerts for return rate and dispute rate?
- Is the emergency downgrade plan written as an automatically executable switch?
- Are high-value orders using tiered quota release?
- Do per-transaction limits and daily totals match the risk tier of the payment method?
8. Core Conclusion
“Format-valid” is never equal to “account real,” and “instruction accepted” is never equal to “funds received.” When a payment method’s settlement cycle is longer than your benefit-delivery cycle, you must pay a risk premium for that window — either cover it with risk-control policy, or simply do not accept it. A truly mature payment system does not just do “stricter validation”; it aligns each payment method’s risk model with its settlement semantics.
