Back to skill

Security audit

Anomalib Detector

Security checks for vulnerabilities and agentic risk

Overview

This appears to be a legitimate industrial image anomaly detector, but it needs review because one single-image path can process other images in the same folder and upload/result handling is under-specified.

Install only in an isolated environment and process images from per-request or dedicated directories, not folders that contain unrelated sensitive images. Pin and lock dependencies before production use, and require clear controls for uploaded image storage, result URLs, access control, retention, and deletion.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
SKILL.md:217
Finding

Single-Image Detection Processes the Entire Parent Directory

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:217
Vulnerability Type: Excessive local file access and incorrect dataset scoping
Risk Level: Medium

Vulnerable Code

python
# Create prediction dataset
predict_ds = PredictDataset(
    path=os.path.dirname(image_path),
    image_size=(256, 256)
)

# Execute prediction
predictions = self.engine.predict(model=self.model, dataset=predict_ds)

Technical Analysis

The detect() method is documented as processing one image, but it passes the image's parent directory to PredictDataset. The anomalib dataset loader can therefore enumerate and process every supported image in that directory rather than only the requested file.

The method subsequently selects predictions[0] without verifying that the prediction belongs to image_path. This creates two related security and correctness problems:

  1. The operation reads unrelated local images beyond the minimum access necessary for the requested task.
  2. A prediction for another file may be attributed to the requested image.

This does not bypass operating-system file permissions: the process can only read files available to its existing account. Nevertheless, it violates least-privilege scoping within the application.

Attack Path

  1. An attacker or untrusted user causes a target image to be stored in a directory containing other sensitive, adversarial, or numerous image files.
  2. The application invokes detect() with the path of only the target image.
  3. os.path.dirname(image_path) resolves to the containing directory.
  4. PredictDataset enumerates and loads supported images throughout that directory.
  5. The inference engine processes files that were not explicitly requested.
  6. The implementation takes predictions[0], which may correspond to an unrelated file, and returns that result while recording the requested path.

Impact Assessment

The flaw can expose unrelated ...[truncated 523 chars]

Remediation
View remediation

Remediation Suggestions

Pass the validated image file directly to PredictDataset instead of its parent directory:

python
requested_path = Path(image_path).resolve(strict=True)

if not requested_path.is_file():
    raise ValueError("The supplied path must identify a regular file")

predict_ds = PredictDataset(
    path=str(requested_path),
    image_size=(256, 256),
)

Apply the following additional controls:

  1. Restrict accepted files to explicitly supported image extensions and verify the decoded format.
  2. If uploads are involved, copy each image into an isolated per-request directory before processing.
  3. Reject symbolic links when they are not required.
  4. Verify that the returned prediction path resolves to the requested canonical path.
  5. Require exactly one prediction for single-image operations and fail closed otherwise.
  6. Enforce file-size, pixel-count, and inference-time limits to reduce denial-of-service risk.

T08 · Insecure Dependencies

Note
Location
requirements.txt:5
Finding

Runtime Dependencies Are Installed Without Reproducible Version and Integrity Pinning

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:5-25; also reflected in README.md:79-101, SKILL.md:42-54, and skill.json:26-54
Vulnerability Type: Unpinned third-party dependency supply chain
Risk Level: Low

Vulnerable Code

text
# Core library
anomalib>=2.3.0

# Deep Learning Framework
torch>=2.0.0
torchvision>=0.15.0

# Image Processing
opencv-python>=4.8.0
pillow>=10.0.0
scikit-image>=0.21.0
imagecodecs>=2023.1.23

# Numerical Computing
numpy>=1.24.0
scikit-learn>=1.3.0

# Model Components
timm>=0.9.0
kornia>=0.7.0
einops>=0.7.0

# Configuration & Utilities
omegaconf>=2.3.0
hydra-core>=1.3.0
jsonargparse>=4.27.0
rich>=13.0.0
matplotlib>=3.7.0
pandas>=2.0.0

