Location Research Breakthrough Possible @S-Logix pro@slogix.in

Behavioral Anomaly Detection of Broken Object Level Authorization Attacks Against OWASP crAPI Using Isolation Forest

Description

Organizations increasingly use API-driven applications to provide authentication, user management, object access, transactions, and application functionality through network-accessible interfaces. API requests contain behavioral characteristics such as request methods, URI structures, parameters, object identifiers, response information, and other request-level attributes that can be analyzed for security monitoring.

If malicious API activity produces behavioral characteristics that differ from normal application activity, a detection mechanism based only on predefined signatures or known attack patterns may not identify the activity effectively. Behavioral anomaly detection provides an additional approach by learning normal request behavior and identifying requests that significantly deviate from the established behavioral pattern.

In this use case, an intentionally vulnerable API-driven application is deployed in a controlled laboratory environment. The application provides API functionality and intentionally vulnerable security scenarios that can be used for authorized security experimentation.

A public web-request dataset is used as the existing data source for the machine-learning stage. Normal request records are selected and processed to establish the behavioral characteristics required for model training. The dataset is not manually created for this project.

Isolation Forest is used as the machine-learning algorithm because it can identify observations that differ from the learned normal behavioral population. The model is trained using the selected normal request behavior and is not directly trained on the controlled attack used during validation.

A controlled API authorization attack is then performed against the local application. The resulting API request is captured and processed using the same feature-extraction process used for the training data. The trained Isolation Forest model evaluates the new request and generates an anomaly result.

The complete behavioral-anomaly detection workflow is:

Public Web-Request Dataset → Normal Request Selection → Data Preprocessing → Behavioral Feature Extraction → Isolation Forest Training → Normal API Behavior Learning → OWASP crAPI → Controlled API Attack → API Request Capture → Feature Extraction → Isolation Forest Analysis → Anomalous Behavior Detection → Attack Validation

Existing Security Problem

Application: OWASP crAPI

OWASP crAPI is the target API-driven application in this use case. It provides a controlled environment containing intentionally vulnerable API functionality for security testing and experimentation.

It is deployed only within the authorized laboratory environment so that API requests and controlled attack behavior can be safely generated and analyzed.

Existing Problem :

API-driven applications may expose object-level functionality through API endpoints. If authorization controls do not correctly verify whether the authenticated user is permitted to access a requested object, an attacker may manipulate an object identifier and attempt to access another user's resource.

Traditional detection mechanisms may rely on predefined attack signatures, known malicious values, or vulnerability-specific rules. Such approaches may not identify previously unseen behavioral variations when the malicious request does not exactly match an existing detection pattern.

The security problem is:
API-Driven Application
→
Normal API Request Activity
→
Object-Based API Access
→
Abnormal Object Access Request
→
Behavioral Deviation
→
Potential Unauthorized API Activity
→
Previously Unseen Attack Behavior
→
Security Detection Requirement

The proposed solution introduces a behavioral anomaly-detection mechanism that learns normal API-request characteristics from existing public request data, applies Isolation Forest to the processed behavioral features, analyzes newly captured API requests, and validates the detected anomaly against a controlled attack performed in the laboratory environment.

Attack

Specific Attack: Controlled Broken Object Level Authorization Attack

The controlled attack scenario evaluates whether an authenticated API client can manipulate an object identifier and request an object that should belong to another user.

The attack is performed only against the intentionally vulnerable local application. The objective is not to cause destructive activity but to generate a realistic unauthorized API request that can be captured and analyzed by the behavioral anomaly-detection model.

Attack Behavior :
Authenticated Test User
→
Normal API Request
→
Authorized Object Identifier
→
Object Identifier Modification
→
Unauthorized Object Request
→
API Authorization Decision
→
Abnormal Request Behavior
→
HTTP/API Request Capture
→
Isolation Forest Analysis
→
Anomalous Behavior Identification
→
Controlled Attack Validation

Security Concept

Behavioral Anomaly Detection and API Security Testing

The primary security concept is Behavioral Anomaly Detection combined with controlled API Security Testing.

The first objective is to establish a behavioral representation of normal API request activity using existing public request data. The selected normal records are processed into numerical features that represent relevant characteristics of API requests.

The second objective is to evaluate whether a new API request can be identified as behaviorally different from the learned normal request population. Isolation Forest is used to isolate observations that differ from the normal behavioral distribution.

