IBAN Checksum Validation: The Security Limits of Offline Payment Checks

    IBAN checksums can be verified entirely offline, but a valid checksum does not establish that an account exists, belongs to the user, or can fund a payment. This article explains the Mod-97-10 algorithm, examines how confusing format validation with account verification can expose regional pricing controls, and outlines a layered approach to payment validation.

    1. Background: When Format Validation Becomes a Payment Vulnerability

    A reported security incident involving a subscription platform illustrates a common payment-validation mistake. Attackers submitted fabricated European bank account numbers with valid IBAN checksums, bypassing regional eligibility checks and obtaining premium subscriptions at unusually low prices.

    The underlying technical issue is straightforward: an IBAN checksum can be validated entirely offline, without contacting a bank or querying a payment network.

    That property makes IBAN validation efficient, but it also creates a potential trust boundary error. Some systems treat “passes format validation” as equivalent to “valid payment account.” The two are not interchangeable.

    To understand the gap, we first need to examine the IBAN structure and its checksum algorithm, then consider where offline validation belongs in a payment security architecture.

    2. IBAN Structure and Checksum Validation

    2.1 What an IBAN Contains

    An International Bank Account Number, or IBAN, is a standardized representation of a bank account defined by ISO 13616.

    A German IBAN has the following structure:

    1. DE + 2 check digits + 8-digit bank identifier + 10-digit account number
    2. DE89 3704 0044 0532 0130 00

    IBAN length varies by country. German IBANs contain exactly 22 characters, excluding display spaces. The first four characters follow a common structure across countries:

    • A two-letter country code
    • Two check digits

    The remaining characters form the Basic Bank Account Number, or BBAN, whose structure depends on the country.

    2.2 Calculating the Check Digits: Mod-97-10

    IBAN uses the Mod-97-10 checksum method from ISO 7064. The central rule is that a rearranged, numerically expanded IBAN must have a remainder of 1 when divided by 97.

    To generate the check digits:

    1. Take the BBAN, excluding the country code and check digits.
    2. Convert the country code into numbers using A=10, B=11, …, Z=35.
    3. Concatenate the BBAN, the numeric country code, and 00, converting any letters in the BBAN to numbers as well.
    4. Calculate the resulting number modulo 97.
    5. Subtract the remainder from 98 and express the result as two digits.

    Validation reverses this process:

    1. Move the first four characters—the country code and check digits—to the end.
    2. Convert all letters to their numeric equivalents.
    3. Calculate the resulting number modulo 97.

    A remainder of 1 means the checksum passes. Country-specific length, character-set, and structural checks are still needed for complete format validation.

    2.3 Reference Implementation

    The numerically expanded IBAN can exceed fixed-width integer limits. Python supports arbitrary-precision integers, but incremental modulo calculation is still a useful implementation pattern, particularly when porting code to other languages.

    1. def iban_checksum(country_code: str, bban: str) -> str:
    2. """Calculate IBAN check digits."""
    3. def char_to_num(s: str) -> str:
    4. return ''.join(
    5. str(ord(c) - ord('A') + 10) if c.isalpha() else c
    6. for c in s
    7. )
    8. rearranged = bban + char_to_num(country_code) + "00"
    9. remainder = 0
    10. for ch in rearranged: # Calculate modulo incrementally
    11. remainder = (remainder * 10 + int(ch)) % 97
    12. return f"{98 - remainder:02d}"
    13. def iban_valid(iban: str) -> bool:
    14. """Check the IBAN checksum offline, without network requests."""
    15. iban = iban.replace(" ", "").upper()
    16. if len(iban) < 15 or not iban[:2].isalpha():
    17. return False
    18. rearranged = iban[4:] + iban[:4]
    19. num_str = ''.join(
    20. str(ord(c) - ord('A') + 10) if c.isalpha() else c
    21. for c in rearranged
    22. )
    23. remainder = 0
    24. for ch in num_str:
    25. remainder = (remainder * 10 + int(ch)) % 97
    26. return remainder == 1

    This simplified example illustrates the offline checksum mechanism rather than a production-ready IBAN validator. The generator assumes an uppercase country code and a numeric BBAN, as in the German example. The validation function does not enforce every country-specific length or character rule and can raise an exception for malformed input.

    The important security property is unchanged: the calculation requires no network calls or external confirmation. That is what makes the checksum self-contained—and why passing it provides no evidence from a bank.

    3. Why the Vulnerability Works: Format Is Not Account Validity

    3.1 Reconstructing the Trust Failure

    Based on the reported scenario, the failure can be summarized as follows:

    1. The platform used eligibility for a European payment method, such as a SEPA-based method, as a condition for regional pricing.
    2. When a user submitted bank account details, the system performed only offline format and checksum validation.
    3. An attacker supplied a checksum-valid German IBAN without establishing that the account existed, belonged to them, or could fund the payment.
    4. The platform treated the submitted IBAN as sufficient evidence of regional eligibility and unlocked the discounted price.

    The key distinction is that a valid Mod-97 checksum establishes mathematical consistency, not account existence, ownership, or payment capability.

    It does not even guarantee that the string contains no typing errors: checksums detect many errors, but a passing result is not proof that the data matches the intended account.

    3.2 The Intended Purpose of a Checksum

    IBAN check digits are designed to detect transcription errors and reduce payment failures caused by incorrectly entered account details.

    They are a data-quality mechanism, not an identity credential or an authorization mechanism.

    The same distinction applies to other familiar checks:

    • The Luhn algorithm used with payment card numbers
    • Check digits in identification numbers
    • Email address syntax validation

    Each can verify aspects of a value’s structure or internal consistency. None, by itself, establishes that the value is genuine, active, or controlled by the person submitting it.

    The security problem arises when an application promotes a low-trust consistency check into evidence for a higher-trust business decision.

    4. Payment Risk-Control Principles

    4.1 Use a Layered Validation Model

    A payment validation system should distinguish at least three layers:

    Layer What is checked Typical approach What the result establishes
    L1: Format Character set, length, structure, and check digits Offline validation, including Mod-97 The value satisfies the implemented format and checksum rules
    L2: Existence Whether routing details or an account are recognized Bank directory lookups or supported bank and payment-network checks Recognition of routing details or account existence, depending on the check
    L3: Ownership or control Whether the submitting user owns or controls the account Microdeposit confirmation or bank-side account-holder verification Evidence of account control or ownership, depending on the method

    The scope of each check matters. A bank directory lookup may confirm a bank identifier without confirming an individual account. Similarly, microdeposit confirmation demonstrates access to account information, but should not automatically be treated as proof of legal ownership.

    In the reported scenario, the system effectively treated an L1 result as higher-trust evidence.

    For financially meaningful eligibility decisions, format validation alone is insufficient. Account existence checks provide a stronger starting point, and ownership or control verification adds further assurance. However, even verified ownership of a European account does not, by itself, prove residency or entitlement to regional pricing.

    4.2 Practical Safeguards

    • Separate eligibility from format validation. Discounts, pricing tiers, and other financial benefits should not depend solely on user-supplied fields that can be constructed locally.
    • Verify account ownership or control where appropriate. For bank-account-based payment methods, mechanisms such as microdeposit confirmation can provide evidence beyond a checksum.
    • Cross-check independent risk signals. Device characteristics, IP geolocation, and historical behavior can help identify submissions that are structurally valid but inconsistent with their surrounding context.
    • Make authoritative decisions on the server. Pricing and eligibility rules should be evaluated server-side using trusted evidence. Client-submitted information should be treated as an input, not a conclusion.
    • Audit and monitor submission patterns. Flag unusual activity, such as many unrelated users repeatedly submitting the same account details or closely related account characteristics.

    These controls address different parts of the trust chain. None changes what the checksum itself can prove.

    5. The Broader Engineering Lesson

    The significance of this scenario extends beyond IBANs and payment systems. It illustrates a recurring engineering mistake: confusing verifiability with trustworthiness.

    Offline checks are valuable because they are fast, inexpensive, and independent of external services. Their usefulness depends on preserving their semantic limits.

    For every validation rule, engineers should explicitly document:

    • What does a successful result establish?
    • What does it leave unverified?
    • Is that evidence strong enough for the business decision that follows?

    A vulnerability emerges when a check is given more authority than its result can justify.

    Payment security is not a single checksum problem. It requires a trust chain that distinguishes format, existence, ownership or control, and the evidence needed for the specific business decision. Understanding those boundaries allows teams to retain the efficiency of offline validation without mistaking it for payment assurance.