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

Isolation Forest-Based Detection of Typosquatting Attacks in OWASP Juice Shop Dependencies Through Package Metadata Anomaly Analysis

Description

Modern web applications depend on third-party software packages to provide application functionality, manage dependencies, and support development. OWASP Juice Shop is an existing open-source web application built using JavaScript technologies and relies on npm packages for its application dependencies.

Typosquatting is a software supply-chain attack in which an attacker uses a package name that closely resembles a legitimate package name. A developer or application may select the unintended package because of a naming mistake, misleading package identity, or an incorrect dependency reference. If the unintended package contains malicious functionality, it may introduce a security risk into the application.

Package metadata provides information such as package names, versions, maintainers, publication dates, dependency declarations, and other available attributes. Examining these characteristics can help identify unusual package records that require further security review.

In this use case, Isolation Forest is used to identify anomalous package metadata associated with potential typosquatting risks in the npm dependency ecosystem. An existing public software-package security dataset is used as the primary data source for model development and evaluation. The dataset is inspected to determine whether it contains suitable package metadata and reliable reference information for the intended analysis.

OWASP Juice Shop is deployed in an isolated VirtualBox laboratory using Ubuntu Linux. Kali Linux provides the controlled security-testing environment. The application's existing npm dependencies are inspected, and a controlled typosquatting scenario is created using a private test registry or simulated package metadata. The test does not require publishing a confusing package to the public npm registry or executing malicious code.

The Isolation Forest model learns the characteristics represented by the selected package metadata and identifies records that deviate from the learned distribution. Its results are correlated with package-name similarity, package identity, registry source, and dependency-resolution evidence to evaluate whether the observed anomaly is consistent with a typosquatting scenario.

The complete workflow is:
Existing Public Package-Security Dataset
→
Dataset Inspection
→
Package Metadata Preprocessing
→
Feature Extraction
→
Isolation Forest Training
→
Model Evaluation
→
OWASP Juice Shop Dependency Inspection
→
Controlled Typosquatting Simulation
→
Package Metadata Collection
→
Anomaly Detection
→
Package Identity Verification
→
Dependency-Resolution Analysis
→
Suspicious Package Flagging
→
Security Review
→
Final Validation

Existing Security Problem

Application: OWASP Juice Shop

OWASP Juice Shop is the existing web application used in this use case. It uses JavaScript technologies and npm dependencies to provide its application functionality.

The application is deployed within an isolated laboratory environment. Its dependency manifest and lockfile provide information about the packages used by the application, while npm configuration and dependency-resolution records can help establish where packages are obtained.

OWASP Juice Shop is the target application for examining dependency metadata and validating the proposed detection workflow. The attack scenario is restricted to controlled test dependencies and package metadata.

Existing Problem :

JavaScript applications commonly rely on third-party npm packages. Selecting the correct package name and package source is important because an unintended dependency can introduce software supply-chain risk.

In a typosquatting attack, a package name is deliberately made similar to a legitimate package name. A developer may accidentally select the similarly named package, or a dependency reference may point to an unintended package.

Package metadata may contain useful indicators of unusual activity, but no single metadata attribute reliably establishes that a package is malicious. A recently published package, for example, is not necessarily suspicious, and an unusual package name does not independently prove typosquatting.

Traditional dependency review may focus on known vulnerabilities, exact package names, or predefined rules. Such checks may not identify every suspicious package, particularly when the package does not have a known vulnerability or the naming difference has not been explicitly recorded.

The security problem is:
OWASP Juice Shop
→
Third-Party npm Dependencies
→
Package Names and Metadata
→
Potentially Similar Package Names
→
Unintended Package Selection Risk
→
Potential Dependency-Confusion or Typosquatting Exposure
→
Package Metadata Requires Investigation
→
Anomaly Detection and Package Identity Verification Required

The proposed solution uses Isolation Forest to identify unusual package metadata and combines its output with package identity and dependency-resolution evidence. The resulting findings are reviewed to determine whether the controlled scenario demonstrates typosquatting-related risk.

Attack

Specific Attack: Typosquatting Attack Against npm Dependencies

The controlled attack scenario evaluates whether a package with a name resembling a legitimate dependency can be identified as a potential supply-chain risk during dependency inspection.

OWASP Juice Shop is deployed as the existing target application. Its dependency manifest and lockfile are inspected to identify a suitable package for the controlled test.

A test package name is created by introducing a small naming variation to a selected legitimate package name. The test is performed using a private laboratory registry or simulated package metadata. The test package is not published to the public npm registry, and malicious code is not executed.

