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

Self-Supervised Detection of Unseen Command Injection Attacks Against OWASP VulnerableApp Using a Denoising Autoencoder

Description

Organizations deploy web applications that accept HTTP parameters through query strings, forms, and other request mechanisms. These parameters may contain normal application values as well as unexpected or malicious input.

Command Injection occurs when attacker-controlled input reaches an operating-system command execution path without sufficient security controls. A successful attack can cause the application to execute commands that were not intended by the application workflow.

In this use case, OWASP VulnerableApp is deployed as a controlled vulnerable web application in an isolated Ubuntu environment. The application provides a deliberate Command Injection vulnerability for security experimentation.

A public HTTP parameter dataset obtained from Kaggle is used as the source of training data. The normal HTTP parameter values are processed and used to train a Denoising Autoencoder through a self-supervised learning approach. The Command Injection samples are not used during normal-model training so that the attack pattern can be evaluated as an unseen behavior.

The Denoising Autoencoder learns the representation of normal HTTP parameter behavior by reconstructing clean input from corrupted input. During testing, HTTP requests generated against the vulnerable application are analyzed by the trained model. Requests that significantly differ from the learned normal behavior produce a higher reconstruction error and can be classified as anomalous.

A controlled Command Injection attack is then performed against the laboratory application. The request is captured and processed using the same feature-preparation pipeline. The AI detection result is correlated with the actual controlled attack evidence to determine whether the unseen attack behavior is detected.

The complete security-validation workflow is:
Public HTTP Parameter Dataset
→
Normal Data Selection
→
Data Preprocessing
→
Self-Supervised Denoising Autoencoder Training
→
Normal Behaviour Learning
→
OWASP VulnerableApp Deployment
→
HTTP Request Monitoring
→
Controlled Command Injection
→
Request Feature Extraction
→
AI Anomaly Analysis
→
Reconstruction Error Calculation
→
Unseen Attack Detection
→
Security Validation
→
Remediation
→
Post-Remediation Testing

Existing Security Problem

Application: OWASP VulnerableApp

OWASP VulnerableApp is used as the deliberately vulnerable application for controlled cybersecurity experimentation. It provides reproducible vulnerability scenarios that can be tested in an isolated laboratory environment.

The application includes a Command Injection vulnerability that allows the security-testing workflow to evaluate whether malicious input can reach a command-execution functionality.

Existing Problem :

A web application that accepts HTTP parameters may receive values that differ significantly from normal application behavior.

Traditional signature-based detection can depend on previously known attack patterns. An attack pattern that is not represented in the detection rules may not be identified effectively.

For a zero-day-style detection experiment, the AI model should therefore learn normal application-input behavior rather than directly learning the specific Command Injection attack during training.

The security problem is:
Web Application
→
HTTP Parameter Input
→
Normal and Malicious Request Behaviour
→
Unknown Command Injection Pattern
→
Traditional Detection Limitation
→
Need for Normal Behaviour Learning
→
AI-Based Anomaly Analysis
→
Unseen Attack Detection
→
Security Validation

The proposed solution introduces a self-supervised learning pipeline in which normal HTTP parameter behavior is learned using a Denoising Autoencoder. A controlled Command Injection attack is excluded from normal training and introduced during testing to evaluate whether the trained model can identify previously unseen malicious behavior.

Attack

Specific Attack: Command Injection Attack

The controlled attack scenario evaluates whether malicious HTTP parameter input can reach the Command Injection functionality of the laboratory application.

The objective is to generate a harmless controlled Command Injection request against OWASP VulnerableApp, capture the resulting HTTP request, process the request through the AI detection pipeline, and determine whether the Denoising Autoencoder identifies the attack as anomalous.

Attack Behavior :
Kali Testing Client
→
OWASP VulnerableApp Discovery
→
Command Injection Endpoint Identification
→
Normal Request Observation
→
Controlled Malicious Parameter Submission
→
Command Injection Request Generated
→
HTTP Request Captured
→
Request Feature Extraction
→
Denoising Autoencoder Analysis
→
Reconstruction Error Calculation
→
Anomalous Behaviour Identification
→
Command Injection Evidence Validation
→
Security Finding
→
Detection Threshold Review
→
Post-Remediation Validation

