Back to skill

Security audit

golang-security

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Go security-review skill, with disclosed tooling and audit behavior, but users should note its mutable tool installs and a few imperfect documentation examples.

Install this for Go security review or secure-coding help when you are comfortable with it reading and potentially editing Go code, running Go/git/security-scanner commands, and using agents for larger audits. In stricter environments, pin govulncheck and gosec versions or use an internal module mirror, and review generated fixes and examples before applying them.

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:17
Finding

Unpinned Executable Security Tool Dependencies

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 17, 40, 131, and 135
Vulnerability Type: Supply-chain risk from mutable dependency versions
Risk Level: Medium

Vulnerable Code

yaml
install:
  - kind: go
    package: golang.org/x/vuln/cmd/govulncheck@latest
    bins: [govulncheck]
markdown
- govulncheck: `go install golang.org/x/vuln/cmd/govulncheck@latest`
bash
go get -tool github.com/securego/gosec/v2/cmd/gosec@latest
go get -tool golang.org/x/vuln/cmd/govulncheck@latest

Technical Analysis

The Skill directs users or an automation harness to retrieve executable Go tools using the mutable @latest version selector. Consequently, the code installed during a future invocation may differ from the code reviewed during this audit.

The named module paths are consistent with the Skill's declared Go security-auditing purpose, and no evidence shows that they are currently malicious. Nevertheless, using mutable versions weakens reproducibility and supply-chain controls. If an upstream repository, maintainer account, release process, or resolved dependency were compromised, following these instructions could build and execute altered code.

This behavior requires network access and local execution, but those capabilities are functionally relevant to installing and running security scanners. The issue is therefore unsafe dependency acquisition rather than an inherently unnecessary privilege request.

