Back to skill

Security audit

Tenqua OpticalQuantumSkill

Security checks for vulnerabilities and agentic risk

Overview

This skill is a local optical-kernel simulator with no evidence of hidden access, persistence, network use, or destructive behavior, though its input limits are weaker than its documentation claims.

Installing this skill is reasonable for local experimentation, but avoid feeding it very large, empty, NaN, or infinity-containing vectors until input bounds are fixed; it should not be exposed as a public API without request limits and timeouts.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/optical_kernel.py:82
Finding
Unbounded Input Vector Processing Enables Resource Exhaustion## Vulnerability Details **File Location**: `scripts/optical_kernel.py`, lines 82-96 and 130-131 **Vulnerability Type**: Missing input-size and finite-number validation **Risk Level**: Medium ### Vulnerable Code ```python # Validation if len(vec_a) != len(vec_b): raise ValueError("Vectors must have same dimension") # To simulate kernel K(a, b) = |<a|b>|^2, we can encode 'a' in mode 0 and 'b' in mode 1 # BUT, physically, we usually prepare two separate states and interfere them. # Here, we will map scalars to phases in a 2-mode system for a single feature dimension demo, # OR map vectors to temporal modes. # Simplest for this demo skill: # Encode scalar x in mode 0 phase, scalar y in mode 1 phase. # Interfere on BS. Detect output. # If x == y, constructive/destructive interference happens predictably. # Let's perform element-wise kernel estimation for vectors kernel_sum = 0 for i in range(len(vec_a)): ``` ```python vec_a = [float(x) for x in args.vector_a.split(",")] vec_b = [float(x) for x in args.vector_b.split(",")] ``` ### Technical Analysis The simulator advertises an eight-mode resource limit, but that limit does not constrain the length of vectors accepted by `compute_kernel()`. The function verifies only that both vectors have equal lengths and then performs one simulation for every element. A new two-mode `OpticalQuantumSimulator` is created during every iteration, so its `num_modes > 8` check always passes. Consequently, the documented mode limit does not bound the total amount of work. Runtime scales linearly with attacker-controlled vector length and includes repeated NumPy allocations and matrix operations. The parser also accepts values recognized by Python's `float()` as `nan`, `inf`, or `-inf`. These values can propagate through complex exponentiation and matrix calculations, producing invalid or misleading kernel results. Empty vectors are not explicitly rejecte ...[truncated 1937 chars]
Remediation
## Remediation Suggestions 1. Define and enforce a maximum vector length before entering the simulation loop. Apply the check inside `compute_kernel()` so programmatic callers cannot bypass it. ```python MAX_VECTOR_LENGTH = 8 if len(vec_a) != len(vec_b): raise ValueError("Vectors must have the same dimension") if not vec_a: raise ValueError("Vectors must not be empty") if len(vec_a) > MAX_VECTOR_LENGTH: raise ValueError( f"Vector dimension exceeds the limit of {MAX_VECTOR_LENGTH}" ) ``` 2. Reject non-finite values after parsing and again at the public function boundary: ```python arr_a = np.asarray(vec_a, dtype=float) arr_b = np.asarray(vec_b, dtype=float) if not np.all(np.isfinite(arr_a)) or not np.all(np.isfinite(arr_b)): raise ValueError("Vectors must contain only finite numeric values") ``` 3. If the simulator is exposed through an API, independently enforce request-body size limits, execution timeouts, concurrency limits, and per-client rate limits. 4. Ensure documentation accurately distinguishes the number of optical modes from the maximum accepted vector dimension. 5. Add tests covering oversized vectors, empty vectors, unequal vector lengths, `NaN`, positive and negative infinity, and input values near the configured maximum.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep

Static analysis

No suspicious patterns detected.