Security Concept

Self-Supervised AI-Based Anomaly Detection

The primary security concept is self-supervised anomaly detection using a Denoising Autoencoder.

The model is not trained directly with Command Injection labels. Instead, normal HTTP parameter behavior is provided to the model, and the model learns to reconstruct the expected normal representation of the input.

The training process introduces controlled noise into normal data and requires the model to reconstruct the original representation. This allows the model to learn normal characteristics without requiring manually assigned attack labels for every training record.

During security testing, an unseen Command Injection request is processed through the trained model. If the request differs substantially from the learned normal behavior, the reconstruction error increases and the request can be identified as anomalous.

The assessment follows:
Public HTTP Parameter Data
→
Normal Data Selection
→
Feature Preprocessing
→
Noise Injection
→
Denoising Autoencoder Training
→
Normal Behaviour Representation
→
Reconstruction Error Baseline
→
OWASP VulnerableApp Testing
→
Command Injection Request
→
AI Anomaly Analysis
→
Unseen Attack Detection
→
Security Evidence Validation
→
Post-Remediation Testing

Defensive Mechanism

The security concept defines the overall security strategy.

The following are the specific defensive mechanisms implemented.

Normal Behaviour Learning :

The Denoising Autoencoder is trained using normal HTTP parameter behavior so that the model establishes a representation of expected application input.

Purpose: Establish a baseline of legitimate HTTP parameter behavior.

Self-Supervised Model Training

Noise is introduced into normal training data and the model learns to reconstruct the original representation.

Purpose
  • Train the AI model without requiring Command Injection attack labels during normal training.

Feature Preprocessing

HTTP parameter values are converted into a consistent numerical representation before model processing.

Purpose
  • Provide standardized input to the Denoising Autoencoder.

Noise-Based Reconstruction

The training process uses corrupted input and requires reconstruction of the original input.

Purpose
  • Improve the model's ability to learn stable normal input patterns.

Reconstruction Error Analysis

The difference between the original representation and reconstructed representation is calculated.

Purpose
  • Identify HTTP parameter behavior that significantly differs from the learned normal pattern.

Anomaly Threshold

A detection threshold is established from normal validation behavior.

Purpose
  • Separate normal requests from requests exhibiting abnormal behavior.

Unseen Attack Evaluation

Command Injection samples are excluded from normal model training and introduced during testing.

Purpose
  • Evaluate whether the model can identify an attack pattern not used during training.

HTTP Request Monitoring

Requests sent to the laboratory application are captured and analyzed through the AI pipeline.

Purpose
  • Connect application-level security activity with AI-based anomaly detection.

Controlled Attack Validation

A harmless Command Injection test is performed against the deliberately vulnerable application.

Purpose
  • Validate the AI detection result against an actual controlled security event.

Post-Remediation Validation

The same detection and security-testing process is repeated after applying appropriate application-side controls.

Purpose
  • Verify that the attack condition is reduced and that the AI detection workflow continues to identify abnormal behavior.

Security Tools

Primary Vulnerable Application: OWASP VulnerableApp

OWASP VulnerableApp provides the deliberately vulnerable application used for the controlled Command Injection assessment.

Purpose
  • Provide the vulnerable application for controlled security testing.
  • Provide the Command Injection functionality for attack validation.
  • Support pre-remediation and post-remediation security testing.

AI Development Tool: Python

Python is used to implement the data-processing and AI-analysis workflow.

Purpose
  • Process HTTP parameter data for the AI pipeline.
  • Implement the anomaly-detection workflow.
  • Calculate and analyze reconstruction-error results.

AI Model Framework: PyTorch

PyTorch is used to implement and train the Denoising Autoencoder.

Purpose
  • Implement and train the Denoising Autoencoder model.
  • Process normal HTTP parameter data during model training.
  • Generate reconstruction results for anomaly detection.

Dataset Processing Tool: Pandas

Pandas is used to load, filter, and organize the public HTTP parameter dataset.

Purpose
  • Load and process the public dataset.
  • Separate normal and anomalous HTTP parameter records.
  • Prepare structured data for AI model processing.

