Skip to content
Info disclosure Write-up Beginner

How an Unsecured API Endpoint Exposed 5,200+ Global Bank Records

An unauthenticated API endpoint returned full licensed BIN records, including bank name, country and card type, for any six-digit BIN supplied. An attacker could enumerate the global card space to build a dataset useful for card-testing and targeted phishing.

medium.com

Published on medium.com

Hacking

CypherNova1337, 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

During a security engagement for a large hospitality company, the researcher was reviewing the mobile app the way an attacker would: its traffic, its API calls and its trust boundaries. When the app's checkout screen prompted for card details, the client quietly called the backend payment API to look up the card's BIN.

A BIN (Bank Identification Number) is the first six digits of every payment card. The digits themselves are not secret, they are printed on the card. What they mean is licensed data: which network issued the card, which bank holds the account, the country of issue, and whether the card is credit, debit or prepaid. Payment processors pay for BIN databases to route payments correctly. Fraud tooling pays for the same databases because knowing the bank behind a card helps guess how it was issued and how its owner can be tricked.

The feature under review is a small convenience: the checkout UI wants to paint a card brand logo next to the input field as the user types. That only needs the brand.

Setup

The work was done as part of an authorised assessment for the client, with scope and authorisation strictly observed: enumeration stayed within defined testing limits and the underlying data was proprietary to the client. The tooling was a small asynchronous enumerator written in Python using aiohttp, running twelve concurrent connections and firing one request per BIN across the target blocks. No accounts, roles or specific versions are described in the report.

Finding it

Watching the app's traffic, the researcher saw the checkout screen reach out to the backend payment API with a request like this:

HTTP
GET https://pay-api.example.com/v1/cardbins/432143

The client expected the kind of lightweight response that lets the UI paint a little Visa logo next to the input field. What came back was the entire licensed BIN record:

JSON
{  "bin": "432143",  "brand": "VISA",  "bank": "Citizens Bank",  "country": "CANADA",  "type": "DEBIT",  "icon_url": "…"}

The app only needed brand. The API handed over the bank name, the country and the card type to anyone who asked. There was no API key, no session token and no rate limit.

From the original on medium.com

The image sits at the top of the write-up, under the title, and is not described further in the text.

Exploitation

A single BIN lookup is a curiosity. A full map of the global card space is an asset, so the question became how far the door opens. The endpoint accepts any six-digit string, and card networks allocate BINs across well-documented ranges:

  • Visa: 400000–401000, 414700–415000
  • Mastercard: 510000–510500, 520000–520500, 530000–530500, 540000–540500, 220000–220300
  • American Express: 370000–370500, 340000–340300
  • Discover: 601100–601500, 650000–650200
  • RuPay: 652100–652300
  • JCB: 352800–353000

Step 1: Confirm the unauthenticated lookup

Send a single six-digit BIN to the endpoint with no credentials of any kind. The important parts are the path segment /v1/cardbins/ followed by the six digits, and the absence of any Authorization header, cookie or API key. The response is the full record shown above: bin, brand, bank, country, type and icon_url. The client only consumes brand.

Step 2: Enumerate the documented ranges

Run the asynchronous enumerator across the ranges above, twelve connections at a time, one request per BIN. That came out to 5,400 queries. The result was 5,256 valid BINs, a 97% hit rate, each populated with the issuing bank, brand, country and card type. The server never choked, slowed down, throttled or threw an error.

Step 3: Assess the resulting dataset

An unattended script running for one afternoon yielded an operational dataset, for example:

  • 432143 · Visa · Citizens Bank · Canada · Debit
  • 378282 · Amex · American Express · US · Credit

In total: nine payment networks, 2,902 credit and 1,698 debit entries, with banks catalogued worldwide. That is the exact dataset that card-testing tooling and phishing infrastructure rely on.

Step 4: Stop at the agreed limit

