Detect High-Volume API Scraping by Scripted Clients in Generic CSV API Logs
Published
Sigma Rule
title: High-Volume API Scraping by Scripted Client
id: 862e8a71-38a3-4553-ba44-b52b1771a084
status: experimental
description: >
Detects a single source rapidly calling export, query, search and report
API endpoints with a non-browser, scripted user agent (python-requests),
returning successful responses. A handful of calls per minute from one
source to these endpoints with this client is consistent with automated
bulk data harvesting rather than normal interactive use of the API.
references:
- https://attack.mitre.org/techniques/T1119/
- https://attack.mitre.org/techniques/T1213/
author: LogTriage
date: 2026/11/09
logsource:
category: application
service: api
detection:
selection:
user_agent|contains: 'python-requests'
path|contains:
- '/api/v1/export/'
- '/api/v1/query'
- '/api/v1/search'
- '/api/v1/reports'
status_code: 200
timeframe: 1m
condition: selection | count() by ip_address >= 5
falsepositives:
- Scheduled internal job or ETL pipeline using python-requests on a fixed schedule
- QA or monitoring script paginating through the API
- Ad-hoc export run through a Python client during a migration
level: medium
tags:
- attack.collection
- attack.t1119
- attack.t1213
1 · Each event is compared with one selection. Every field in a selection must match; listed values are alternatives.
- user_agent contains
python-requests - and path contains any of
/api/v1/export//api/v1/query/api/v1/search/api/v1/reports - and status_code is
200
2 · An event counts when
selection
3 · Then
Count matching events for each ip_address within 1 minute; it alerts at at least 5.
generic_api_scraper.csv, silent on generic_normal_api.csv — both in the public sample dataset ↗︎ What this rule detects
An API that serves bulk or structured data — export endpoints, a generic query endpoint with a table parameter, search, and reports — is usually called occasionally by a browser session or a scheduled job. This rule detects a single source calling several of those endpoints in quick succession using a scripted HTTP client rather than a browser, which is how automated scraping tools pull data out of a REST API: enumerate the collections, page through them, then hit the bulk-export and reporting routes.
Detection logic
The selection requires three things on the same request:
user_agent|contains: python-requests— the client is a Python HTTP library, not a browser. No browser sends this string.path|containsone of/api/v1/export/,/api/v1/query,/api/v1/search,/api/v1/reports— endpoints that return bulk or structured data rather than a single record.status_code: 200— the request succeeded, so data was actually returned.
count() by ip_address >= 5 within a 1-minute timeframe then requires at least five such
requests from the same source address inside that window. Counting by ip_address catches the
behavior regardless of which specific endpoints are hit or in what order, as long as the source
and client stay the same.
Validated against a real sample
Validated against generic_api_scraper.csv (shipped with LogTriage): 20 requests from
198.51.100.77, all python-requests/2.28.0, status 200, spanning 03:00:00Z to 03:00:19Z
with no user_principal_name on any row. Of those 20, nine match the selection’s path list:
/api/v1/export/users,/api/v1/export/accounts/api/v1/query?table=users,?table=accounts,?table=orders/api/v1/search?q=*,?q=*&limit=1000/api/v1/reports/monthly,/api/v1/reports/weekly
Nine matches from one source inside a 1-minute window clears the >= 5 threshold. The rule stays
silent on the matching benign log, where every user agent is a browser engine string
(AppleWebKit, Gecko) or kube-probe/1.28, and none contains python-requests.
False positives
Internal automation is the main source of noise: a scheduled export job, an ETL pipeline, or a
QA script that happens to use python-requests and calls one of these endpoints repeatedly will
match. Check whether the source address is a known internal job runner and whether the calls
follow a fixed schedule rather than a short burst across several distinct bulk endpoints. If a
legitimate internal tool triggers this regularly, allow-list its source address rather than
loosening the path list or the threshold.
Frequently Asked Questions
- Why key on the python-requests user agent instead of request volume alone?
- Volume alone is unreliable: a dashboard or single-page app legitimately fires many sequential calls in one user session. What marks the sample as scraping is the combination of a non-browser client (python-requests/2.28.0, with no browser engine token at all) calling export, query and search endpoints back to back with no user_principal_name attached, rather than any one of those facts alone.
- Why restrict the path list to export, query, search and reports instead of all /api/v1/ traffic?
- Plain resource listing endpoints like /api/v1/users or /api/v1/products are hit constantly by normal clients, including the benign sample's alice and carol sessions, so matching on them would be noisy. Export, query (with a table parameter), search and reports are the endpoints that return bulk or structured data in one call, which is what a scraper is actually after.
- Why threshold at 5 in 1 minute rather than alerting on the first hit?
- A single call to /api/v1/export/users from a script is unremarkable; a report generator or internal tool can do that. The sample shows 9 matching calls (2 export, 3 query, 2 search, 2 reports) from one IP inside a 20-second span. The threshold is set below that so a short burst across several of these endpoints from one source still fires, while an isolated one-off export does not.
- Does the absence of user_principal_name matter here?
- It's consistent with the pattern but not part of the detection logic, since Sigma string matching can't test for an empty field. Every row in the malicious sample has a blank user_principal_name, meaning the calls carry no identified user context, while every interactive session in the benign sample (alice, bob, carol, dave) does. If your deployment can emit a null/empty check, add it as a confirming filter rather than relying on it alone.
Related Resources
Reference
- Generic CSV Log Format: field reference → every field explained, with real sample records
- Paste one record and see what each field means → free, runs in your browser
See this detection run on a real report
Try the live demo with a pre-loaded malicious log set — no signup required — or upload your own log file and get a full AI-reviewed threat report in minutes.