Back to skill

Security audit

Foc Parameter Identifier

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent FOC motor-parameter guide, but it gives actionable live-motor and controller code instructions without enough safety boundaries for real hardware.

Install only if you are comfortable treating it as an engineering reference, not a complete automated identification tool. Before using any live-motor procedure or generated FOC code, add your own bench safety checklist: secure the motor and load, set conservative current/voltage/speed limits, keep clear of rotating parts, handle regenerated voltage, and verify emergency-stop behavior.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T08 · Insecure Dependencies

Note
Location
scripts/foc_param_id_arduino.py:46
Finding

Unpinned Third-Party Dependency Installation Guidance

Content
View full analysis

Vulnerability Details

File Location: scripts/foc_param_id_arduino.py, line 46
Vulnerability Type: T08: Insecure Dependencies
Risk Level: Low

Vulnerable installation command:

bash
pip install scipy

Technical Analysis

When SciPy is unavailable, the script displays an instruction to install the package without specifying a reviewed version, cryptographic hashes, or a trusted package index. Dependency resolution is therefore not reproducible and may select a future or otherwise unexpected release.

The package name itself is legitimate, and the script does not automatically execute the installation command. Exploitation consequently depends on a user following the guidance in an environment where the package index, package source, DNS resolution, or pip configuration is attacker-controlled, or where a selected upstream release has been compromised.

Attack Path

  1. A user runs functionality that requires SciPy in an environment where SciPy is unavailable.
  2. The script presents the unpinned pip install scipy instruction.
  3. The user executes the command.
  4. Pip resolves the dependency through the user's configured package indexes without a required version or hash.
  5. An attacker who controls or influences that dependency source supplies a malicious or compromised distribution.
  6. Package installation code or imported package code executes with the privileges of the user running pip or the analysis script.

Impact Assessment

A malicious dependency could execute arbitrary code with the installing user's privileges. Depending on those privileges and the environment, this could permit access to user-readable files, modification of the Python environment, theft of credentials available to that user, or further local compromise.

The practical risk is limited because no automatic installation occurs, the named package is the legitimate scipy package rather than an apparent typosquat, ...[truncated 92 chars]

Remediation
View remediation

Remediation Suggestions

  • Declare a reviewed, exact SciPy version in a dependency manifest, such as requirements.txt.
  • Generate and verify cryptographic hashes for SciPy and all transitive dependencies.
  • Install dependencies with hash enforcement:
    bash
    python -m pip install --require-hashes -r requirements.txt
    
  • Document the approved package index and reject unintended extra indexes:
    bash
    python -m pip install --index-url https://pypi.org/simple --require-hashes -r requirements.txt
    
  • Recommend installation inside a dedicated virtual environment rather than a privileged or system-wide Python environment.
  • Add automated dependency review and update procedures so pinned versions receive controlled security upgrades.
  • Replace the inline generic installation prompt with a reference to the reviewed dependency manifest.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
89% confidence
Finding

The code is broadly aligned with the FOC parameter identification domain, but the declared description overstates implemented functionality. The script does perform step-response analysis, back-EMF analysis, hall-based pole-pair estimation, and report generation for controller configuration. However, several specifically declared capabilities are absent: there is no rotational inertia J identification, no high-frequency injection implementation, and no DC decay implementation. In addition, although the docstring and CLI suggest processing oscilloscope-exported CSV files, the file-loading/parsing path is only a placeholder that prints 'please implement CSV parsing'. This is a material description-behavior mismatch because multiple named identification methods and one named parameter (J) are not actually supported by the supplied code.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The description promises an assistant for motor parameter measurement and identification, including concrete identification schemes for R, L, Ke, pole pairs, and inertia J. However, the code does not interface with hardware, acquire signals, run test sequences, or implement any estimation algorithms. It merely accepts pre-measured parameters and calculates derived controller-oriented quantities such as Kt, Psi_m, suggested loop bandwidths, voltage headroom, and copper loss, then formats a text report. This is a materially different primary purpose: post-processing and reporting of supplied measurements rather than performing identification. No undeclared sensitive behavior is present, but the declared functionality significantly overstates what the code actually does.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs users to perform back-EMF measurement by manually spinning a motor, potentially at high speed and with open-circuit voltage measurement, but does not include explicit safety warnings about shock, pinch, projectile, or fixture hazards. In a motor-control context, these omissions materially increase the chance of user injury or equipment damage during real-world testing.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The free-deceleration inertia test directs users to run the motor at high speed and abruptly cut drive power without warning about rotating-mass hazards, overvoltage/regeneration into the drive, load detachment, or uncontrolled coast-down behavior. In this skill's context, that omission is dangerous because the instructions are actionable and could be followed directly on bench hardware.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This markdown provides ready-to-use motor-control code that can command torque, current, and rotation on real hardware, but it lacks an explicit safety warning, commissioning checklist, or safe-start guidance. A user could directly apply these examples to a live motor, leading to unexpected motion, overcurrent, or mechanical injury, especially because the skill is specifically about parameter identification and FOC tuning on physical systems.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The module docstring states the script is used to extract motor parameters from oscilloscope-exported CSV data, but both file-handling branches only print messages such as '请实现 CSV 解析' and never load or analyze the specified file. This is an active contradiction between the documented purpose and the implemented behavior, not merely an omitted detail.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

This code file contains natural-language instructions and usage text that force a specific language for all users. Under the policy, locale or language constraints should either be optional, user-selectable, or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The module docstring shows example invocations using --Ke and implies a functional report mode interface for supplying report parameters, but the argument parser never defines --Ke or --L. In report mode the code then checks hasattr(args, 'L') and hasattr(args, 'Ke'), which will always fail, so the documented behavior contradicts what the CLI actually accepts.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
97% confidence
Finding

This code file contains user-facing docstrings, CLI descriptions, prompts, error messages, and report text exclusively in Chinese. Under the policy for natural-language violations, forcing a specific language without user opt-in is reportable unless the locale constraint is explicitly justified, which is not present here.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.