Numerical Processing Tool: NumPy

NumPy is used for numerical transformations required by the AI pipeline.

Purpose
  • Perform numerical feature transformations.
  • Prepare numerical input for the AI model.
  • Support reconstruction-error calculations.

Dataset Source: Kaggle

Kaggle provides the public HTTP parameter dataset used for the AI experiment.

Purpose
  • Provide an existing public dataset for the experiment.
  • Provide normal and anomalous HTTP parameter records.
  • Supply data for model training and evaluation.

Network Discovery Tool: Nmap

Nmap is used to identify the exposed application service and verify the laboratory attack surface.

Purpose
  • Identify the application service and exposed port.
  • Verify network accessibility from the testing environment.
  • Establish the initial application attack surface.

HTTP Testing Tool: cURL

cURL is used to generate controlled HTTP requests against the laboratory application.

Purpose
  • Send normal HTTP requests to the application.
  • Submit controlled Command Injection test requests.
  • Capture application responses for security validation.

Web Security Testing Tool: OWASP ZAP

OWASP ZAP is used to inspect and validate HTTP communication during the application security assessment.

Purpose
  • Capture and inspect application HTTP requests and responses.
  • Support controlled Command Injection testing.
  • Provide HTTP-level security testing evidence.

Testing Platform: Kali Linux

Kali Linux provides the controlled penetration-testing environment for the security assessment.

Purpose
  • Execute application security-testing activities.
  • Generate controlled attack requests against the laboratory application.
  • Provide the required penetration-testing environment.

Application Platform: Ubuntu Linux

Ubuntu Linux hosts the OWASP VulnerableApp and the AI-processing environment.

Purpose
  • Host the vulnerable application in the laboratory.
  • Provide the environment for AI model processing.
  • Support application-side security validation.

Virtualization Platform: VirtualBox

VirtualBox provides the isolated virtual laboratory environment.

Purpose
  • Isolate the Ubuntu and Kali Linux environments.
  • Support controlled communication between laboratory systems.
  • Provide a reproducible cybersecurity testing environment.

Process

STEP 01

Prepare the Isolated Security Laboratory

  • Configure the Ubuntu virtual machine for the application and AI-processing environment.
  • Configure the Kali Linux virtual machine for controlled security testing.
  • Place both systems inside the isolated VirtualBox laboratory network.
  • Verify that the testing environment is separated from production systems.
  • Confirm network communication between the authorized laboratory systems.
  • Verify that the laboratory application will be accessed only through the intended test interface.
  • Record the initial laboratory configuration.
Tools: VirtualBox + Ubuntu + Kali Linux
STEP 02

Deploy OWASP VulnerableApp

  • Obtain the released OWASP VulnerableApp application package.
  • Start the application using its standalone execution method.
  • Verify that the application starts successfully.
  • Access the application through the local browser interface.
  • Confirm that the application is reachable from the authorized testing environment.
  • Verify that the Command Injection functionality is available for controlled testing.
  • Record the application version and laboratory endpoint.
Tools: OWASP VulnerableApp + Ubuntu + Firefox
STEP 03

Identify the Application Attack Surface

  • Use Nmap from the Kali testing system to identify the exposed application service.
  • Determine the application port.
  • Confirm that the service is reachable from the Kali testing network.
  • Review the available HTTP service.
  • Identify the application interface that will be used for security testing.
  • Record the initial network exposure.
  • Preserve the service-discovery result as testing evidence.
Tools: Nmap + Kali Linux
STEP 04

Obtain the Public HTTP Parameter Dataset

  • Download the public HTTP parameter dataset from Kaggle.
  • Verify that the dataset contains normal and anomalous HTTP parameter values.
  • Inspect the available labels and attack categories.
  • Identify the normal records required for model training.
  • Keep the Command Injection records separate from normal training data.
  • Verify that the dataset is processed programmatically rather than manually recreated.
  • Preserve the original dataset separately from the processed training data.
Tools: Kaggle + Python + Pandas
STEP 05

Prepare the Normal Training Data

  • Load the dataset using Python.
  • Select only the normal HTTP parameter records for normal-behaviour training.
  • Remove attack-category records from the training set.
  • Normalize and transform the parameter values into the representation required by the AI model.
  • Split the normal data into training and validation portions.
  • Ensure that Command Injection examples are not included in the normal training data.
  • Record the preprocessing configuration.