The documentation and manifest also recommend unconstrained installation commands such as:

bash
pip install anomalib
pip install "anomalib[cpu]"
pip install "anomalib[cu130]"
pip install "anomalib[openvino]"
pip install "anomalib[full]"

Technical Analysis

The dependency declarations use lower bounds rather than exact reviewed versions, and no package hashes or lock file are supplied. As a result, two installations performed at different times can resolve to different direct and transitive dependency versions.

Python packages and their installation mechanisms may execute code during installation or import. If a permitted future release or transitive dependency is compromised, the current constraints allow it to enter the environment without a change to this project.

No typo-squatted package, untrusted custom index, or presently malicious dependency was identified. The issue is therefore a supply-chain hardening weakness rather than evidence that the listed packages are malicious.

Attack Path

  1. A direct or transitive dependency publishes a compromised or otherwise unsafe release satisfying the broad lower-bound constraint.
  2. A user follows the document ...[truncated 1142 chars]
Remediation
View remediation

Remediation Suggestions

  1. Generate a reviewed lock file containing exact versions for all direct and transitive dependencies.
  2. Require cryptographic hashes during installation, for example through a hash-locked requirements file and pip install --require-hashes.
  3. Replace unconstrained examples such as pip install anomalib with installation through the maintained lock file.
  4. Use an explicitly configured trusted package index or an internally controlled package mirror.
  5. Install only the optional extras required for the target environment instead of recommending the broad full extra by default.
  6. Run dependency vulnerability and provenance checks in CI.
  7. Perform upgrades through a controlled review process that regenerates hashes, executes tests, and scans the resolved dependency graph.
  8. Install dependencies as an unprivileged user in an isolated virtual environment or container.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (35)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The detect method is documented as operating on a single image, but it constructs PredictDataset(path=os.path.dirname(image_path), ...), causing inference to run over every image in the containing directory. In a service that accepts user-supplied image paths or uploaded files, this can unintentionally process unrelated files, expose other users' data in results, and amplify resource consumption beyond the caller's request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The primary skill description and navigation are presented entirely in Chinese, indicating a language-specific experience. The file does not state that the skill is intended only for Chinese-speaking users or offer an alternative language/locale option, which can violate language/locale policy requirements.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

In the workflow diagram, the first inference step says '加载模型 (from checkpoint)', implying inference uses a previously trained or saved model. However, the example code later creates Patchcore() directly and runs engine.predict without loading weights from a checkpoint, which contradicts the documented intent and could mislead users about what model is actually used.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The API documentation describes image upload and heatmap/result URLs but provides no retention, access control, or deletion guidance for uploaded images and generated artifacts. In an industrial inspection context, uploaded images may contain proprietary manufacturing details, and undocumented storage behavior can lead to unintended persistence, insecure sharing, or leakage of sensitive operational data.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This Python file includes its title, docstrings, and user-facing console output in Chinese, indicating a fixed language/locale for interaction. The file does not provide any user opt-in, configuration, or justification that the skill is intended only for a Chinese-speaking or region-specific context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

This code file contains natural-language documentation and console messages in Chinese only, beginning with the module docstring and continuing throughout the examples. Under the policy, forcing a specific language without offering a choice or documenting a justified locale constraint is a violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The entire guide is written in Chinese and does not indicate that language selection is optional or that the document is intended only for a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language instructions and descriptions throughout the skill are presented only in Chinese, which effectively forces a specific language for users. The file does not indicate that users may choose another language or that the locale restriction is intentional and justified.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

The dependency is specified with a lower bound only, which permits installation of any newer release and makes builds non-reproducible. That increases supply-chain risk because a future vulnerable or malicious upstream release could be pulled into the environment without review.

Content

Scanner excerpt · requirements.txt (reported line 5)May include surrounding context.

text
# Python >= 3.9 required

# Core library
anomalib>=2.3.0

