IBAN Validation Gaps in Cross-Border Direct Debit Payments
This article analyzes why fabricated IBANs can pass validation in cross-border direct debit flows. It separates syntax, checksum, and semantic validation layers, explains the offline ISO 13616 mod-97 mechanism, and shows why a valid checksum does not mean a usable account. It also covers the appeal of the German BBAN structure, compliance constraints on country-level blocking, and the core timing gap between authorization and settlement. The article closes with a defense checklist covering account-level verification, channel isolation, risk-based provisioning, observability, gradual shutdown, idempotency and reconciliation, and cloud-based implementation.
1. The Real Issue: A Semantic Mismatch Between Validation and Settlement
A cross-border subscription service was recently reported to accept a constructed German IBAN during top-up and still grant entitlements. Calling this a “broken algorithm” is a misreading. No encryption or authentication step was bypassed. The attacker submitted a mathematically self-consistent number, and what actually failed was the business logic conflating “format valid” with “account usable.”
To understand the risk, split payment data into three layers:
- Syntax layer: whether the string structure, length, and character set are compliant;
- Validation layer: whether the checksum is self-consistent and the bank code exists in a public directory;
- Semantic layer: whether the account exists, whether direct debit authorization is active, and whether balance and risk status allow the charge.
Most production incidents happen when passing the first or second layer is treated as passing the third.
2. Why the Checksum Passes Instantly
International Bank Account Numbers follow ISO 13616, whose core is a self-checking mechanism evaluated entirely offline. Move the country code and two check digits from the front to the back, expand letters from A=10 to Z=35, concatenate everything into one large integer, and require that integer modulo 97 to equal 1.
Generation is equally simple. Set the check digits to 00, compute the intermediate value, then subtract the remainder modulo 97 from 98:
def iban_checksum(country: str, bban: str) -> str:# Set check digits to 00 and build the intermediate stringraw = country + "00" + bban# Convert letters to numbers and move the first four characters to the endrearranged = raw[4:] + raw[:4]numeric = "".join(str(int(ch, 36)) for ch in rearranged)c = 98 - (int(numeric) % 97)return f"{country}{c:02d}{bban}"def is_valid(iban: str) -> bool:rearranged = iban[4:] + iban[:4]numeric = "".join(str(int(ch, 36)) for ch in rearranged)return int(numeric) % 97 == 1
Any online implementation of this logic can produce a “100% format-valid” number in milliseconds. The conclusion is blunt: check digits can only catch data-entry errors and carry no identity or funding properties. Treating them as a risk signal is a design flaw.
3. Why Attackers Prefer the German Structure
Within the euro-area direct debit system, the German BBAN is a fixed-length 22-character sample with one of the most regular structures. Characters 5 through 12 hold an 8-digit bank code, and that directory is published by the central bank and downloadable by anyone. This has two consequences: generators can produce numbers whose bank codes actually exist, slipping past lightweight merchant checks built from modulo plus whitelist matching; and because the numbers “look more real,” manual review is more likely to approve them.
Another often-overlooked factor is post-incident forensics. Some euro-area jurisdictions, citing privacy rules, provide no additional reason for disputed transactions, and chargeback information is extremely coarse. This means weak verifiability at the front end and weak traceability at the back end, further lowering the attacker’s trial-and-error cost.
4. How Compliance Constraints Narrow the Response Space
Euro-area payment rules include non-discrimination clauses: a payee may not reject an account solely because it is located in a different member state. The clause was meant to unify the internal market, but it creates a side effect for risk control—as long as a business keeps its direct debit channel open, it cannot selectively block one country while keeping the rest.
Emergency actions therefore often come down to fully open or fully closed. If the incident also lands on a weekend, approval chains are longest and on-call staffing is thinnest, making a blunt shutdown the path of least resistance. Compliance flattening the middle ground is the root reason these responses look “excessive.”
5. The Real Technical Root Cause: Timing Gap Between Authorization and Settlement
Credit cards follow an authorize-and-confirm model: a successful authorization essentially locks the funds. Direct debit follows an initiate-first, settle-later model: after the debit instruction is submitted, final clearing takes several business days, during which it can be rejected or withdrawn. If both channels share the same “grant entitlement on successful submission” logic, the risk exposure equals the entire settlement cycle.
An illustrative flawed design:
on_payment_submitted -> grant_entitlement() # Wrong: treats acceptance as receipt
The correct abstraction introduces a state machine and a risk reserve:
AUTHORIZED -> grant a low-limit trialSETTLED -> grant in fullDISPUTED -> freeze and reclaim
Supporting practices include setting entitlement credit limits by settlement cycle, delaying high-value entitlements on high-risk channels, and adding chargeback rate to channel-level circuit-breaker metrics.
6. Defense-in-Depth Checklist
- Semantic verification: integrate account status and authorization validity checks instead of only modulo and directory matching;
- Channel isolation: use separate provisioning policies and separate limits per payment method, and forbid shared decision branches;
- Risk pricing: require a deposit or reduce first-term entitlements for channels with long settlement cycles;
- Observability: build monitoring, alerts, and dashboards for acceptance rate, settlement success rate, chargeback rate, and dispute reason distribution;
- Gradual shutdown: control traffic percentages by country or channel to avoid an all-open or all-closed choice;
- Idempotency and reconciliation: use a unique payment identifier as the idempotency key, reconcile with channels at day end, and automatically reclaim unsettled entitlements;
- Cloud implementation: use a container platform to host risk-control services, a message queue to buffer settlement events, logging and monitoring services for audit and circuit breaking, and object storage for reconciliation files.
7. Conclusion
Forged IBANs work not because the algorithm was broken, but because engineering mistook “syntactically correct” for “financially reliable,” compounded by compliance limits on response granularity. The fix order should be: first separate authorization from settlement semantics, then add account-level verification, and finally use gradual rollout and circuit breaking to turn channels that cannot be handled granularly into controllable variables.