Attack Path

  1. An attacker compromises an upstream tool release, maintainer account, module source, or dependency in its build graph.
  2. The attacker publishes a version that becomes the target resolved by @latest.
  3. A user or automation harness loads the Skill and follows its installation instructions.
  4. The Go toolchain downloads and builds the mutable release.
  5. The resulting executable runs during a repository scan with the invoking user's permissions.
  6. Malicious code could access source files and other ...[truncated 883 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace every @latest selector with a reviewed, explicit semantic version, for example:

    yaml
    package: golang.org/x/vuln/cmd/govulncheck@vX.Y.Z
    
    bash
    go get -tool github.com/securego/gosec/v2/cmd/gosec@vX.Y.Z
    go get -tool golang.org/x/vuln/cmd/govulncheck@vX.Y.Z
    
  2. Keep the declared installer and documentation commands synchronized so all installation paths resolve to the same approved versions.

  3. Update pinned versions through a controlled review process that examines release notes, source changes, maintainership changes, and known vulnerabilities.

  4. Retain and verify Go module checksums through go.sum where the surrounding project supports tool dependencies.

  5. In higher-assurance environments, fetch dependencies through an approved module proxy or internal artifact mirror and verify release provenance.

  6. Run downloaded scanners with minimum necessary privileges in a restricted environment without unrelated secrets, unnecessary write access, or unrestricted outbound networking.

Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (16)

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · evals/evals.json (reported line 423)May include surrounding context.

json
{"id": "31.2", "text": "Uses ssh.FixedHostKey, ssh.HostKeyCallback with known_hosts, or a custom verification function"},
        {"id": "31.3", "text": "Loads the private key from the file path provided"},
        {"id": "31.4", "text": "Handles errors from SSH connection and command execution"},
        {"id": "31.5", "text": "If using known_hosts, loads them from a file (e.g., ~/.ssh/known_hosts)"}
      ]
    },
    {

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/filesystem.md (reported line 17)May include surrounding context.

md
## Directory Traversal — High

Paths like `../../etc/passwd` access files outside intended directory.

**Bad:**

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/injection.md (reported line 172)May include surrounding context.

Bad:

go
cmd := exec.Command("sh", "-c", "rm -f /tmp/"+filename) // DON'T

Good:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/secrets.md (reported line 158)May include surrounding context.

text
# Secrets
.env
.env.local
.env.*.local
*.key

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/secrets.md (reported line 159)May include surrounding context.

text
# Secrets
.env
.env.local
.env.*.local
*.key
*.pem

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill description is very broad and includes generic triggers like writing, reviewing, or auditing Go code and working on risky code involving I/O, user input, authentication, or crypto. In an agentic system, this can cause the security skill to activate for many ordinary Go tasks, increasing prompt surface area, tool access exposure, and the chance that security guidance or orchestration behavior is injected into contexts where it is unnecessary.

Content

No source excerpt is available for this finding.

Unbounded Resource Access

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill allows unbounded resource consumption (API calls, storage, compute). Without rate limits or quotas, a compromised or misbehaving agent can cause denial-of-service or cost overruns.

Content

Scanner excerpt · evals/evals.json (reported line 78)May include surrounding context.

json
"name": "exec-context-user-timeout",
      "description": "Tests that user-controlled timeout values cannot be used to bypass command execution cancellation",
      "prompt": "Write a Go HTTP handler that runs a user-supplied shell script fragment with a configurable timeout. The timeout (in seconds) comes from the 'timeout' query parameter. Use exec.CommandContext to enforce it.",
      "trap": "Model might parse the timeout from query string and pass it directly to time.Duration or context.WithTimeout. An attacker can set timeout=0 (immediate cancellation before process starts, making the feature useless) or timeout=99999 (effectively unlimited, enabling DoS). The model must clamp the timeout to a safe range AND still use separate argument passing to avoid injection.",
      "assertions": [
        {"id": "6.1", "text": "Clamps the user-supplied timeout to a maximum safe value (e.g., no more than 30 or 60 seconds)"},
        {"id": "6.2", "text": "Enforces a minimum timeout that is greater than zero to prevent immediate cancellation abuse"},

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · evals/evals.json (reported line 389)May include surrounding context.

json
"name": "file-permissions-secret",
      "description": "Tests restrictive file permissions for sensitive data",
      "prompt": "Write a Go function that saves a TLS private key to disk after generating it. The key should be written in PEM format to a file specified by the caller.",
      "trap": "Model might use os.Create (0644 default) or os.WriteFile with 0644 permissions, making the private key world-readable",
      "assertions": [
        {"id": "29.1", "text": "Uses file permissions 0600 or more restrictive (owner read/write only)"},
        {"id": "29.2", "text": "Does NOT use 0644, 0666, or any permission allowing group/world read"},

Unbounded Output

Medium
Category
Output Handling
Confidence
75% confidence
Finding

Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Content

Scanner excerpt · references/filesystem.md (reported line 128)May include surrounding context.

go
gr, _ := gzip.NewReader(f)
out, _ := os.Create(dst)
io.Copy(out, gr) // DON'T: No size limits

Good:

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · references/filesystem.md (reported line 189)May include surrounding context.

Bad:

go
f, _ := os.OpenFile("config.json", os.O_CREATE, 0644) // DON'T: World-readable

Good:

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · references/filesystem.md (reported line 207)May include surrounding context.

Bad:

go
os.MkdirAll("/var/myapp/cache", 0777) // DON'T: World-writable

Good:

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
70% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · references/filesystem.md (reported line 225)May include surrounding context.

Bad:

go
os.MkdirAll("/var/myapp/cache", 0777) // DON'T: World-writable

Good:

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Content

Scanner excerpt · references/injection.md (reported line 3)May include surrounding context.

md
# Injection Security Rules

Injection vulnerabilities allow attackers to execute arbitrary code, queries, or commands.

**Rules:**

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
99% confidence
Finding

This is a true issue in the documentation: the purported 'Good' example for template safety validates user but then checks an unrelated variable role and executes t.Execute(w, data), where data is not shown as validated. In a security skill, an incorrect secure example can mislead users into implementing ineffective protections and leave template injection or unsafe rendering risks in real code.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document sets a strict rule that unsafe must not be used in application code, but later presents a Good overlap-checking example that imports and uses unsafe. In a security best-practices skill, contradictory guidance is dangerous because readers may copy the sample as endorsed secure practice, normalizing unsafe pointer arithmetic and undermining the stated memory-safety rule.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
79% confidence
Finding

The statement "Go's race detector is your primary defense" presents guidance in a single language-specific context with no indication that this file is intentionally scoped only to Go users. Under the policy for natural-language constraints, prescriptive language should be clearly justified or scoped so it does not implicitly force one environment without opt-in.

Content

No source excerpt is available for this finding.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
references/secrets.md:20