Tools: Python + Pandas + NumPy
STEP 06

Build the Denoising Autoencoder

  • Implement the Denoising Autoencoder using PyTorch.
  • Define the input representation based on the processed HTTP parameter features.
  • Create the encoder component.
  • Create the decoder component.
  • Configure the reconstruction objective.
  • Configure the training parameters.
  • Verify that the model accepts the processed normal data.
  • Preserve the model configuration.
Tools: Python + PyTorch + NumPy
STEP 07

Perform Self-Supervised Model Training

  • Provide normal HTTP parameter data to the training pipeline.
  • Introduce controlled noise into the training representation.
  • Pass the noisy representation through the encoder.
  • Reconstruct the original representation through the decoder.
  • Calculate the reconstruction loss.
  • Update the model parameters based on the reconstruction loss.
  • Repeat the process for the configured training epochs.
  • Record the training and validation loss.
Tools: PyTorch + Python
STEP 08

Establish the Normal Reconstruction Baseline

  • Run the validation normal data through the trained Denoising Autoencoder.
  • Calculate the reconstruction error for each normal record.
  • Analyze the distribution of normal reconstruction errors.
  • Determine an appropriate anomaly threshold from the normal validation behavior.
  • Verify that normal requests generally remain below the threshold.
  • Preserve the baseline results.
  • Record the selected threshold and its justification.
Tools: Python + PyTorch + NumPy
STEP 09

Generate Normal Application Traffic

  • Access the OWASP VulnerableApp through the laboratory browser.
  • Identify the relevant Command Injection functionality.
  • Submit harmless normal values through the application interface.
  • Generate multiple legitimate HTTP requests.
  • Capture the corresponding request and response information.
  • Extract the parameter values required by the AI pipeline.
  • Use the captured normal traffic to verify that the preprocessing pipeline operates correctly.
Tools: Firefox + OWASP VulnerableApp + OWASP ZAP
STEP 10

Perform Controlled Command Injection Testing

  • Use the authorized Kali testing environment.
  • Identify the Command Injection input location in the laboratory application.
  • Submit a harmless controlled Command Injection test payload.
  • Observe the HTTP request generated by the testing activity.
  • Capture the request and response.
  • Verify whether the vulnerable application processes the supplied input.
  • Do not target external systems or perform destructive command execution.
  • Preserve the controlled attack evidence.
Tools: Kali Linux + cURL + OWASP VulnerableApp + OWASP ZAP
STEP 11

Extract Features from the Attack Request

  • Collect the HTTP request generated during the controlled attack.
  • Extract the parameter value used by the application.
  • Apply the same preprocessing method used for the training data.
  • Convert the attack request into the numerical representation required by the model.
  • Ensure that the attack data does not bypass the normal preprocessing pipeline.
  • Submit the processed request to the trained Denoising Autoencoder.
  • Preserve the processed feature representation.
Tools: Python + Pandas + NumPy + OWASP ZAP
STEP 12

Perform AI-Based Anomaly Detection

  • Pass the processed attack request through the trained Denoising Autoencoder.
  • Generate the reconstructed representation.
  • Calculate the reconstruction error.
  • Compare the reconstruction error against the established normal threshold.
  • Determine whether the request is classified as normal or anomalous.
  • Record the AI detection result.
  • Compare the result with the known controlled Command Injection activity.
  • Preserve the model output as security evidence.
Tools: Python + PyTorch + NumPy
STEP 13

Validate the Unseen Attack Detection

  • Review the AI anomaly-detection result.
  • Confirm that Command Injection samples were excluded from normal model training.
  • Compare the attack reconstruction error with the normal reconstruction-error distribution.
  • Determine whether the controlled Command Injection request exceeds the detection threshold.
  • Review the original HTTP request and application response.
  • Correlate the AI result with the actual attack evidence.
  • Identify false-positive or false-negative observations.
  • Record the final detection result.
Tools: Python + PyTorch + OWASP ZAP + cURL
STEP 14