The controlled scenario examines whether the package metadata and dependency-resolution evidence can be collected and evaluated by the proposed detection workflow.

Isolation Forest analyzes the prepared metadata features and identifies records that deviate from the learned package population. The anomaly result is then correlated with the original package name, the test package name, the package source, and the dependency-resolution information.

The objective is to determine whether the detection workflow identifies the controlled suspicious package record and provides sufficient evidence for security review. An anomaly prediction alone is not treated as proof of a successful attack.

Attack Behavior :
OWASP Juice Shop Dependency Inspection
→
Legitimate Package Identification
→
Controlled Package-Name Variation
→
Laboratory Test Package Metadata Preparation
→
Private Test Registry or Simulated Metadata
→
Controlled Dependency-Resolution Test
→
Package Metadata Collection
→
Feature Extraction
→
Isolation Forest Analysis
→
Anomalous Package Identification
→
Package Identity and Source Verification
→
Controlled Attack Validation

Security Concept

Isolation Forest-Based Package Metadata Anomaly Detection for Typosquatting Investigation

The primary security concept is package metadata anomaly detection combined with controlled software supply-chain security testing. The objective is to identify unusual package records that may require investigation for typosquatting-related risks.

The first objective is to process an existing public software-package security dataset and identify metadata attributes suitable for the analysis. Relevant features may include package-name characteristics, version information, publication timestamps, maintainer-related attributes, dependency information, and other fields supported by the selected dataset.

The second objective is to train Isolation Forest using the selected package metadata. The model identifies observations that are relatively easy to isolate from the learned data distribution. These anomalies are treated as candidates for review rather than automatically classified as confirmed malicious packages.

The third objective is to evaluate the trained model using suitable held-out data and a controlled typosquatting scenario involving OWASP Juice Shop dependencies. The anomaly results are compared with package-name similarity, package identity, registry source, and dependency-resolution evidence to determine whether the controlled test is correctly identified.

The assessment follows:
Existing Public Package-Security Dataset
→
Dataset Suitability Assessment
→
Package Metadata Selection
→
Data Preprocessing
→
Package Feature Extraction
→
Isolation Forest Training
→
Held-Out Model Evaluation
→
OWASP Juice Shop Dependency Inspection
→
Controlled Typosquatting Simulation
→
Package Metadata Analysis
→
Anomaly Score Generation
→
Package Identity Verification
→
Suspicious Package Flagging
→
Security Review and Validation

Defensive Mechanism

The security concept defines the overall security strategy.

The following are the specific defensive mechanisms implemented.

Package Metadata Collection :

Package metadata is collected from the existing public dataset and the controlled OWASP Juice Shop dependency-testing environment.

Purpose: Establish the package information required for anomaly analysis and validation.

Package Metadata Preprocessing

Selected metadata fields are cleaned, standardized, and transformed into a consistent feature representation.

Purpose
  • Prepare compatible numerical inputs for Isolation Forest analysis.

Isolation Forest Anomaly Detection

Isolation Forest evaluates the processed package metadata and generates anomaly predictions and scores.

Purpose
  • Identify unusual package records that require further security investigation.

Package-Name Similarity Analysis

The names of suspicious package records are compared with known legitimate package names.

Purpose
  • Identify naming similarities associated with the controlled typosquatting scenario.

Package Identity and Source Verification

Package names, registry sources, versions, and available package identity information are examined.

Purpose
  • Determine whether the selected package corresponds to the expected dependency and source.

Dependency-Resolution Verification

The dependency-resolution results are examined to determine which package source and package identity the application would use in the controlled environment.

Purpose
  • Validate whether the intended dependency or the controlled test package is selected.

Suspicious Package Risk Flagging

Package records identified as anomalous and supported by additional suspicious indicators are flagged for security review.

Purpose
  • Highlight potentially risky package records before an installation decision.

Pre-Installation Security Review

Package metadata, model results, and dependency-resolution evidence are reviewed before accepting the package.

Purpose
  • Support a security decision before a suspicious package is installed.

Model Performance Evaluation

Isolation Forest results are evaluated using suitable held-out records and known controlled test cases.

Purpose
  • Measure anomaly-detection behavior and identify false-positive and missed-anomaly conditions.

Controlled Laboratory Isolation

The attack simulation is performed using a private test registry or simulated package metadata.

Purpose
  • Validate the detection workflow without publishing confusing packages to the public registry or executing malicious code.

Security Tools

Primary Target Application: OWASP Juice Shop

OWASP Juice Shop is the existing JavaScript web application used to examine npm dependencies and validate the controlled security scenario.