Enumeration stayed within the defined testing limits. The test was run once, the exposure vector was documented, and the enumeration script and proof-of-concept dataset were delivered directly to the remediation team. An attacker would instead harvest the entire global space and monetise the derived table.

Root cause

The backend resolved the BIN and returned the whole licensed record, while the client only needed the brand. The lookup route had no API key, no session token and no rate limit, and it returned the whole licensed record. The report does not describe the server-side code, so the exact implementation mistake is not stated.

Impact

Nobody steals individual card numbers with this; that is not the threat vector. The risk is what a complete BIN database amplifies:

  • Card-testing efficiency: fraud rings use granular BIN tables to prioritise which stolen numbers to test first, avoiding banks with aggressive foreign transaction blocks.
  • High-conviction phishing: phishing kits use issuing bank metadata to make lures more convincing. A message such as "Your Citizens Bank card ending in 1432 has been locked" lands with far more authority than a generic warning.
  • Domain spoofing synergy: paired with an unauthenticated email vector (in this case the target domain lacked SPF, DMARC and DKIM enforcement), these ingredients assemble into a turnkey, highly targeted phishing pipeline derived entirely from public company infrastructure.

These outcomes depend on the attacker combining the BIN data with other material, such as stolen card numbers or a spoofable mail domain; the BIN exposure alone does not yield card numbers.

Fix

The client interface only needed the card brand icon, and only after the user entered the opening digits. The report describes what the fix looks like:

  • Server-side resolution: resolve the BIN strictly on the backend at transaction submission time, protected by the same session authentication and rate limiting enforced on checkout routes.
  • Client-side IIN tables: if the UI needs dynamic brand logos as the user types, bundle a static, offline IIN prefix lookup locally in the mobile app binary, so no external network request is required just to switch an icon.

The report does not say which of these the client implemented.

Variants to test

  1. Other card-metadata endpoints in the same app. Look for any route the checkout flow calls before submission, such as brand or issuer lookups. A positive result is a response containing fields the UI never renders, such as bank name, country or card type.
  2. Field-level over-return on authenticated routes. Compare what the client uses with what the response contains. A positive result is licensed or internal fields present in a response that only needs a display value.
  3. Missing rate limits on enumeration-friendly identifiers. Try a short burst of sequential six-digit values with twelve concurrent connections. A positive result is a steady stream of full records with no throttling, slowdown or error.
  4. The same pattern on other short numeric identifiers. Any endpoint keyed by a small, guessable number (prefixes, routing codes, sort codes) is worth the same treatment. A positive result is a high hit rate across a documented range with rich metadata in each response.
  5. Mail authentication posture of the same domain. Check SPF, DMARC and DKIM enforcement. A positive result is a domain that can be spoofed, which is what turns BIN metadata into a convincing phishing lure.

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

What happened, in plain words

A security researcher was hired to test a large hospitality company's mobile app. While watching what the app did when someone typed card details into the checkout screen, the researcher found that the app asked the company's payment server a question, and the server answered with far more information than the app needed. Anyone on the internet could ask the same question, as many times as they liked, without logging in. By asking it thousands of times, the researcher built a map of which banks issue which cards around the world. This article walks through that story from the beginning, assuming you have never done security work before.

From the original on medium.com

The image sits at the top of the write-up, under the title, and the text does not describe it further.

Some background before the story

What an API is

An API (Application Programming Interface) is the way one piece of software asks another piece of software for something. A useful comparison is a restaurant. You do not walk into the kitchen and cook; you tell the waiter what you want, and the waiter brings it back. The app is the customer, the API is the waiter, and the server in the kitchen prepares the answer.

When you use a mobile app, the app is constantly talking to servers behind the scenes. The screen you see is only the front. Every logo, price or status message usually arrived over the network from somewhere else.

What a request and a response are

A request is the message the app sends: "give me this". A response is the message the server sends back. Both are just text travelling over the internet, formatted in a way both sides understand.

What a BIN is

