Back to skill

Security audit

Mouse Colony Planner

Security checks for vulnerabilities and agentic risk

Overview

This is a simple local mouse-colony planning calculator with some dependency and input-validation issues, but no evidence of hidden access, data theft, persistence, or destructive behavior.

Install and run this only in a normal isolated Python environment. Prefer removing the requirements.txt entries or pinning any truly needed dependencies, and treat calculated costs and timelines as estimates because invalid numeric inputs are not safely rejected.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Unnecessary and Unpinned Third-Party Dependencies

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-2 and SKILL.md:103-108
Vulnerability Type: Supply-chain exposure through unpinned dependencies
Risk Level: Medium

Vulnerable Code

requirements.txt:1-2:

text
dataclasses
enum

SKILL.md:103-108:

bash
# Python dependencies
pip install -r requirements.txt

Technical Analysis

The installation instructions direct users to retrieve dataclasses and enum from the configured Python package index without version constraints or integrity hashes. The application imports these modules at scripts/main.py:12-14, but both are provided by the standard library in the apparent supported Python environment.

Unpinned package names allow dependency resolution to change over time. If a package release, package-index account, configured mirror, or dependency-resolution source is compromised, installation may retrieve attacker-controlled content. A malicious source distribution can execute code during its build or installation process, while malicious installed modules can execute when imported by the application.

Because these dependencies appear unnecessary on a modern Python version, they create supply-chain attack surface without providing corresponding functionality.

Attack Path

  1. A user follows the documented prerequisite and runs pip install -r requirements.txt.
  2. pip resolves the unpinned dataclasses and enum names using the user's configured package index or mirror.
  3. An attacker who has compromised an upstream release, package account, or configured mirror supplies a malicious package version.
  4. Attacker-controlled code executes during package build or installation, or later when the module is imported.
  5. The payload operates with the permissions of the user or automation account running pip or the application.

Exploitation requires compromise or malicious control of a package source or resolved ...[truncated 568 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove both entries from requirements.txt when using a supported Python version because dataclasses and enum are standard-library modules.
  2. Document the minimum supported Python version explicitly, for example Python 3.8 or later.
  3. If legacy compatibility genuinely requires a backport, use an environment marker so it is installed only on affected Python versions.
  4. Pin every required external dependency to an approved version and verify it with hashes, for example by using pip install --require-hashes.
  5. Generate locked dependencies through a controlled process and scan them for known vulnerabilities.
  6. Use a trusted package index and prevent fallback to unapproved public or internal mirrors.
  7. Install dependencies inside an isolated, least-privileged virtual environment or build container.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/main.py:119
Finding

Missing Numeric Input Validation Causes Division by Zero and Invalid Plans

Content
View full analysis

Vulnerability Details

File Location: scripts/main.py:119-160 and scripts/main.py:283-323
Vulnerability Type: Unvalidated numeric input and local denial of service
Risk Level: Medium

Vulnerable Code

scripts/main.py:119-160:

python
# Ensure sufficient mice
breeding_pairs = min(
    initial_females,
    initial_males,
    breeding_pairs_needed
)

# Phase 1: Acclimation (3-7 days)
adapt_duration = 7
adapt_cages = math.ceil((initial_females + initial_males) / cage_capacity)
phases.append(Phase(
    name="Acclimation",
    duration_days=adapt_duration,
    cages_needed=adapt_cages,
    description="New mice acclimate to environment, health observation"
))

# Phase 2: Breeding (gestation + lactation)
# One litter time = gestation + weaning = 21 + 21 = 42 days
breed_duration = breeding_params.gestation_days + breeding_params.weaning_days
breed_cages = math.ceil((breeding_pairs * 2 + breeding_pairs * breeding_params.litter_size) / cage_capacity)

# May need multiple litters
litters_needed = math.ceil(breeding_pairs_needed / breeding_pairs)
actual_breed_duration = breed_duration * litters_needed

phases.append(Phase(
    name="Breeding Phase",
    duration_days=actual_breed_duration,
    cages_needed=max(breed_cages, adapt_cages),
    description=f"Mating, gestation, delivery, lactation (estimated {litters_needed} litters)"
))

# Phase 3: Post-weaning housing
wean_duration = 21  # Post-weaning to genotyping/separation

if scheme == BreedingScheme.CONDITIONAL:
    # Conditional knockout requires additional step
    wean_duration += breeding_params.sexual_maturity_days  # Need to reach sexual maturity before mating

    # Second phase breeding cages
    cond_breed_cages = math.ceil(target_pups / cage_capacity)

Representative CLI declarations at scripts/main.py:283-323 accept arbitrary integers and floating-point values without range checks:

pytho
...[truncated 3004 chars]
Remediation
View remediation

Remediation Suggestions

  1. Define reusable argparse converters that reject invalid ranges:
    • Require females, males, target_pups, and cage_capacity to be positive integers.
    • Require gestation, weaning, and sexual-maturity durations to be positive integers.
    • Require costs to be finite, nonnegative floating-point values.
  2. Repeat all critical validation at the start of calculate_breeding_plan so imported callers cannot bypass CLI checks.
  3. Validate that genotype ratios and litter size produce a positive pups_per_pair before division.
  4. Explicitly reject configurations with no available breeding pair and return a clear domain-specific error.
  5. Catch expected validation errors in main, print a concise message to standard error, and return a nonzero exit status without exposing a traceback.
  6. Add tests for zero, negative, extremely large, NaN, and infinite inputs, including direct calls to calculate_breeding_plan.
  7. Consider safe upper bounds for animal counts and durations to prevent excessive integer calculations or unrealistic output.
Vulnerability Patterns
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (2)

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
60% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

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

text
dataclasses
enum

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
60% confidence
Finding

Dependencies lack version pinning, allowing potential malicious package updates. Consider pinning versions.

Content

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

text
dataclasses
enum

Static analysis

No suspicious patterns detected.