The assessment follows:
Public Request Data Review
→
Normal Request Selection
→
Behavioral Feature Extraction
→
Isolation Forest Training
→
Normal API Behavior Baseline
→
API Security Testing
→
Controlled Attack Request
→
Attack Request Feature Extraction
→
Anomaly Score Generation
→
Behavioral Anomaly Identification
→
Attack Validation

Defensive Mechanism

The security concept defines the overall security strategy.

The following are the specific defensive mechanisms implemented.

Normal Behavioral Baseline :

Normal request characteristics are processed to establish the behavioral representation required by the anomaly-detection model.

Purpose: Establish a reference representation of normal API behavior.

Isolation Forest Anomaly Detection

Isolation Forest evaluates request features and identifies observations that differ from the learned normal behavioral population.

Purpose
  • Identify API requests that exhibit anomalous behavioral characteristics.

Consistent Feature Extraction

The same request-feature processing approach is applied to the training data and newly captured API requests.

Purpose
  • Ensure that training and detection requests are represented consistently.

API Request Monitoring

API requests generated during the controlled application activity are captured and analyzed for behavioral deviations.

Purpose
  • Provide request-level security evidence for anomaly analysis.

Controlled Attack Validation

The anomaly result is correlated with the known controlled attack performed against the application.

Purpose
  • Validate whether the behavioral detection mechanism identifies the intended abnormal activity.

Security Tools

Primary Vulnerable API Application: OWASP crAPI

OWASP crAPI provides the intentionally vulnerable API environment used to generate legitimate API behavior and controlled unauthorized API activity.

Purpose
  • Provide the API testing environment.
  • Generate normal and attack-related API requests.
  • Validate the controlled API attack.

Machine-Learning Environment: Python

Python provides the main environment for dataset processing, feature extraction, model training, anomaly scoring, and result analysis.

Purpose
  • Implement the machine-learning workflow.
  • Process request features.
  • Analyze anomaly-detection results.

Machine-Learning Library: Scikit-learn

Scikit-learn provides the Isolation Forest implementation used for behavioral anomaly detection.

Purpose
  • Train the Isolation Forest model.
  • Generate anomaly predictions.
  • Calculate and analyze anomaly scores.

Data Processing Tool: Pandas

Pandas is used to load, filter, transform, and organize the existing public request records.

Purpose
  • Process request records.
  • Select normal behavioral data.
  • Prepare model input features.

Numerical Processing Tool: NumPy

NumPy supports numerical transformations required during feature preparation and model processing.

Purpose
  • Perform numerical feature operations.
  • Prepare numerical model inputs.
  • Support efficient feature processing.

API Testing Tool: cURL

cURL is used to generate and reproduce controlled HTTP/API requests against the local application.

Purpose
  • Send legitimate API requests.
  • Generate controlled attack requests.
  • Capture request and response behavior.

API Security Testing Tool: OWASP ZAP

OWASP ZAP is used to inspect and capture API communication during the controlled security assessment.

Purpose
  • Inspect API requests and responses.
  • Support controlled API security testing.
  • Preserve API traffic evidence.

Network Discovery Tool: Nmap

Nmap is used to identify the locally exposed services associated with the API testing environment.

Purpose
  • Discover exposed services.
  • Identify application service ports.
  • Validate laboratory network exposure.

Security Testing Platform: Kali Linux

Kali Linux provides the controlled environment for network discovery, API testing, and security validation activities.

Purpose
  • Execute security-testing tools.
  • Perform controlled API testing.
  • Validate attack behavior.

Application and AI Platform: Ubuntu Linux

Ubuntu provides the local environment for the application and machine-learning workflow.

Purpose
  • Host the application environment.
  • Execute Python and ML processing.
  • Support local security experimentation.

Virtualization Platform: VirtualBox

VirtualBox provides the isolated laboratory environment used for the application and security-testing systems.

Purpose
  • Host isolated virtual machines.
  • Separate application and testing environments.
  • Prevent unintended interaction with external systems.

Process

STEP 01

Prepare the Isolated API Security Testing Environment

  • Create an isolated cybersecurity laboratory using VirtualBox.
  • Configure Ubuntu as the application and machine-learning environment.
  • Configure Kali Linux as the controlled security-testing system.
  • Establish controlled network communication between the virtual machines.
  • Assign stable laboratory IP addresses where required.
  • Verify communication between Kali Linux and the application environment.
  • Confirm that all API security testing is restricted to the authorized laboratory.
Tools: VirtualBox + Ubuntu + Kali Linux
STEP 02

Deploy the OWASP crAPI Application

  • Deploy the OWASP crAPI application within the controlled laboratory environment.
  • Configure the required application components.
  • Start the appliation services.
  • Verify that the application is operational.
  • Confirm that the API endpoints required for the security assessment are accessible.
  • Record the initial application configuration.
