Back to skill

Security audit

COMSOL Simulation

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent COMSOL automation, but it includes diagnostic and repair scripts that can overwrite simulation models without clear confirmation or backup.

Install only if you are comfortable with local COMSOL automation that can run license-consuming solves and modify .mph files. Before using repair, probe, or diagnostic scripts, work on copied models or backups, avoid treating placeholder metric CSVs as validated simulation results, and review any mock-mode or dependency-install commands before allowing them.

Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (18)

Lp3

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding
The skill instructs execution of Python scripts that discover the local COMSOL environment, inspect installed products, install dependencies, read templates/references, and write outputs, which implies shell, environment, file read, and file write capabilities. However, the manifest declares only a Python binary requirement and no explicit permissions/capability declarations, creating a transparency and policy-enforcement gap where an agent or user may authorize a skill without understanding its operational reach.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The script is presented as a direct diagnostic tool, but it actively executes all discovered studies and then persists the model back to the original .mph file. In a simulation skill context, that can trigger expensive or unintended solver runs, mutate project state, and overwrite prior results without explicit user approval, making the behavior materially riskier than read-only inspection.

Intent-Code Divergence

Medium
Confidence
89% confidence
Finding
The docstring claims a harmless, no-config diagnostic role, but the implementation performs state-changing operations by rerunning studies and saving the modified model. This mismatch can mislead users or higher-level agents into invoking the script under the false assumption that it is safe and non-destructive, increasing the chance of accidental misuse.

Description-Behavior Mismatch

Medium
Confidence
94% confidence
Finding
The script advertises extraction of photodetector metrics from COMSOL results, but the implementation largely returns formulas, notes, and placeholder assumptions instead of validated numerical data from the model. In an engineering simulation workflow, this can mislead users into trusting incomplete or fabricated outputs, causing incorrect device evaluation or downstream design decisions.

Intent-Code Divergence

Medium
Confidence
97% confidence
Finding
The CSV export writes literal 'TBD' values for EQE and responsivity while presenting the files as extracted metrics. This is dangerous because automated pipelines or users may ingest these files as authoritative simulation outputs, leading to silent data integrity failures rather than obvious runtime errors.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The main pipeline ignores extracted model data by passing empty dictionaries into metric calculations, causing EQE, responsivity, and detectivity to be derived from defaults and placeholders rather than simulation results. In the COMSOL optoelectronic context, this increases risk because users are likely relying on the script for scientifically meaningful post-processing, so silent substitution of fake values can compromise research or engineering outcomes.

Context-Inappropriate Capability

Medium
Confidence
91% confidence
Finding
The script installs packages from external package sources at runtime using pip, which introduces a supply-chain risk: package compromise, typosquatting, dependency confusion, or unexpected upstream updates could result in execution of untrusted code during installation. In a simulation-focused skill, this capability is broader than the core task and increases the attack surface, especially in environments where network access and package installation are unexpected.

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
The script presents itself as a diagnostic check, but it mutates the COMSOL study configuration, removes an existing solver, re-solves the model, and then saves the modified .mph file back to disk. That mismatch is dangerous because operators may run it expecting read-only troubleshooting, causing unintended persistence of experimental changes and corruption or drift of simulation state.

Context-Inappropriate Capability

Medium
Confidence
98% confidence
Finding
When simulation_type is set to 'mock', the script executes whatever filesystem path is provided by the MOCK_SIM_SCRIPT environment variable, with no trust boundary check, allowlist, or path restriction. In an agent or automation environment, an attacker who can influence environment variables or job configuration can cause arbitrary Python code execution under the agent's privileges.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script unconditionally saves the loaded COMSOL model back to the original .mph file after performing destructive operations such as clear(), build(), and solve(). In an automation skill for simulation workflows, this can overwrite the user's source model with partial, unintended, or corrupted state without confirmation, making data loss and integrity issues realistically exploitable through routine use.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The script saves the loaded COMSOL model back to the same path after making diagnostic changes, but it does not require explicit user confirmation, create a backup, or default to a separate output file. In a simulation workflow this can silently overwrite authoritative model state, causing integrity loss, non-reproducible results, or destruction of carefully prepared configurations.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The script automatically changes geometry settings to use union and later reruns the first detected study, which alters simulation behavior without an explicit approval step. In this skill context, automatic mutation of model physics/geometry is especially risky because small changes can materially affect device behavior, solver convergence, and scientific validity while appearing as a routine diagnostic operation.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
Saving the model back to the same file without any confirmation, backup, or alternate output path creates an unsafe overwrite condition. In this skill's COMSOL context, the save may persist solver side effects, altered datasets, or other model-state changes, causing silent loss of reproducibility or corruption of an important simulation artifact.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
The script unconditionally saves back to the same .mph file after modifying studies, solvers, and results, which can destroy prior model state or validated solver configurations without any confirmation, backup, or transactional safeguard. In this skill context, the script is explicitly designed to rewrite simulation settings, so accidental data loss or corruption of a user's working model is a realistic operational risk even if it is not a code-execution issue.

Missing User Warnings

Medium
Confidence
92% confidence
Finding
This script deletes solver state (`sol1`), attempts a rebuild/re-solve, and then saves back to the same `.mph` file in place without any confirmation, backup, or transactional safeguard. In a simulation skill, that can irreversibly alter or corrupt a user's model configuration and results, especially if the solve only partially succeeds or produces invalid outputs after the equilibrium changes.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
This script makes destructive, in-place changes to an existing COMSOL model, saves them back to the same .mph file, removes and recreates solver/init features, and attempts a re-solve without any confirmation, backup, or isolation. In the context of an automation skill, this is dangerous because simply running a diagnostic/probe script can permanently alter simulation state, corrupt reproducibility, or destroy user work products if pointed at a valuable model.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The script unconditionally saves the modified COMSOL model back to the original .mph file after deleting and recreating solver configuration, which can permanently overwrite a working model or destroy forensic/debugging state if the reconfiguration is incorrect. In this skill context, the script is specifically designed to manipulate simulation setup files, so silent in-place modification is more dangerous because users are likely to run it on valuable project artifacts and may not expect destructive persistence.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The script loads a COMSOL model, mutates its study and solver configuration, runs a solve, and then saves back to the same .mph path without any confirmation, backup, or use of a separate output file. This can silently destroy prior model state or reproducibility metadata, which is especially risky in an automation skill where users may expect diagnostics or testing to be non-destructive.

Static analysis

Detected: suspicious.dynamic_code_execution

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
scripts/run_optical_simulation.py:55

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
scripts/run_optoelectronic_sim.py:1053

Dynamic code execution detected.

Critical
Code
suspicious.dynamic_code_execution
Location
scripts/run_thermal_coupled_sim.py:274