Every payment card in the world starts with six digits called the BIN, the Bank Identification Number. These digits are not secret. They are printed on the card itself, right at the start of the long card number.

What those six digits mean is a different matter. They tell you which card network issued the card (Visa, Mastercard and so on), which bank actually holds the account, which country the card is from, and whether it is a credit, debit or prepaid card. That meaning is licensed data: companies pay for databases that map BINs to banks.

Payment processors pay for BIN databases because knowing the bank behind a card lets them route payments correctly. Fraud tooling pays for the same databases for a darker reason: knowing the bank behind a card helps guess how the card was issued and how its owner can be tricked.

What the feature under review does

When you type card details into a checkout screen, many apps show a small card brand logo next to the input field, so you can see at a glance that the app recognised your Visa or Mastercard. To do that, the app only needs to know the brand. That is the whole purpose of the feature: paint a little logo.

What authentication and rate limiting are

Authentication means proving who you are before the server gives you something. A session token or cookie is a small piece of text your browser or app stores after you log in, and sends with each request so the server recognises you. An API key is a similar secret, but meant for software rather than people.

Rate limiting means the server refuses to answer too many requests in a short time. It is like a shop that serves one customer at a time instead of letting a crowd rush the counter.

The setup

The work was done as part of an authorised assessment for the client. Scope and authorisation were strictly observed: the researcher stayed within defined testing limits, and the underlying data belonged to the client. This matters. Testing someone's systems without permission is not security research; it is a crime in most countries.

The tool was a small asynchronous enumerator written in Python using aiohttp. In plain words: a script that sends many requests at the same time instead of one after another, so thousands of lookups finish in an afternoon rather than days. It ran twelve concurrent connections and fired one request per BIN across the target blocks. The report does not describe any accounts, roles or specific software versions.

Finding it

Watching the traffic

The researcher watched the app the way an attacker would: its traffic, its API calls and its trust boundaries. A trust boundary is simply a line where you stop trusting what is on the other side. The app trusts the server to send back only what it needs; the server should not trust the app to behave.

When the checkout screen prompted for card details, the app quietly reached out to the backend payment API:

HTTP
GET https://pay-api.example.com/v1/cardbins/432143

Line by line:

  • GET is the type of request. It means "read something", as opposed to sending or changing something.
  • https://pay-api.example.com is the address of the server. The example.com part is a placeholder; the report anonymised the real address.
  • /v1/cardbins/ is the path, the part of the address that names what you want. Here it says: version 1 of the service, and the cardbins section.
  • 432143 is the six-digit BIN being looked up.

Notice what is missing: no key, no token, no login. The request is just an address anyone could type.

The response

The app expected the kind of lightweight answer that lets the screen paint a little Visa logo. What came back was the entire licensed BIN record:

JSON
{  "bin": "432143",  "brand": "VISA",  "bank": "Citizens Bank",  "country": "CANADA",  "type": "DEBIT",  "icon_url": "…"}

This is JSON, a common text format for structured data. Line by line, as fields inside one object:

  • bin is the six digits that were asked about.
  • brand is the card network, here VISA. This is the only field the app actually needed.
  • bank is the bank that issued the card, here Citizens Bank.
  • country is the country of issue, here CANADA.
  • type is the kind of card, here DEBIT.
  • icon_url is a web address for the logo image.

The app only needed brand. The API handed over the bank name, the country and the card type to anyone who asked. There was no API key, no session token and no rate limit.

This is the vulnerability: an unsecured API endpoint. An endpoint is one specific address on a server that answers requests. "Unsecured" here means it had none of the checks that would normally protect it. The class of problem is often called excessive data exposure: the server sends back more than the caller needs, and does not check who is calling.

Exploitation

Why bother going further

A single BIN lookup is a curiosity. One card's bank name tells you almost nothing. A full map of the global card space is an asset, so the question became: how far does this door open?

