Valid Requests, Malicious Intent: Investigating API Abuse from Reconnaissance to Exfiltration
Valid Requests, Malicious Intent: Investigating API Abuse from Reconnaissance to Exfiltration
This article is part of an ongoing series from Sophos frontline security operations specialists, sharing the expertise they use to strengthen our industry-leading Managed Detection and Response (MDR) service and defend customers against evolving AI-era threats.
The pattern hiding inside valid API traffic
Across multiple anonymized investigations, incident responders observed a recurring pattern: threat actors mapped public applications, targeted authentication and recovery workflows, abused accepted tokens, crossed object and function boundaries, changed application state, and collected or transferred data through legitimate API functions.
The requests were often well formed and encrypted. Source IP addresses, countries and User-Agent strings changed, but the route sequence and target remained consistent. This article explains how Digital Forensics & Incident Response (DFIR) teams can reconstruct that sequence, confirm what succeeded, and recommend controls that prevent recurrence.
Scope: The routes, identifiers and payloads in this article are fictional and cloud-neutral. The pattern is drawn from multiple anonymized investigations. Similar behavior does not, by itself, prove a common threat actor.
Five rules for investigating API abuse
| Rule | What it means |
| 1. HTTP success is not application success | A 200 response may contain a denial, fallback page or unsuccessful business result. |
| 2. Authentication is not authorization | A valid token proves identity, not permission to access a specific object or function. |
| 3. Access is not exfiltration | Prove data return, collection, staging and external transfer as separate events. |
| 4. Correlation is not attribution | Shared IP ranges, tools, JA4 values or marker names may link activity but do not prove a common operator. |
| 5. Sequence is stronger than infrastructure | Tokens, sessions, objects, request IDs and route order survive IP and User-Agent rotation. |
Why so many APIs are exposed in a way that helps an attacker:
- Nobody has the full list. Old versions keep running, and test, debug and management routes reach production (OWASP API9, improper inventory management).
- The application ships its own map. The JavaScript the browser downloads names the routes and shows how login and recovery work.
- Login is checked, ownership often is not. The API confirms who the caller is, not whether the record is theirs (Broken Object Level Authorization, OWASP API1).
- Defaults and diagnostics leak. Spring Boot’s heap-dump and environment endpoints were exposed without authentication by default until version 1.5 (2017), and heap dumps can hold tokens and passwords.
- Trust spreads through integrations. A third-party app holding an API token is a path into every customer that connected it, as the 2025 Drift campaign showed.
- Defenses watch the wrong thing. A web application firewall looks for malicious payloads, but an API attack can be entirely well-formed requests.
What it costs: Each weakness gives the attacker something and costs the organization something.
| Weakness | What the attacker does with it | Consequence |
| Unlisted, old or diagnostic routes | Finds functions never meant to be public | Entry points no one monitors or patches |
| Missing object-level authorization | Changes an ID to read others’ records | Mass personal-data exposure (T-Mobile: about 37 million accounts through one API) |
| Weak login and recovery | Guesses OTPs, abuses recovery to get a token | Account takeover, fraud, a foothold |
| Leaked or over-trusted tokens | Acts as the victim or a trusted partner | Theft that looks like normal use; Drift data was mined for more credentials |
| Thin API-layer logging | Operates unnoticed | Long dwell time: T-Mobile about six weeks, Okta 14 days before file access was flagged |
Beyond the data itself: breach-notification duties, lost customer and partner trust, response and legal cost, and stolen credentials that seed further attacks. API abuse is not a set of unrelated web requests. It is a connected attack sequence. Reconstruct the sequence, and every stage becomes provable.
The attack chain at a glance
Figure 1. Seven stages, from public reconnaissance to exfiltration. The ATT&CK column is our own mapping to the MITRE ATT&CK framework.
Why one stage never proves the story: Retrieving a JavaScript file is normal. Retrieving dozens of modules, probing authentication, varying customer IDs and then calling an export is not. Confidence comes from the sequence.
Stage 1: Reconnaissance, reading the application’s own blueprint
The attacker starts with plain web requests. A modern site ships its own instructions to every visitor, and those files often describe the API: where it lives, what it accepts, how login works.
- Public files. JavaScript bundles, source maps (files that restore readable code), manifests, and login, recovery and reset components.
- JWKS endpoint. It publishes the keys used to check tokens. Fetching it shows interest in token validation, not theft or forgery.
- Documentation and hidden routes. Swagger/OpenAPI documents, administrative routes, path-traversal strings and backup-file names, probed with tools such as curl. In one case a firewall rule blocked a diagnostic function, and adding a trailing slash to the path bypassed it.
Reported publicly. Spring Boot Actuator’s /heapdump and /env endpoints can expose passwords, tokens and cloud keys. Wiz found 2.3% of exposed instances left heapdump open without authentication. A vendor reported scans for /actuator/heapdump in July 2026; its page is thin on detail, so read it as interest, not a measured campaign.
Objective and proof: build a blueprint and find exposed functions. A diagnostic request matters only when the response or later token use shows sensitive data was returned.
Stage 2: Initial access, getting a token
A token is a short-lived credential issued after login. Whoever holds a valid one is treated as the account owner, so it is the most valuable item in the attack. There are four ways to get one:
- Have the system issue it. Guess OTPs, abuse password recovery or request tokens in bulk. We saw 34,313 OTP attempts from 21,387 IP addresses, and hundreds of token requests in about five minutes from a script. Load-balancer data confirmed automation and HTTP success, but not that tokens were issued.
- Steal an exposed one. Wiz notes a heap dump can contain JWTs and session cookies.
- Steal it from a person or partner. Okta session tokens in support files (HAR files) were used to hijack five customers’ sessions. Google reported compromised Salesloft Drift OAuth tokens used to pull data from many Salesforce customers. Its advisory does not say how the tokens were first obtained.
- Forge one. This needs the signing key or a validation flaw. A JWKS request alone does not show it.
Objective and proof: obtain a credential the API accepts. Correlate OTP and recovery activity with token issuance, session creation and later API calls to see which route worked.
Stage 3: Using the token to reach other people’s data
A valid token proves who the caller is, not that the record is theirs. When the API skips that second check, the flaw is Broken Object Level Authorization (BOLA, also called IDOR): the attacker changes the identifier and watches what returns.
GET /api/customers/48101
GET /api/customers/48102
GET /api/customers/48103
- Customer identifiers were varied until valid records appeared, then further records were enumerated through customer-information APIs.
- A Firefox-on-Linux client, from several IP addresses, forced its way through identity, authentication, transaction, customer-search and payment-orchestration endpoints, which is not how people browse.
- Many requests returned HTTP 200 at the edge while middleware rejected some before any business logic ran. A 200 describes the request, not the outcome.
Reported publicly. T-Mobile told the SEC that a bad actor obtained data through a single API without authorisation from about 25 November 2022 until detection on 5 January 2023, covering about 37 million accounts. In the Drift campaign the actor first ran counts of accounts, users and cases, then retrieved records, up to 10,000 cases per query.
Objective and proof: find valid objects and expand beyond the token owner. Application result, object ownership, record count and response bytes show which calls returned data and which were rejected.
Stage 4: Changing things, privilege escalation and persistence
Changing the system is worse than reading it: it lets the attacker stay and act as the victim. With a low-privilege token they test whether an ordinary account can call an administrator function (Broken Function Level Authorization) and whether the API accepts fields it should not, such as a role. Functions to watch:
- Create an account or administrative user; change a role, permission or tenant setting.
- Register a device or enroll an authenticator, which gives a second way in that survives a password change.
- Change an email address, link accounts, modify an OAuth client, or skip ahead in a recovery flow.
Reported publicly. The Drift actor also used email-integration tokens to read mail in a few Google Workspace accounts. Okta’s stolen session tokens let the attacker act inside customers’ own sessions.
Objective and proof: increase access and persist. Role history, administrator creation, device or authenticator enrolment, OAuth client changes and before-and-after state show which actions completed.
Stage 5: Execution and impact
Impact is what the attacker makes the application do for them: a payment, a configuration or identity change, an account takeover, a disabled security control. The APIs involved are the business functions themselves. Proof: application audit trails, database changes and workflow records. An HTTP status is not proof.
Stage 6: Collection and exfiltration
These are different events, and the difference matters to regulators. The attacker uses functions the application already offers: search and list calls, reports, export jobs, bulk queries, downloads and storage reads.
- Collection: the attacker gathers data, by repeated reads or by asking the application to assemble it.
- Staging: the data is written somewhere convenient, such as an export file, an archive or a storage bucket.
- Exfiltration: the data leaves the organization’s control.
Reported publicly.
- Bulk export. The Drift actor “systematically exported large volumes of data” then searched it for AWS keys, passwords and Snowflake tokens, so stolen data seeded the next intrusion.
- One API, millions of records. T-Mobile’s single API returned data on about 37 million accounts before it was found.
- File download. Okta’s attacker accessed files tied to 134 customers. Opening a file and browsing the Files tab logged differently, so direct access went unflagged for 14 days.
A large response, an export request or an HTTP 200 does not by itself prove data left the building.
Machines move in minutes. Detection takes days to weeks.
A token-request burst in our investigations lasted about five minutes. The public cases below ran 12 to 41 days before discovery or containment. Elapsed days are our arithmetic from the dates each source states.
| Incident | First Activity | Found or Contained | Elapsed | Source |
| T-Mobile, single unauthorised API | About 25 Nov 2022 | Identified 5 Jan 2023 | About 41 days | |
| Okta support system, stolen session tokens | 28 Sep 2023 | Tokens revoked 17 Oct 2023 | 19 days | |
| Salesloft Drift, stolen OAuth tokens | 8 Aug 2025 | Tokens revoked 20 Aug 2025 | 12 days |
Why blocking IP addresses and countries does not work
Source addresses change throughout, deliberately. One dataset held 15,030 addresses; 4,404 had country data, spanning 45 countries, and most appeared only a few times, consistent with a commercial residential-proxy network. The same activity presented as Firefox, curl, Chrome and a mobile client. Scripted tooling such as curl and Python libraries makes this cheap at scale; unless direct evidence exists, report it as automated, not AI-driven.
Reported publicly. In January 2026 Google disrupted the IPIDEA residential-proxy network, saying more than 550 threat groups had used its infrastructure in a single recent month.
What this means for defenders.
- An IP address shows where a request left the internet. It is not where the operator sits.
- A country is the location of a proxy exit, not an attribution.
- A User-Agent string is what the client claims to be, and can be changed in one command.
- Aggregate by what is being attacked: the target identity, the object, the token, the session, the device, the route. Do not aggregate only by where each request came from.
From indicators of compromise to indicators of behavior
IR pivot hierarchy
Pivot from identity and application state outward, not from the IP address inward. Use the strongest available correlation key first.
| Priority | Pivots | Value |
| Strongest | Request/trace ID; token reference or jti; session ID; authenticated sub; OAuth client ID/azp; object ID; export job ID; device/authenticator ID | Deterministic or near-deterministic joins across evidence layers. |
| Strong | Route sequence; target identity; object-owner violations; timing cadence; JA4 at the first trusted TLS termination point | High-value behavioural correlation. |
| Supporting | IP, ASN, country, hosting provider and User-Agent | Short-lived scoping and enrichment, not identity or attribution. |
Behavioral indicators
- One identity reading objects owned by many unrelated parties.
- Repeated OTP failures against one identity from many IPs, ASNs or countries.
- Front-end discovery followed by administrative or internal API calls.
- Sensitive state changes (device, authenticator, role, password) soon after account recovery.
- High-cardinality object reads followed by an export.
- The same route sequence continuing from a new IP or User-Agent moments after a block.
Handling User-Agents and JA4
Treat User-Agent strings as pivots, not IOCs: curl, Python and Go clients all appear in legitimate traffic. JA4 describes how a TLS client connected, so it can survive a change of IP or User-Agent, but it is a correlation signal, not an identity, and is meaningful only at the first trusted TLS termination point (behind a CDN, the origin sees the CDN’s connection). Say “JA4-linked activity”, never “the attacker’s fingerprint”.
Route families and what to validate
Each attacker objective tends to concentrate on a recognizable family of routes. The paths below are illustrative; map them to your own API inventory, then confirm the outcome column before concluding anything.
| Attack objective | Illustrative route family | Why the DFIR team must validate |
| Account enumeration | /identity/verify-user, /accounts/lookup | Response differences reveal valid identities |
| OTP abuse | /auth/otp/request, /auth/otp/verify | Validation result and subsequent token issuance |
| Recovery abuse | /auth/recovery/*, /password-reset/* | Recovery completion and session creation |
| Token acquisition | /oauth2/token, /sessions | Token or session was actually issued |
| BOLA/IDOR | /customers/{id}, /files/{id} | Requested object was outside caller scope |
| Privilege escalation | /users/{id}/roles, /admin/identities | Before-and-after role or identity state |
| Persistence | /devices, /authenticators, /oauth-clients | New durable access mechanism created |
| Execution | /payments, /transactions, /settings | Business workflow and backend confirmation |
| Collection | /search, /reports, /exports | Records returned or output created |
| Exfiltration | /files/{id}/download, storage-object reads | Successful external byte transfer |
Five questions the IR team must answer
Responders often find suspicious endpoints, addresses and fingerprints but never complete the chain from the first token to the final impact. Five connected questions close that gap.
1. How was the first unauthorized token obtained? Issued after OTP or recovery abuse, stolen, exposed through a diagnostic endpoint, or forged? Name the exact route if one contributed.
2. Which APIs were called with the token? List every route family, prioritizing state-changing calls.
3. Did the actor escalate privileges or persist? Name the API responsible and compare state before and after.
4. What operational impact occurred? Validate against audit, database and workflow evidence, not an HTTP 200.
5. Was data collected, staged or exfiltrated? Support each conclusion with record counts, export completion, storage reads and egress telemetry.
| Question | Evidence Required | Defensible Conclusion |
| 1. How was the first token obtained? | Identity-provider, OTP and recovery logs; token issuance records; browser or session evidence; diagnostic-endpoint access; memory-dump access; signing-key history | Issued, stolen, exposed, forged or undetermined |
| 2. Which APIs did it call? | Token reference, method, normalised route, request ID, object ID, authorisation decision, application result | Read-only access, state-changing use or unsuccessful attempt |
| 3. Was privilege escalated? | Role history, OAuth client changes, token claims, administrator creation, device or authenticator enrolment, before-and-after state | Confirmed escalation, persistence only, attempted change or not established |
| 4. What impact occurred? | Application audit, database changes, transaction records, cloud audit, workflow outcomes | Confirmed operation, attempted operation or no supporting evidence |
| 5. Was data exfiltrated? | Record count, response bytes, export completion, storage write and read, download, egress flow, destination evidence | Exposure, access, collection, staging, attempted transfer, confirmed transfer or confirmed receipt |
Grade every answer Confirmed (directly supported by application, identity, database, storage or network evidence), Probable (several correlated signals, a decisive source missing), Possible (plausible, little support), Not established or Contradicted (evidence shows it did not happen). Report a missing link as an evidence gap, not an assumption.
How IR teams detect and investigate it
Investigation workflow
- Find the first trusted edge. Identify what terminates the client’s TLS session, and whether it records the client IP, a JA4 fingerprint and a request ID passed downstream.
- Map the evidence layers. Edge, gateway, identity, application, container, database, storage and egress each answer a different question.
- Normalise. Convert to UTC and record raw and canonical paths, route templates and token and object references. Keep the raw values.
- Build a timeline before an IP list. Order events from discovery to transfer, with source, interpretation and confidence for each.
- Cluster by what is targeted. Use JA4 + route sequence + target identity, token + rotating IPs, or request ID + operation + database change. JA4 strengthens a cluster but should not define it.
- Confirm the outcome at every hop, from edge to application to database, storage and egress.
Evidence ladder: advance only when the next source proves it
Figure 2. API incident-response evidence ladder. Each step requires additional supporting telemetry.
Detection use cases, ready-to-adapt queries and minimum logging requirements are in the companion Appendix A.
What defenders usually miss
- Blocking the IP instead of the workflow. The actor moves to another proxy exit while the same token, target and route sequence continue.
- Reading HTTP status instead of application outcome. Edge success does not prove authorisation, data return or a completed action.
- Stopping at the WAF. It records what arrived; application and backend evidence show what executed.
- Treating User-Agent or JA4 as identity. Both are correlation signals to combine with tokens, sessions, objects and timing.
- Not preserving request and trace IDs. Without them, edge-to-database reconstruction is far less reliable.
What should trigger an investigation?
Do not escalate on one signal: an endpoint request, a country change, curl, a JWKS download or an HTTP 200. Escalate when several behaviours form a connected sequence against the same identity, token, object family or workflow.
| Sequence Stage | Higher-value signal |
| Reconnaissance | Source maps, API schemas, authentication and administrative routes requested in sequence. |
| Authentication targeting | Distributed OTP, recovery or token activity grouped by target identity rather than source IP. |
| Authenticated exploration | A token reaches unfamiliar routes, tenants, objects or administrative functions. |
| Object enumeration | One identity reads many unrelated records or violates ownership/tenant boundaries. |
| State change | Device, authenticator, role, account or OAuth configuration changes follow recovery or login activity. |
| Collection | High-cardinality reads, reports, exports, archives or storage writes. |
| Transfer | Export download or storage read followed by validated external egress. |
The detection unit should be the sequence, not the individual request.
Glossary
| Term | Plain Meaning |
| API | Application programming interface. The set of back-end functions that apps and websites call to fetch or change data |
| Token | A digital pass issued after login. Whoever holds a valid one is treated as the account owner |
| JWT, JWKS | A common token format, and the public endpoint that publishes the keys used to check those tokens |
| OTP | One-time password, such as an SMS or app code used to verify identity |
| BOLA, IDOR | Broken Object Level Authorization. The API checks who you are but not whether the record is yours |
| Source map | A file that turns compressed website code back into readable code, and so reveals the API |
| Heap dump | A snapshot of an application’s memory. It can contain tokens, passwords and keys |
| Residential proxy | A service that relays traffic through ordinary home connections to hide the real origin |
| JA4 | A fingerprint of how a client set up its encrypted connection. Useful for linking activity, not an identity |
| MITRE ATT&CK | A public catalogue of attacker techniques used to describe and compare attacks |
References
Public threat intelligence used in this article:
