Back to skill

Security audit

golang-spf13-cobra

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Go/Cobra development guide with ordinary coding permissions, though users should pin third-party Go tool versions before running examples.

Before installing or following generated commands, prefer pinned Go module/tool versions, review `go.mod` and `go.sum` changes, and run scaffolding tools in normal project directories without unnecessary elevated privileges.

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

Warning
Location
SKILL.md:43
Finding

Unpinned Third-Party Dependencies and Executable Tool Retrieval

Content
View full analysis

Vulnerability Details

File Locations:

  • SKILL.md:43-45
  • references/generators.md:7-9
  • references/generators.md:53-59

Vulnerability Type: Unpinned third-party dependency and executable tool retrieval
Risk Level: Medium

Vulnerable Code

SKILL.md:43-45:

bash
go get github.com/spf13/cobra@latest

references/generators.md:7-9:

bash
go get github.com/spf13/cobra/doc

references/generators.md:53-59:

bash
go get -tool github.com/spf13/cobra-cli@latest

# Initialize a new cobra project
go tool cobra-cli init myapp

Technical Analysis

The skill recommends retrieving dependencies and an executable scaffolding tool without pinning them to reviewed versions. The @latest selector is mutable, meaning the content installed when a user follows the instructions can differ from the content available when the skill was audited. The unversioned cobra/doc retrieval can also resolve or update dependencies according to the module state at execution time.

The risk is greater for cobra-cli because the downloaded component is subsequently executed through go tool cobra-cli init myapp. This gives newly retrieved third-party code an opportunity to create or modify files within the invoking user's accessible project and filesystem scope.

The package paths reference the expected upstream organization, and the audited files contain no evidence that the current upstream packages are malicious. The vulnerability is therefore an unsafe and non-reproducible dependency acquisition practice rather than evidence of an active malicious payload.

Attack Path

  1. A user or agent follows the skill and runs a command containing @latest, or retrieves the unversioned cobra/doc package.
  2. Go resolves the dependency version available at that time rather than a version reviewed during this audit.
  3. An upstream account compromise, malicious future release, compromised modu ...[truncated 1215 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace mutable dependency selectors with reviewed, explicit semantic versions:

    bash
    go get github.com/spf13/cobra@vX.Y.Z
    go get github.com/spf13/cobra/doc@vX.Y.Z
    go get -tool github.com/spf13/cobra-cli@vX.Y.Z
    
  2. Replace vX.Y.Z with a specific version that has been reviewed and tested by the project maintainers.

  3. Commit and review go.mod and go.sum so dependency changes are visible and integrity hashes are retained.

  4. Perform dependency upgrades through controlled pull requests rather than resolving @latest during routine skill execution.

  5. Review release notes, source changes, provenance, and known vulnerability information before updating pinned versions.

  6. Execute scaffolding tools in a restricted development environment with no unnecessary credentials or elevated permissions.

  7. Review generated files and module changes before committing or building them in trusted release environments.

  8. Where practical, use an approved internal module proxy or artifact mirror that only exposes vetted versions.

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.