# Deep Learning Framework
torch>=2.0.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
99% confidence
Finding

Using torch>=2.0.0 allows arbitrary newer versions to be installed, so the deployed package may vary over time and may include vulnerable releases. In an ML stack, PyTorch is a high-value dependency and version drift can expose the environment to known deserialization or denial-of-service issues if unsafe APIs are later used elsewhere.

Content

Scanner excerpt · requirements.txt (reported line 8)May include surrounding context.

text
anomalib>=2.3.0

# Deep Learning Framework
torch>=2.0.0
torchvision>=0.15.0

# Image Processing

Unverifiable Dependency: torch has 16 known advisory(ies) (CVE-2025-2953 (PyTorch susceptible to local Denial of Service); CVE-2022-45907 (PyTorch vulnerable to arbitrary code execution); CVE-2025-32434 (PyTorch: `torch.load` with `weights_only=True` leads to remote code execution) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
98% confidence
Finding

The manifest does not pin torch, so it is impossible to determine whether the installed package version is affected by known PyTorch advisories. Given PyTorch's history of issues including unsafe model loading and denial-of-service vectors, this uncertainty is more concerning in an ML skill that is likely to handle models or tensors.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
96% confidence
Finding

The torchvision dependency is not pinned to a specific release, which makes the environment non-deterministic and weakens supply-chain control. A later compromised or vulnerable version could be installed automatically during setup.

Content

Scanner excerpt · requirements.txt (reported line 9)May include surrounding context.

text
# Deep Learning Framework
torch>=2.0.0
torchvision>=0.15.0

# Image Processing
opencv-python>=4.8.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

opencv-python>=4.8.0 permits unreviewed newer releases and prevents reliable verification against known CVEs. Because image parsing libraries often process untrusted input, uncontrolled version selection increases the chance of pulling in exploitable parsing bugs.

Content

Scanner excerpt · requirements.txt (reported line 12)May include surrounding context.

text
torchvision>=0.15.0

# Image Processing
opencv-python>=4.8.0
pillow>=10.0.0
scikit-image>=0.21.0
imagecodecs>=2023.1.23

Unverifiable Dependency: opencv-python has 16 known advisory(ies) (CVE-2017-12864 (Integer Overflow or Wraparound in OpenCV); CVE-2017-12598 (Out-of-bounds Read in OpenCV ); CVE-2019-14493 (NULL Pointer Dereference in OpenCV.) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
97% confidence
Finding

opencv-python has multiple historical CVEs, and without an exact version the deployment cannot be assessed for exposure. In an anomaly-detection/image-processing skill, OpenCV is likely to process attacker-influenced image data, so unverifiable versioning meaningfully increases risk.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
98% confidence
Finding

Pillow is an image parser frequently exposed to attacker-controlled files, and specifying only a minimum version leaves room for vulnerable or otherwise risky future releases. This creates a supply-chain and patch-verification gap rather than an immediate exploit by itself.

Content

Scanner excerpt · requirements.txt (reported line 13)May include surrounding context.

text
# Image Processing
opencv-python>=4.8.0
pillow>=10.0.0
scikit-image>=0.21.0
imagecodecs>=2023.1.23

Unverifiable Dependency: pillow has 16 known advisory(ies) (CVE-2016-2533 (Pillow buffer overflow in ImagingPcdDecode); CVE-2023-50447 (Arbitrary Code Execution in Pillow); CVE-2021-27922 (Pillow Uncontrolled Resource Consumption) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
98% confidence
Finding

Pillow is commonly exposed to untrusted image content and has had advisories affecting parsing and resource handling. Because the requirements file does not pin an exact version, there is no reliable way to know whether a vulnerable release will be installed in this image-processing skill.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

scikit-image is unpinned, so different installations may resolve to different versions with differing security and behavior characteristics. In data- and image-processing workflows, reproducibility and controlled upgrades are important to reduce supply-chain exposure.

Content

Scanner excerpt · requirements.txt (reported line 14)May include surrounding context.

text
# Image Processing
opencv-python>=4.8.0
pillow>=10.0.0
scikit-image>=0.21.0
imagecodecs>=2023.1.23

# Numerical Computing

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
97% confidence
Finding

imagecodecs handles complex binary formats and is specified only with a lower bound, which prevents certainty about whether the installed version includes bundled vulnerable libraries. That uncertainty increases supply-chain risk, especially for image ingestion pipelines.

Content

Scanner excerpt · requirements.txt (reported line 15)May include surrounding context.

text
opencv-python>=4.8.0
pillow>=10.0.0
scikit-image>=0.21.0
imagecodecs>=2023.1.23

# Numerical Computing
numpy>=1.24.0

Unverifiable Dependency: imagecodecs has 2 known advisory(ies) (GHSA-94vc-p8w7-5p49 (Bundled libwebp in imagecodecs vulnerable); PYSEC-2023-174 (imagecodecs versions before v2023.9.18 bundled libwebp binaries in wheels that a)), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
96% confidence
Finding

imagecodecs has known advisories involving bundled libraries, and the current lower-bound requirement does not prove a safe version will be used. Since this skill is intended for industrial anomaly detection and likely decodes image data, unverifiable codec versions increase the chance of exploitable parsing exposure.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

numpy>=1.24.0 allows unbounded future resolution and reduces build reproducibility. While NumPy is foundational, the issue here is mainly dependency hygiene and inability to verify exact exposure to known flaws.

Content

Scanner excerpt · requirements.txt (reported line 18)May include surrounding context.

text
imagecodecs>=2023.1.23

# Numerical Computing
numpy>=1.24.0
scikit-learn>=1.3.0

# Model Components

Unverifiable Dependency: numpy has 16 known advisory(ies) (CVE-2014-1859 (Numpy arbitrary file write via symlink attack); CVE-2021-41495 (NumPy NULL Pointer Dereference); CVE-2021-33430 (NumPy Buffer Overflow (Disputed)) +13 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
94% confidence
Finding

NumPy has historical advisories, but the main issue here is that the lack of version pinning prevents verification of actual exposure. In this file alone there is no direct evidence of dangerous NumPy usage, so the impact remains limited to supply-chain uncertainty.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
95% confidence
Finding

scikit-learn is not pinned, so a different version may be installed over time without explicit approval. This creates uncertainty around both behavior and whether known vulnerabilities are present or fixed.

Content

Scanner excerpt · requirements.txt (reported line 19)May include surrounding context.

text
# Numerical Computing
numpy>=1.24.0
scikit-learn>=1.3.0

# Model Components
timm>=0.9.0

Unverifiable Dependency: scikit-learn has 6 known advisory(ies) (GHSA-jjw5-xxj6-pcv5; GHSA-jw8x-6495-233v; GHSA-jxfp-4rvq-9h9m +3 more), but the manifest does not pin a version, so it is unknown whether the installed release is affected

Low
Category
Supply Chain
Confidence
94% confidence
Finding

scikit-learn has known advisories, and the unpinned manifest means the installed version could be vulnerable without visibility. The file provides no direct usage context that elevates this beyond dependency-management risk.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The timm package is unpinned, making installations non-reproducible and allowing silent uptake of future releases. That weakens supply-chain integrity even if no package-specific exploit is evident from this file alone.

Content

Scanner excerpt · requirements.txt (reported line 22)May include surrounding context.

text
scikit-learn>=1.3.0

# Model Components
timm>=0.9.0
kornia>=0.7.0
einops>=0.7.0

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

kornia is declared with a minimum version only, so future environments may install different code than originally tested. This is a supply-chain hardening issue rather than evidence of active malicious behavior.

Content

Scanner excerpt · requirements.txt (reported line 23)May include surrounding context.

text
# Model Components
timm>=0.9.0
kornia>=0.7.0
einops>=0.7.0

# Configuration & Utilities