Purpose
  • Provide an existing application with npm dependencies.
  • Supply dependency manifests and lockfile information for inspection.
  • Support controlled dependency-resolution testing.
  • Provide the application context for the security assessment.

Package Management Tool: Node.js and npm

Node.js and npm provide the JavaScript runtime and package-management functionality required to inspect dependencies.

Purpose
  • Inspect the application's package manifest and lockfile.
  • Examine dependency declarations and package versions.
  • Validate package-resolution behavior in the laboratory.
  • Support controlled testing of package metadata and dependency sources.

Machine-Learning Algorithm: Isolation Forest

Isolation Forest is the primary machine-learning algorithm used for package metadata anomaly detection.

Purpose
  • Learn the distribution of selected package metadata features.
  • Generate anomaly predictions and scores.
  • Identify unusual package records for further investigation.
  • Support evaluation of the controlled typosquatting scenario.

Machine-Learning Library: Scikit-learn

Scikit-learn provides the Isolation Forest implementation and supporting evaluation utilities.

Purpose
  • Configure and train the anomaly-detection model.
  • Generate anomaly predictions and scores.
  • Apply consistent model settings during evaluation.
  • Support reproducible analysis.

Programming and Automation Tool: Python

Python provides the main implementation environment for data processing and anomaly analysis.

Purpose
  • Process package metadata.
  • Extract and transform features.
  • Integrate Isolation Forest with the test workflow.
  • Generate and record analysis results.

Data Processing Tool: Pandas

Pandas is used to organize the public dataset and collected package metadata.

Purpose
  • Load and inspect package records.
  • Clean and transform metadata fields.
  • Organize model input features.
  • Associate predictions with original package records.

Numerical Processing Tool: NumPy

NumPy supports numerical transformations and feature-array preparation.

Purpose
  • Prepare numerical feature representations.
  • Support metadata transformations.
  • Provide compatible data structures for model processing.

Source-Code Management Tool: Git

Git is used to obtain and inspect the existing OWASP Juice Shop source repository.

Purpose
  • Retrieve the existing application source code.
  • Inspect dependency-related files.
  • Preserve the original application configuration.
  • Track controlled changes made for the laboratory test.

Security Testing Platform: Kali Linux

Kali Linux provides the controlled security-testing environment.

Purpose
  • Support authorized laboratory testing.
  • Prepare controlled typosquatting test inputs.
  • Examine package-related security evidence.
  • Validate the test scenario.

Application and Analysis Environment: Ubuntu Linux

Ubuntu Linux hosts the application and machine-learning workflow according to the laboratory configuration.

Purpose
  • Run OWASP Juice Shop.
  • Execute Python-based package analysis.
  • Support npm dependency inspection.
  • Store the collected test evidence.

Virtualization Platform: VirtualBox

VirtualBox provides the isolated virtual-machine environment.

Purpose
  • Host the Ubuntu and Kali Linux virtual machines.
  • Separate the application and security-testing environments.
  • Support repeatable controlled experiments.
  • Reduce the risk of unintended interaction with external systems.

Evidence Storage Tool: SQLite

SQLite stores relevant package records, anomaly results, and validation evidence.

Purpose
  • Store package metadata and model predictions.
  • Record controlled test results.
  • Preserve package identity and source-verification findings.
  • Support repeatable analysis.

Process

STEP 01

Prepare the Isolated Laboratory Environment

  • Create the laboratory using VirtualBox
  • Configure Ubuntu Linux as the application and machine-learning environment
  • Configure Kali Linux as the controlled security-testing environment.
  • Establish the intended laboratory network connectivity.
  • Verify that the application and testing environments can communicate as required.
  • Confirm that all testing is restricted to the authorized laboratory.
Tools: VirtualBox + Ubuntu Linux + Kali Linux
STEP 02

Obtain the Existing OWASP Juice Shop Application

  • Obtain the official OWASP Juice Shop source repository using Git.
  • Inspect the repository structure and identify the existing npm dependency files.
  • Preserve the original source code and dependency configuration.
  • Follow the application's documented setup requirements.
  • Verify that the selected application version can be deployed in the laboratory.
  • Record the application version used for the experiment.
Tools: Git + OWASP Juice Shop + Ubuntu Linux
STEP 03

Deploy and Validate OWASP Juice Shop

  • Prepare the application environment according to the documented deployment requirements.
  • Install the required dependencies in the controlled environment.
  • Start the application using its documented procedure.
  • Verify that the application operates normally.
  • Confirm that its dependency manifest and lockfile are available for analysis.
  • Preserve the initial application state before conducting the controlled test.
