Fake IBAN Payment Vulnerability: Risk Control Design for Subscription Billing
This article examines a payment bypass involving a format-valid German IBAN on an overseas AI subscription service. It explains local IBAN mod-97 validation, why German IBANs are structurally attractive to attackers, and how card authorization and SEPA Direct Debit settlement models can be mistakenly mapped to the same entitlement logic. It then outlines practical hardening measures for subscription billing risk controls, including separate order state machines, stronger account verification, tiered limits, chargeback automation, and compliance-aware flexibility.
Recently, a payment vulnerability involving an overseas AI subscription service sparked extensive discussion in the developer community: an attacker only needed to construct a German bank account number (IBAN) with a fully valid format to bypass payment validation and complete a membership top-up. On the surface, this looks like a free-riding incident. From a technical perspective, however, it is an open lesson on payment channel settlement models, account validation algorithms, and the boundaries of compliance risk controls. This article strips away the specific product context, breaks down the vulnerability from a generic technical perspective, and provides best practices for payment risk controls in subscription businesses.
IBAN Validation: A Purely Local Modulo Operation
The first step to understanding the vulnerability is to clarify what the “validity” of an IBAN actually means. Many engineers intuitively assume that validating a bank account number requires an online query to a banking system. The opposite is true: an IBAN is a self-checking string, and its format validity can be determined entirely offline.
IBAN follows a public validation specification. The algorithm works as follows:
- Move the first four characters of the IBAN (two country code characters plus two check digits) to the end of the string.
- Expand letters according to the rule A=10, B=11, …, Z=35 into digits, and concatenate them into a large integer N.
- The validation condition is
N mod 97 = 1.
Conversely, constructing a valid IBAN is equally simple:
def compute_check_digits(iban_with_00: str) -> str:# Move the first four characters to the end and expand letters to digitsrearranged = iban_with_00[4:] + iban_with_00[:4]numeric = ''.join(str(int(c, 36)) if c.isalpha() else c for c in rearranged)check = 98 - (int(numeric) % 97)return iban_with_00[:2] + f"{check:02d}" + iban_with_00[4:]
Two core mathematical operations complete the task in milliseconds. This means any attacker can generate accounts in batches that are “100% valid in format.” However, format validity absolutely does not mean the account really exists, has a balance, or belongs to the person submitting it. The essence of this incident was not any kind of “cracking.” The business side treated “format-valid” as the basis for “payment successful,” and all intermediate steps were completed through business judgment failures.
Why German IBANs: A Stack of Structural Factors
The attacker’s choice of German account numbers was not accidental. It was the “optimal solution” after multiple structural factors combined, and it deserves careful analysis by risk control engineers:
1. Regular structure and fixed length. A German IBAN is 22 characters long, with positions 5 through 12 containing an 8-digit bank code. The bank code list is publicly published by the central bank and can be downloaded by anyone. This means a generator can create numbers where “even the bank code really exists,” easily bypassing lightweight validation built by merchants. In reality, many teams’ so-called IBAN validation is nothing more than mod-97 plus a bank code whitelist.
2. Weak post-event forensics. Due to privacy protection rules, disputed transactions in Germany often do not provide detailed chargeback reason descriptions, and merchants receive very little traceability information. Front-end verifiability is minimal, and back-end traceability is also minimal. Both ends are “convenient.”
3. Anti-discrimination clauses compress risk control space. Rules for the Single Euro Payments Area (SEPA) explicitly state that a payee may not reject a payment because the payer’s IBAN belongs to a certain member state, nor may it require the payer to open an account in a specific country. The original intent of this rule is to open up the European internal market, but the risk control consequence is: once a direct debit channel is enabled, merchants cannot take fine-grained action to “turn off one country and keep others.” Compliance constraints remove the middle ground, leaving only all-on or all-off. This also explains why emergency responses to such incidents often appear extremely crude: the entire channel is taken offline directly, and weekends happen to be the period with the longest approval chain and the thinnest on-call staffing.
Root Cause: Two Settlement Models Sharing One Entitlement Logic
Setting aside all surface phenomena, the technical root cause can be stated in one sentence: credit cards are “authorization is confirmation,” while direct debit is “initiate first, settle later,” and the business side allowed both channels to share the same entitlement issuance logic.
- Card payment (authorization model): When a payment request returns a success status, the funds are essentially already locked by the issuing bank. Subsequent chargeback risk is relatively low and has clear boundaries. Therefore, “issue entitlements upon receiving a success callback” is generally safe.
- SEPA Direct Debit (clearing model): Submitting a debit instruction is only the “initiation.” Actual settlement takes several business days, during which the transaction may be returned because the account does not exist, has insufficient funds, has been closed, or for other reasons. In other words, there is a huge time window between instruction acceptance and funds arrival.
If the system only distinguishes payment methods at the payment gateway but uniformly maps “payment instruction submitted successfully” to “order paid” in the downstream order state machine, then an attacker can submit a format-valid empty instruction and immediately obtain membership entitlements. By the time the return receipt arrives days later, the entitlements have long been consumed.
Hardening Payment Risk Controls for Subscription Businesses
To address the above issues, engineering teams can systematically harden the system at the following levels:
1. Build independent entitlement issuance state machines for different payment channels. For asynchronous clearing channels, entitlements should be tied to “funds actually received” or “clearing completed” events, not to “instruction accepted successfully.” Before final confirmation, the order can be placed in a “pending clearing” state, with entitlements delayed or only a limited trial quota issued.
class OrderStatus(Enum):INITIATED = "initiated" # Instruction acceptedCLEARING = "clearing" # Clearing in progress; do not issue entitlementsSETTLED = "settled" # Funds received; issue entitlementsCHARGED_BACK = "charged_back" # Chargeback; revoke entitlements and handle account
2. Account validation must go beyond format. Mod-97 and bank code whitelists can only serve as the shallowest front-end experience optimization and must never be used as a risk control basis. The backend should combine account verification capabilities provided by payment service providers, such as micro-deposits, account holder name matching, and instant payment confirmation, and treat “the account is real and usable” as an admission condition.
3. Introduce tiered limits based on behavior and reputation. When new accounts use asynchronous clearing channels, policies such as first-order amount caps, delayed entitlement issuance, and cooling-off periods can be applied. These can be gradually relaxed as account transaction reputation accumulates. This “reputation-based tiering” approach is more aligned with commercial interests than uniformly opening or closing channels.
4. Establish an automated chargeback handling loop. Chargeback events must drive entitlement revocation, account flagging, and risk profile updates in real time, and must be connected to monitoring and alerting systems. Circuit breaker thresholds should be set for abnormal chargeback rates concentrated within a short period, and the corresponding payment channel should be automatically downgraded when the threshold is reached.
5. Reserve risk control flexibility within compliance boundaries. In regions constrained by anti-discrimination and similar compliance rules, the boundaries of permitted risk control measures should be confirmed with legal teams in advance, such as generic additional verification steps rather than country-based rejection, to avoid being left with only the “turn everything off” option after an incident. For cloud-based businesses, general cloud capabilities such as logging services, monitoring and alerting, and message queues can also be used to decouple payment event streams, chargeback receipts, and risk decisions, improving observability and response speed across the entire chain.
Conclusion
This incident is a wake-up call for all developers involved in cross-border payment collection: the first lesson in payment security is to understand the settlement timing and fund confirmation semantics behind each payment channel. Format validation being valid does not mean the transaction is real. Instruction acceptance success does not mean funds have arrived. And entitlement issuance logic for different channels must be modeled separately. Only by internalizing these fundamental concepts as first principles of system design can vulnerabilities be kept outside the architecture before the next “smart person” appears.