Tools: OWASP crAPI + Ubuntu
STEP 03

Establish the Application Functionality Baseline

  • Access the application using the authorized laboratory client.
  • Perform legitimate application operations.
  • Generate normal API requests through the intended application functionality.
  • Observe the API request and response behavior.
  • Verify that normal application operations function correctly.
  • Preserve the legitimate API behavior as the application baseline.
Tools: OWASP crAPI + cURL + OWASP ZAP
STEP 04

Identify the API Service Exposure

  • Identify the authorized OWASP crAPI environment from Kali Linux.
  • Perform controlled Nmap service discovery.
  • Identify the application and API-related service ports.
  • Determine whether the services are reachable from the Kali testing network.
  • Record the network exposure.
  • Compare the observed exposure with the intended laboratory API architecture.
Tools: Nmap + Kali Linux
STEP 05

Prepare the Public Request Data

  • Obtain the existing public web/API request dataset required for the machine-learning experiment.
  • Load the available request records into the Python processing environment.
  • Review the available request attributes and identify fields suitable for behavioral analysis.
  • Select the request information required for consistent feature extraction.
  • Preserve the original data structure before preprocessing.
  • Confirm that the selected data is suitable for the planned behavioral-analysis workflow.
Tools: Python + Pandas
STEP 06

Select Normal API/Web Request Behavior

  • Review the available request records and identify records representing normal request behavior.
  • Exclude attack-specific records from the normal-behavior training set.
  • Select the normal records required to establish the behavioral baseline.
  • Maintain the request attributes required for later feature comparison.
  • Verify that the selected records do not directly contain the controlled attack used for validation.
  • Preserve the selected normal request records for model training.
Tools: Pandas + Python
STEP 07

Preprocess the Request Data

  • Clean the selected request records before machine-learning processing.
  • Handle missing or inconsistent request attributes where required.
  • Normalize the representation of relevant request characteristics.
  • Convert required categorical or textual request attributes into numerical representations.
  • Maintain a consistent preprocessing procedure for later application traffic.
  • Record the preprocessing configuration used for the experiment.
Tools: Python + Pandas + NumPy
STEP 08

Extract Behavioral Features

  • Identify behavioral characteristics from the processed HTTP/API request records.
  • Extract relevant request-level features such as method characteristics, URI structure, parameter characteristics, object-related request information, and available response attributes.
  • Convert the selected characteristics into numerical feature representations.
  • Ensure that the feature representation can also be generated from captured crAPI requests.
  • Preserve the feature-processing configuration.
  • Verify that the resulting feature matrix is suitable for Isolation Forest training.
Tools: Python + Pandas + NumPy
STEP 09

Train the Isolation Forest Model

  • Configure the Isolation Forest machine-learning algorithm.
  • Provide the processed normal behavioral features to the model.
  • Train the model using the normal request population.
  • Do not directly train the model using the controlled attack request.
  • Generate the initial anomaly scores for the training observations.
  • Review the model output to confirm that the normal behavioral population can be processed successfully.
Tools: Python + Scikit-learn
STEP 10

Establish the Normal Behavioral Baseline

  • Review the Isolation Forest results generated from the normal request data.
  • Determine whether the trained model establishes a usable representation of normal request behavior.
  • Record the model configuration and preprocessing parameters.
  • Preserve the trained model for subsequent API-request analysis.
  • Confirm that the same feature-extraction process will be applied to newly captured requests.
  • Establish the normal behavioral baseline for the controlled experiment.
Tools: Python + Scikit-learn + NumPy
STEP 11

Validate Normal Application API Activity

  • Use the authorized application client to perform legitimate crAPI operations.
  • Capture the corresponding API requests and responses.
  • Extract behavioral features from the legitimate application requests.
  • Provide the processed normal application requests to the trained Isolation Forest model.
  • Review the generated anomaly scores.
  • Confirm that normal application activity can be processed through the complete detection pipeline.
Tools: OWASP crAPI + cURL + OWASP ZAP + Python + Scikit-learn
STEP 12

Perform the Controlled API Authorization Attack

  • Configure Kali Linux as the authorized security-testing client.
  • Authenticate to the local crAPI application using the controlled laboratory account.
  • Identify an API request containing an object identifier.
  • Modify the object identifier within the controlled request.
  • Send the modified request to the local application.
  • Observe the API response generated by the application.
  • Preserve the attack request as controlled security-testing evidence.