Tools: OWASP Juice Shop + Node.js + npm + Ubuntu Linux
STEP 04

Inspect the Existing npm Dependencies

  • Inspect the application's package manifest and lockfile
  • Identify the declared direct and transitive dependencies.
  • Record available package names, versions, dependency relationships, and resolved package sources.
  • Determine which metadata fields are available for the selected application version.
  • Preserve the original dependency information for comparison with the controlled test.
  • Do not modify production dependencies or introduce unverified packages during this inspection.
Tools: Node.js + npm + Python + Pandas
STEP 05

Obtain the Existing Public Package-Security Dataset

  • Identify an existing public software-package security dataset suitable for package metadata analysis.
  • Review the dataset documentation, data structure, usage permissions, and available fields.
  • Determine whether the dataset contains the metadata required for the proposed anomaly-detection experiment.
  • Check whether the dataset includes sufficient information about package names, versions, publication information, dependency attributes, or other suitable features.
  • Determine whether known typosquatting examples or suitable reference records are available for evaluation.
  • If the selected dataset does not support the intended validation task, choose a more suitable source or narrow the research objective.
  • Preserve the original dataset and its documentation.
Tools: Python + Pandas + Ubuntu Linux
STEP 06

Inspect and Preprocess the Dataset

  • Load the selected dataset into the Python environment.
  • Inspect the available package metadata fields.
  • Identify missing, malformed, duplicated, or inconsistent records.
  • Standardize suitable metadata fields while preserving their meaning.
  • Retain original package names and identifiers so that anomalous records can be investigated later.
  • Keep the original dataset separate from the processed working data.
  • Record the preprocessing configuration used for the experiment.
Tools: Python + Pandas + NumPy
STEP 07

Select Suitable Package Metadata Features

  • Identify the metadata attributes suitable for anomaly detection.
  • Depending on the selected dataset, features may include package publication recency, version counts, release intervals, dependency counts, maintainer-related attributes, package-name characteristics, or other available information.
  • Select only fields supported by the actual dataset.
  • Transform suitable categorical and numerical fields into an appropriate feature representation.
  • Avoid using the target or reference label as an input feature.
  • Preserve the relationship between the generated features and the original package records.
Tools: Python + Pandas + NumPy + Scikit-learn
STEP 08

Prepare the Model Training and Evaluation Data

  • Separate the available records into appropriate training and evaluation portions.
  • Determine whether the selected records provide a suitable representation of the package population against which anomalies should be identified.
  • Where practical, prevent duplicate or closely related package records from appearing across partitions in ways that could distort evaluation.
  • Preserve known reference labels or controlled test identifiers separately from the model input.
  • Record the number of usable records and the distribution of available metadata.
  • Confirm that the prepared data is compatible with Isolation Forest.
Tools: Python + Pandas + Scikit-learn
STEP 09

Configure the Isolation Forest Model

  • Configure Isolation Forest using the prepared package metadata features.
  • Select the model parameters according to the size and characteristics of the available dataset.
  • Determine a suitable contamination setting or decision threshold based on the experimental design and validation results.
  • Avoid assuming that a fixed anomaly percentage represents the true proportion of malicious packages.
  • Record the selected configuration for reproducibility.
  • Verify that the model can process the prepared feature matrix.
Tools: Python + Scikit-learn + NumPy
STEP 10

Train the Isolation Forest Model

  • Provide the selected package metadata features to Isolation Forest.
  • Fit the model using the designated training records.
  • Generate initial anomaly scores for the available observations.
  • Inspect the resulting predictions and score distribution.
  • Preserve the trained model and its preprocessing configuration.
  • Confirm that the training process completes successfully.
Tools: Python + Scikit-learn
STEP 11

Evaluate the Initial Anomaly-Detection Results

  • Provide the held-out metadata records to the trained model.
  • Generate anomaly predictions and scores.
  • Inspect the records identified as anomalous.
  • Compare the predictions with available reference labels or verified package information where appropriate.
  • Evaluate false-positive and missed-anomaly conditions using suitable known test records.
  • If reliable typosquatting labels are unavailable, report anomaly-detection results without claiming a validated typosquatting classification accuracy.
  • Preserve the evaluation results for later comparison with the controlled scenario.
Tools: Python + Scikit-learn + Pandas
STEP 12

Prepare the Controlled Typosquatting Scenario

  • Select a legitimate npm package name from the existing OWASP Juice Shop dependency information.
  • Create a controlled test package name containing a small variation of the legitimate name.
  • Use a private laboratory registry or simulated package metadata to represent the test package.
  • Do not publish the test package to the public npm registry.
  • Do not include malicious code or execute the test package as part of the detection experiment.
  • Record the original package name, test name, and intended test condition as ground-truth information.
