Back to skill

Security audit

Cold Chain Risk Calculator

Security checks for vulnerabilities and agentic risk

Overview

This is a simple local cold-chain risk calculator with a real input-validation weakness, but no evidence of hidden access, persistence, exfiltration, or unsafe privilege use.

Before installing, treat this as a draft calculator rather than an authoritative logistics or compliance decision tool. Use only realistic positive durations, and be aware that the documentation mentions file input/output more broadly than the current script implements.

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

Note
Location
scripts/main.py:10
Finding
Negative Transport Duration Produces a Misleading Low-Risk Assessment<![CDATA[ ## Vulnerability Details **File Location**: `scripts/main.py`, lines 10–31 **Vulnerability Type**: Insufficient numeric input validation **Risk Level**: Low ### Vulnerable Code ```python def calculate_risk(route, duration_hours, packaging): """Calculate cold chain risk.""" # Simplified risk calculation base_risk = duration_hours * 0.5 packaging_factor = {"dry-ice": 0.8, "liquid-nitrogen": 0.3, "gel-packs": 1.2} risk = base_risk * packaging_factor.get(packaging, 1.0) print(f"Route: {route}") print(f"Duration: {duration_hours} hours") print(f"Packaging: {packaging}") print(f"Risk score: {risk:.2f}") if risk < 10: return "Low risk" elif risk < 20: return "Medium risk" else: return "High risk" ``` ```python parser.add_argument("--duration", "-d", type=int, required=True, help="Duration in hours") ``` ### Technical Analysis The `--duration` argument is converted to an integer, but no minimum-value constraint is enforced. Consequently, zero and negative durations are accepted and used directly in the risk calculation. Because the calculated base risk is `duration_hours * 0.5`, a negative duration produces a negative risk score. Any negative score satisfies the `risk < 10` condition and is therefore classified as `"Low risk"`. This is an input-validation and business-logic integrity flaw. It does not permit arbitrary code execution or privilege escalation, but it can cause the tool to produce an invalid and potentially unsafe operational assessment. ### Attack Path 1. Invoke the calculator with a negative duration: ```bash python scripts/main.py --route "NYC-Boston" --duration -100 --packaging dry-ice ``` 2. The argument parser accepts `-100` because it is a syntactically valid integer. 3. The calculator computes: - Base risk: `-100 * 0.5 = -50` - Packaging-adjusted risk: `-50 * 0.8 = -40` 4. Since `-40` is less than `10`, the application reports `"Low ...[truncated 682 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Implement an argparse type validator that rejects non-positive durations before risk calculation: ```python def positive_int(value): try: parsed = int(value) except ValueError as exc: raise argparse.ArgumentTypeError("Duration must be an integer") from exc if parsed <= 0: raise argparse.ArgumentTypeError("Duration must be greater than zero") return parsed parser.add_argument( "--duration", "-d", type=positive_int, required=True, help="Duration in hours; must be greater than zero", ) ``` Apply defense in depth by also validating `duration_hours` inside `calculate_risk`, so direct callers cannot bypass command-line validation: ```python if duration_hours <= 0: raise ValueError("Duration must be greater than zero") ``` Add automated tests covering negative values, zero, the minimum accepted duration, unusually large values, and non-integer input. If the domain has a realistic maximum transport duration, enforce and document that upper bound as well. ]]>
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
Findings (1)

Missing User Warnings

Low
Confidence
86% confidence
Finding
For markdown files, missing-warning findings apply when the description omits user-facing warnings about behaviors that can affect user data or system integrity. Here, the document notes file system access and output files in the risk table, but it does not present this as an explicit user warning in the usage or overview sections.

Static analysis

No suspicious patterns detected.