The endpoint accepts any six-digit string. Card networks allocate BINs across well-documented ranges, which means you do not have to guess blindly. The ranges listed in the report are:

  • Visa: 400000–401000, 414700–415000
  • Mastercard: 510000–510500, 520000–520500, 530000–530500, 540000–540500, 220000–220300
  • American Express: 370000–370500, 340000–340300
  • Discover: 601100–601500, 650000–650200
  • RuPay: 652100–652300
  • JCB: 352800–353000

Each range is a block of six-digit numbers. 400000–401000 means every number from 400000 to 401000. Walking through these blocks systematically is called enumeration: asking for every value in a known set, one after another, to see what comes back.

Step 1: Confirm the unauthenticated lookup

Send a single six-digit BIN to the endpoint with no credentials of any kind. The important parts are the path segment /v1/cardbins/ followed by the six digits, and the absence of any Authorization header, cookie or API key. A header is extra information attached to a request, like the label on a parcel; Authorization is the header where a token would normally travel.

The response is the full record shown above: bin, brand, bank, country, type and icon_url. The client only consumes brand. This step matters because it proves the door is open before any script is written. If the server had demanded a login, the rest of the plan would not work.

Step 2: Enumerate the documented ranges

Run the asynchronous enumerator across the ranges above, twelve connections at a time, one request per BIN. That came out to 5,400 queries. The result was 5,256 valid BINs, a 97% hit rate, each populated with the issuing bank, brand, country and card type. The server never choked, slowed down, throttled or threw an error.

Why twelve connections? Sending one request at a time would take far longer. The script used twelve concurrent connections. The 97% hit rate means almost every number in the ranges turned out to be a real BIN, which is why the ranges are worth knowing.

Step 3: Assess the resulting dataset

An unattended script running for one afternoon yielded an operational dataset, for example:

  • 432143 · Visa · Citizens Bank · Canada · Debit
  • 378282 · Amex · American Express · US · Credit

In total: nine payment networks, 2,902 credit and 1,698 debit entries, with banks catalogued worldwide. That is the exact dataset that card-testing tooling and phishing infrastructure rely on.

Card testing is the practice of trying stolen card numbers in small transactions to see which ones still work. Phishing is sending a fake message that pretends to come from a real company to trick someone into giving away details or clicking a link. Both become easier with a good map of which bank sits behind which card prefix.

Step 4: Stop at the agreed limit

Enumeration stayed within the defined testing limits. The test was run once, the exposure vector was documented, and the enumeration script and proof-of-concept dataset were delivered directly to the remediation team. A proof of concept is the smallest demonstration that a problem is real, here the collected data itself. Remediation means the fix.

An attacker would instead harvest the entire global space and monetise the derived table.

Root cause

The backend resolved the BIN and returned the whole licensed record, while the client only needed the brand. The lookup route had no API key, no session token and no rate limit, and it returned the whole licensed record.

That is a common mistake. The app is not a trustworthy gatekeeper: anyone can send requests to the server directly, skipping the app entirely, as the researcher did. Rules that matter have to live on the server.

The report does not describe the server-side code, so the exact implementation mistake is not stated.

Impact

Nobody steals individual card numbers with this; that is not the threat vector. The BIN data does not contain card numbers. The risk is what a complete BIN database amplifies:

  • Card-testing efficiency: fraud rings use granular BIN tables to prioritise which stolen numbers to test first, avoiding banks with aggressive foreign transaction blocks.
  • High-conviction phishing: phishing kits use issuing bank metadata to make lures more convincing. A message such as "Your Citizens Bank card ending in 1432 has been locked" lands with far more authority than a generic warning.
  • Domain spoofing synergy: paired with an unauthenticated email vector (in this case the target domain lacked SPF, DMARC and DKIM enforcement), these ingredients assemble into a turnkey, highly targeted phishing pipeline derived entirely from public company infrastructure.

