Modern applications use Application Programming Interfaces (APIs) to provide authentication, user management, object access, transactions, and other application functionality. API requests contain behavioral characteristics such as HTTP methods, request paths, parameter structures, request frequency, response status codes, and other request-level attributes that can be analyzed for security monitoring.
API abuse can occur when an attacker generates unusual requests, repeatedly accesses API resources, manipulates request parameters, or performs operations that differ from normal application behavior. Such activities may be difficult to identify when detection relies exclusively on predefined signatures or fixed rules.
In this use case, OWASP crAPI is deployed within an isolated cybersecurity laboratory. Kali Linux is used as the controlled security-testing environment, while Ubuntu Linux hosts the application and machine-learning analysis workflow.
An existing public API security dataset is used as the data source for the machine-learning stage. The available API traffic records and their associated metadata are inspected to determine whether they contain suitable normal and attack-related request information. The selected records are processed to identify features suitable for the proposed experiment.
The public dataset is processed to establish a consistent numerical representation of API-request behavior. Local Outlier Factor (LOF), implemented through Scikit-learn, is used to identify observations whose local density differs significantly from the surrounding request population. LOF measures local density deviations rather than relying solely on a global boundary.
The trained anomaly-detection workflow is then evaluated using API requests generated by normal application activity and a controlled abnormal API-call scenario against the local OWASP crAPI application. The controlled test is performed only within the authorized laboratory.
Captured API requests are processed using the same feature-extraction pipeline used during training. The LOF model analyzes compatible request features and produces an anomaly prediction and associated score. The results are compared with the known laboratory test conditions to evaluate whether the selected behavioral features help identify abnormal activity.
The complete workflow is:
Public API Security Dataset
→
Dataset Inspection
→
Normal Request Selection
→
Data Preprocessing
→
Behavioral Feature Extraction
→
LOF Model Training
→
OWASP crAPI Deployment
→
Normal API Activity
→
Controlled Abnormal API-Call Simulation
→
API Request Capture
→
Consistent Feature Extraction
→
LOF Anomaly Detection
→
Suspicious Request Identification
→
Detection Result Validation
→
Performance Evaluation