Tools: Kali Linux + cURL + OWASP ZAP + OWASP crAPI
STEP 13

Capture and Validate the Attack Request

  • Capture the complete API request generated during the controlled attack.
  • Record the HTTP method, URI, parameters, object identifier, and available response information.
  • Review the captured request to confirm that it represents the intended unauthorized object-access attempt.
  • Compare the attack request structure with the legitimate request structure.
  • Preserve the captured API traffic for machine-learning analysis.
  • Confirm that the attack remains restricted to the authorized laboratory environment.
Tools: OWASP ZAP + cURL + OWASP crAPI
STEP 14

Extract Behavioral Features from the Attack Request

  • Process the captured attack request using the same preprocessing procedure used for the training data.
  • Extract the corresponding behavioral characteristics.
  • Convert the captured request characteristics into the numerical feature representation required by the trained model.
  • Maintain the same feature order and transformation process.
  • Verify that the attack-request feature vector is compatible with the trained Isolation Forest model.
  • Preserve the resulting feature representation for anomaly analysis.
Tools: Python + Pandas + NumPy
STEP 15

Perform Isolation Forest Analysis

  • Provide the processed attack-request feature representation to the trained Isolation Forest model.
  • Generate the anomaly prediction for the new API request.
  • Calculate the corresponding anomaly score.
  • Compare the result with the behavioral results observed from normal requests.
  • Identify whether the attack request is isolated from the learned normal behavioral population.
  • Record the model output as detection evidence.
Tools: Python + Scikit-learn
STEP 16

Validate the Behavioral Anomaly Detection Result

  • Review the Isolation Forest anomaly result.
  • Compare the detected anomaly with the captured API authorization attack.
  • Verify whether the anomalous request corresponds to the controlled attack event.
  • Review the request-level features responsible for the behavioral deviation.
  • Determine whether the model detected the attack without being directly trained on that attack request.
  • Preserve the detection and attack-validation evidence.
Tools: Python + Scikit-learn + OWASP ZAP + OWASP crAPI
STEP 17

Analyze and Correlate the Security Findings

  • Review the initial normal API behavior.
  • Review the controlled attack request.
  • Review the corresponding feature representations.
  • Review the Isolation Forest anomaly score and prediction.
  • Compare normal and anomalous behavioral characteristics.
  • Confirm the relationship between the observed behavioral deviation and the controlled API attack.
  • Document the technical findings and detection limitations.
Tools: Python + Pandas + Scikit-learn + OWASP crAPI
STEP 18

Perform Final Behavioral Detection Validation and Security Review

  • Repeat the normal API activity analysis where required.
  • Repeat the controlled API attack using the authorized laboratory environment.
  • Compare the normal and attack-request behavioral characteristics.
  • Compare the Isolation Forest results for normal and attack traffic.
  • Review the captured API evidence and security-testing results.
  • Review the complete preprocessing and feature-extraction workflow.
  • Record the final anomaly-detection results.
  • Document residual detection limitations and potential false-positive conditions.
  • Record recommended improvements for future behavioral-analysis experiments.
  • Finalize the behavioral anomaly-detection security assessment.
Tools: Python + Scikit-learn + OWASP ZAP + cURL + OWASP crAPI + Nmap

Outcome

An OWASP crAPI API environment is successfully deployed in an isolated laboratory environment for controlled behavioral anomaly-detection research.

The application API services are identified and validated using controlled network-service discovery, establishing the initial API testing surface within the authorized laboratory.

Existing public web/API request data is processed without manually creating a training dataset, providing the normal behavioral information required for the machine-learning experiment.

Normal request characteristics are transformed into numerical behavioral features, creating a consistent representation suitable for Isolation Forest analysis.

The Isolation Forest model is trained using normal request behavior and establishes a behavioral baseline without directly training on the controlled attack used for validation.

Normal API activity generated through the OWASP crAPI application is captured and processed using the same feature-extraction workflow, validating the consistency of the detection pipeline.

A controlled Broken Object Level Authorization attack is performed against the local API environment, generating an unauthorized object-access request for security validation.

The attack request is captured, transformed into behavioral features, and analyzed by the trained Isolation Forest model to determine whether its behavior differs from the learned normal request population.

The detected anomaly is correlated with the controlled attack evidence, providing a practical evaluation of behavioral anomaly detection for API activity that was not directly represented in the normal-behavior training process.

The complete workflow of public request-data processing, normal behavior learning, Isolation Forest training, API service testing, controlled attack execution, request capture, behavioral feature extraction, anomaly detection, attack correlation, and final security validation is successfully demonstrated.