How to Detect Bulk Enumeration Through a Partner's API Credentials Before It Finishes
Security Intermediate 7 min read

How to Detect Bulk Enumeration Through a Partner's API Credentials Before It Finishes

Per-credential baselines, five signals that separate enumeration from a batch job, and the distinct-identifier ceiling that bounds an extraction even when nobody is watching.

Published: October 5, 2026 • Updated: October 5, 2026
anomaly detectionapi securityrate limitingloggingthird-party risk

The attackers who extracted roughly 8.8 million records from Denmark's Central Person Register in September 2026 were, from the registry's perspective, a legitimate customer. They used a private company's lawful access to the CPR search functions and ran what The Record described as a very large number of automated searches to find valid CPR numbers. The activity lasted about ten days before the CPR administration noticed irregular behaviour on the evening of 2 October. By then the extraction was complete.

Ten days is a long time for a pattern that extreme to sit in the logs unalerted. This guide covers how to detect bulk enumeration through a partner's credentials while it is still in progress, whether you operate the lookup service or you are the partner whose integration might be hijacked.

Start from what legitimate use looks like

Enumeration detection is a baselining problem. You cannot recognise abnormal query behaviour for a client unless you know what normal looks like for that client, so the first step is to build a per-credential profile from historical logs. For each API key, client certificate or service account that can query the dataset, compute over the last 60 to 90 days:

  • Requests per hour and per day, with the 95th and 99th percentiles, not just the mean.
  • The hit ratio: the fraction of lookups that returned a record versus a not-found response.
  • The set of distinct identifiers queried per day, and how many were queried more than once.
  • The hours of the day and days of the week the client is active.
  • Which response fields the client's workflow actually consumes, if your logging captures it.

A legitimate verification partner has a distinctive shape. Its volume tracks its business hours. Its hit ratio is high, because it asks about people it already has a relationship with. It re-queries the same identifiers over time, because customers come back. An enumeration run inverts every one of those properties, and that inversion is the detection signal. Why Third-Party Lookup Access Is an Enumeration Oracle Waiting to Be Abused explains why the attack has to look this way.

The five signals that distinguish enumeration from load

Volume alone is a noisy indicator. Partners run migrations, batch jobs and re-verification campaigns that legitimately spike their traffic. These five signals, taken together, separate a batch job from a walk through the identifier space.

Hit ratio collapse. A client that normally gets a record back 90 percent of the time suddenly gets one back 2 percent of the time. This is the single most reliable sign of enumeration, because an attacker generating candidate identifiers will miss far more often than it hits. For structured identifiers such as a date-of-birth-prefixed national number, expect the ratio to be in the low single digits. Alert when a client's hourly hit ratio drops below a quarter of its baseline.

Monotonic or structured identifier sequences. Sort the identifiers a client queried in a window. Legitimate traffic looks random. Enumeration looks like counting: consecutive values, or a fixed prefix with the suffix incrementing, or every candidate for one birth date followed by every candidate for the next. A simple test is to compute the fraction of queried identifiers whose numeric successor was also queried within the same hour.

Zero repeat rate. Real workflows revisit identifiers. An enumeration run never asks about the same one twice, because it is trying to cover the space, not serve customers. A client whose repeat rate drops to zero while its volume rises is covering ground.

Time-of-day drift. A partner that has never made a request after 19:00 and is now sustaining steady volume at 03:00 is either running a new batch job or is not the one making the requests.

Flat request cadence. Scripts produce traffic at a suspiciously regular interval, often tuned to sit just under a known rate limit. Near-zero variance in inter-request timing means a loop is driving the client.

Score each client each hour against these five. Two or more firing simultaneously is enough to block pending human review.

Where to put the detection

The right layer depends on what you control.

If you operate the lookup service, the API gateway or the application tier is where per-credential metrics are cheapest to compute, because every request has already been authenticated and attributed to a client. Emit a structured log line per request with the client identifier, the queried identifier (hashed if you must), the hit or miss outcome and the response size. Stream those into whatever you use for aggregation and compute the five signals as rolling windows. Pair the detection with an enforcement hook that can suspend a single credential without touching the rest.

If you are the partner, you are protecting your own credentials from being turned into an extraction tool. Put the lookup call behind an internal service rather than letting any application reach the vendor directly, and apply the same five signals on the outbound side. A sudden surge of outbound lookups with a collapsing hit ratio means something inside your estate is abusing the integration, whether that is malware, a compromised account or an insider.

In both positions, keep per-request logs for at least ninety days. The CPR administration reconstructed September's activity over a single weekend in October, which was only possible because its query logs were intact and attributable.

Enforce a ceiling the attacker cannot wait out

Detection is only half the control. The other half is making sure that even an undetected run cannot finish. For every credential, set three limits server-side:

  • A burst limit per minute, sized to the client's 99th percentile plus headroom.
  • A daily limit, derived from the client's stated business purpose rather than from the gateway default. Ask the partner how many lookups their workflow can plausibly need and set the ceiling at a small multiple of that.
  • A cumulative distinct-identifier limit per rolling 30 days. This is the limit enumeration cannot evade by slowing down. A partner that verifies a few hundred new customers a month has no legitimate reason to query a hundred thousand distinct identifiers in that window, regardless of how evenly it spreads them out.

The third limit is the one most organisations lack and the one that would have bounded the CPR extraction. At 8.8 million records over ten days, the attackers averaged well over 800,000 successful lookups a day, on top of the misses needed to find them. A distinct-identifier ceiling in the low thousands would have stopped the run inside its first hour.

When an alert fires

Suspend the credential first and investigate second. A false positive pauses one vendor's workflow until someone picks up the phone; a false negative costs you the dataset. Then:

  1. Notify the partner through a channel you already trust, not through contact details embedded in the API request.
  2. Pull the full query history for the credential and determine what was returned, not just what was asked. Regulators will want the count of distinct individuals whose data was disclosed.
  3. Ask the partner to determine how their access was used. Stolen credentials, a compromised host and an insider require different responses on their side and different disclosures on yours.
  4. Rotate the credential before re-enabling access, and re-enable it with the purpose-derived quotas described above rather than the ones it had before.

The Danish government notified its data protection authority within two days of detection and went public on the third. That pace was possible because the logs told a clear story. Build the logging and the baselines now, while nothing is wrong, and you will be able to tell the same story in hours instead of weeks. Why a National ID Number Can Never Be a Secret, and What to Authenticate With Instead covers the downstream problem your customers will face once their identifiers have been taken.