SPF, DMARC and DKIM are three email settings that together let the world check whether a message really came from a domain. Without them, anyone can send mail that appears to come from that domain. Domain spoofing is exactly that: pretending to send from an address you do not own.

These outcomes depend on the attacker combining the BIN data with other material, such as stolen card numbers or a spoofable mail domain. The BIN exposure alone does not yield card numbers.

Fix

The client interface only needed the card brand icon, and only after the user entered the opening digits. The report describes what the fix looks like:

  • Server-side resolution: resolve the BIN strictly on the backend at transaction submission time, protected by the same session authentication and rate limiting enforced on checkout routes. In plain words: do the lookup only when the payment is actually being submitted, behind the same login and speed limits as the rest of checkout.
  • Client-side IIN tables: if the UI needs dynamic brand logos as the user types, bundle a static, offline IIN prefix lookup locally in the mobile app binary, so no external network request is required just to switch an icon. An IIN is another name for the same leading digits; a static table means a small list shipped inside the app, so the logo can change without asking a server at all.

Variants to test

If you ever find yourself in an authorised test, these are the follow-up checks the report suggests:

  1. Other card-metadata endpoints in the same app. Look for any route the checkout flow calls before submission, such as brand or issuer lookups. A positive result is a response containing fields the UI never renders, such as bank name, country or card type.
  2. Field-level over-return on authenticated routes. Compare what the client uses with what the response contains. A positive result is licensed or internal fields present in a response that only needs a display value.
  3. Missing rate limits on enumeration-friendly identifiers. Try a short burst of sequential six-digit values with twelve concurrent connections. A positive result is a steady stream of full records with no throttling, slowdown or error.
  4. The same pattern on other short numeric identifiers. Any endpoint keyed by a small, guessable number (prefixes, routing codes, sort codes) is worth the same treatment. A positive result is a high hit rate across a documented range with rich metadata in each response.
  5. Mail authentication posture of the same domain. Check SPF, DMARC and DKIM enforcement. A positive result is a domain that can be spoofed, which is what turns BIN metadata into a convincing phishing lure.

Glossary

  • API: the way one piece of software asks another for something, like a waiter carrying orders between you and the kitchen.
  • API key: a secret string that software uses to prove who it is.
  • Authentication: proving who you are before a server gives you something.
  • Authorization header: the part of a request where a token or key normally travels.
  • BIN (Bank Identification Number): the first six digits of a payment card, which identify the network, bank, country and card type.
  • Card testing: trying stolen card numbers in small transactions to see which still work.
  • Client: the app or browser making the request.
  • Concurrent connections: several requests in flight at the same time rather than one after another.
  • Cookie: a small piece of text a browser stores and sends back so a server recognises you.
  • DKIM: an email setting that adds a cryptographic signature so receivers can check a message really came from a domain.
  • DMARC: an email setting that tells receivers what to do when SPF or DKIM checks fail.
  • Domain spoofing: sending email that appears to come from a domain you do not own.
  • Endpoint: one specific address on a server that answers requests.
  • Enumeration: asking for every value in a known set, one after another, to see what comes back.
  • Excessive data exposure: a server returning more information than the caller needs.
  • GET: the request type that means "read something".
  • Header: extra information attached to a request or response.
  • IIN: another name for the leading digits of a card that identify the issuer.
  • JSON: a common text format for structured data, made of names and values.
  • Path: the part of an address that names what you want on a server.
  • Phishing: a fake message pretending to come from a real company to trick someone.
  • Proof of concept: the smallest demonstration that a problem is real.
  • Rate limiting: refusing to answer too many requests in a short time.
  • Remediation: the fix for a security problem.
  • Request: the message a client sends to a server.
  • Response: the message a server sends back.
  • Session token: a piece of text proving you logged in, sent with each request.
  • SPF: an email setting listing which servers are allowed to send mail for a domain.
  • Trust boundary: a line where you stop trusting what is on the other side.
  • Unsecured API endpoint: an address that answers requests without the checks that should protect it.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.