Tools: Python + Node.js + npm + Ubuntu Linux
STEP 13

Introduce the Controlled Test Metadata

  • Prepare the controlled package metadata in the private test registry or simulated dataset
  • Ensure that the test record contains the fields required by the analysis workflow
  • Preserve the legitimate package metadata separately for comparison.
  • Verify that the test package name and source information represent the intended naming-confusion scenario.
  • Keep the scenario isolated from the public npm registry.
  • Record the test configuration and relevant metadata.
Tools: Node.js + npm + Python + Ubuntu Linux
STEP 14

Perform the Controlled Dependency-Resolution Test

  • Use the isolated OWASP Juice Shop testing environment to examine how the controlled package metadata relates to dependency selection.
  • Inspect the declared dependency name and the configured package source.
  • Use the private test registry or simulated metadata to evaluate the intended package-resolution scenario.
  • Record which package identity and source the controlled configuration selects.
  • Verify the observed result independently of the Isolation Forest prediction.
  • Keep the original application dependency configuration available for comparison and restoration.
Tools: OWASP Juice Shop + Node.js + npm + Ubuntu Linux
STEP 15

Collect and Preprocess the Controlled Package Metadata

  • Collect the metadata associated with the legitimate package and the controlled test package.
  • Extract the same supported fields used by the training feature pipeline.
  • Apply the established preprocessing and transformation procedures.
  • Reuse the fitted preprocessing configuration wherever applicable.
  • Preserve the original package names and source information for contextual verification.
  • Verify that the generated feature representation is compatible with the trained model.
Tools: Python + Pandas + NumPy + Scikit-learn
STEP 16

Perform Isolation Forest Anomaly Analysis

  • Load the trained Isolation Forest model.
  • Provide the prepared controlled package metadata to the model.
  • Generate anomaly predictions and scores.
  • Record the results for the legitimate package and the controlled test package.
  • Compare the anomaly results with the metadata differences observed in the test scenario.
  • Do not treat an anomaly prediction alone as proof of typosquatting.
  • Preserve the results and associated package identifiers for subsequent validation.
Tools: Python + Scikit-learn + Pandas
STEP 17

Correlate Anomaly Results with Package Identity Evidence

  • Review the package records flagged as anomalous.
  • Compare their names with the corresponding legitimate package names.
  • Inspect the package source, registry identity, version information, and dependency-resolution evidence.
  • Determine whether the controlled test package was identified as intended and whether the available evidence supports a typosquatting concern.
  • Review false positives and missed detections.
  • Document cases where package metadata alone is insufficient to determine the actual security risk.
Tools: Python + Pandas + npm + SQLite
STEP 18

Perform Final Detection Validation and Security Review

  • Repeat the analysis using legitimate package metadata and the controlled typosquatting test records.
  • Review the Isolation Forest anomaly scores and predictions.
  • Compare the results with the known controlled test conditions.
  • Verify package identities and dependency-resolution outcomes.
  • Document correct anomaly identification, false positives, missed anomalies, and data limitations.
  • Restore the original OWASP Juice Shop dependency configuration after the controlled test.
  • Preserve the final evaluation evidence and summarize the limitations of the approach.
  • Finalize the package metadata anomaly-detection assessment.
Tools: OWASP Juice Shop + Node.js + npm + Python + Scikit-learn + Pandas + SQLite + VirtualBox

Outcome

OWASP Juice Shop is deployed in an isolated laboratory as the existing JavaScript application used for dependency-security analysis.

An existing public software-package security dataset is inspected and processed to determine its suitability for package metadata anomaly detection.

Relevant package metadata is transformed into numerical features suitable for Isolation Forest analysis.

The Isolation Forest model is trained and evaluated using the selected package metadata records.

A controlled typosquatting scenario is prepared using a private test registry or simulated package metadata without publishing confusing packages to the public npm registry.

The dependency-resolution test provides evidence about the relationship between the legitimate package name, the controlled test package, and the selected package source.

The trained model generates anomaly predictions and scores for the controlled package metadata.

Anomaly results are correlated with package-name similarity, package identity, registry source, and dependency-resolution evidence to assess the controlled typosquatting scenario

The experiment documents false positives, missed anomalies, and limitations arising from the dataset, metadata features, and availability of reliable reference information.

The complete workflow demonstrates how Isolation Forest-based package metadata anomaly detection can support typosquatting investigation in OWASP Juice Shop dependencies, while keeping final security decisions dependent on verified package identity and dependency-resolution evidence.