Analyze the Detection Performance

  • Evaluate the model using the reserved validation and attack data.
  • Calculate appropriate anomaly-detection performance measures.
  • Review detection rate and false-positive behavior.
  • Compare normal and anomalous reconstruction-error distributions.
  • Determine whether the selected threshold provides useful separation.
  • Review cases where malicious behavior was not detected.
  • Review cases where normal behavior was incorrectly classified as anomalous.
  • Preserve the experimental results for comparison.
Tools: Python + NumPy + Pandas
STEP 15

Apply Application-Side Security Controls

  • Review the validated Command Injection condition in the laboratory application.
  • Identify the input-processing weakness responsible for command execution.
  • Apply appropriate input validation and command-execution controls within the controlled application environment.
  • Restrict dangerous operating-system command interaction.
  • Rebuild or restart the application after the security control is applied.
  • Verify that legitimate application functionality remains available.
  • Record the implemented security control.
Tools: OWASP VulnerableApp + Python + Ubuntu
STEP 16

Perform Post-Remediation Attack Testing

  • Repeat the original controlled Command Injection test.
  • Submit the same harmless test request against the remediated application.
  • Observe the application response.
  • Verify whether the original command-execution behavior remains possible.
  • Capture the post-remediation HTTP request and response.
  • Run the request through the AI detection pipeline.
  • Compare the result with the original attack assessment.
  • Preserve the post-remediation evidence.
Tools: cURL + OWASP ZAP + OWASP VulnerableApp + Python
STEP 17

Validate Normal Application Behaviour

  • Generate legitimate application requests after remediation.
  • Verify that normal HTTP parameters continue to operate correctly.
  • Process normal requests through the trained AI model.
  • Confirm that legitimate requests remain below the anomaly threshold where expected.
  • Review any false-positive detections.
  • Confirm that the application security control does not unnecessarily disrupt normal functionality.
  • Compare pre-remediation and post-remediation results.
  • Record the final normal-behaviour validation.
Tools: Firefox + OWASP VulnerableApp + Python + PyTorch
STEP 18

Perform Final AI and Security Validation

  • Review the original dataset-processing results.
  • Review the Denoising Autoencoder training results.
  • Review the normal reconstruction-error baseline.
  • Review the controlled Command Injection evidence.
  • Review the AI anomaly-detection results.
  • Compare pre-remediation and post-remediation application behavior.
  • Compare normal and attack reconstruction errors.
  • Document the detection performance and observed limitations.
  • Record the final security findings and recommended improvements.
  • Finalize the complete self-supervised AI-based Command Injection detection assessment.
Tools: Python + PyTorch + OWASP ZAP + cURL + OWASP VulnerableApp + Nmap

Outcome

A deliberately vulnerable OWASP VulnerableApp environment is successfully deployed in an isolated Ubuntu laboratory for controlled Command Injection security testing.

A public HTTP parameter dataset obtained from Kaggle is processed programmatically, with normal HTTP parameter records separated for self-supervised model training and attack records retained for controlled evaluation.

A Denoising Autoencoder is successfully trained using normal HTTP parameter behavior, allowing the model to establish a representation of expected application input patterns without directly training on Command Injection samples.

A reconstruction-error baseline is established from normal validation data, providing the basis for distinguishing expected HTTP parameter behavior from significantly different input behavior.

A controlled Command Injection attack is successfully performed against the laboratory OWASP VulnerableApp environment without targeting external or production systems.

The HTTP request generated during the controlled attack is processed through the same preprocessing and AI-analysis pipeline used for the training and validation data.

The Denoising Autoencoder produces a reconstruction error for the controlled attack request, allowing the attack behavior to be evaluated against the established normal threshold.

The Command Injection detection result is correlated with the actual application request and response evidence, validating whether the AI model can identify an attack pattern that was not used during normal model training.

Post-remediation testing verifies the effect of the implemented application-side security controls while confirming that legitimate application behavior remains functional.

The complete workflow of public-data processing, self-supervised Denoising Autoencoder training, normal-behaviour learning, controlled Command Injection testing, AI anomaly detection, reconstruction-error analysis, security validation, remediation, and post-remediation assessment is successfully demonstrated.