Back to skill

Security audit

Environment Secrets Rotator

Security checks for vulnerabilities and agentic risk

Overview

The skill does rotate local .env secrets as advertised, but it also automatically saves newly generated secret values in plaintext history in the user's home directory despite describing history as optional.

Review before installing or using this with real credentials. It is purpose-built for local secret rotation, but use dry-run first, avoid running it in logged CI or shared agent sessions, and delete or protect ~/.env-rotation-history.json if any real secrets were rotated. Prefer changing the tool so history is opt-in and metadata-only before using it for production secrets.

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

Error
Location
scripts/main.py:180
Finding

Automatic Plaintext Retention and Disclosure of Rotated Secrets

Content
View full analysis

Vulnerability Details

File Location: scripts/main.py:180-191, scripts/main.py:257-304, and scripts/main.py:436
Vulnerability Type: Plaintext sensitive-data storage and disclosure
Risk Level: High

Vulnerable Code

python
# Record history
if not dry_run:
    self._record_history(filepath, keys_to_rotate, new_values)

result = {
    "status": "success",
    "file": filepath,
    "rotated_keys": keys_to_rotate,
    "new_values": new_values,
    "backup": backup_path,
    "vault_commands": vault_commands,
    "dry_run": dry_run,
    "target_file": target_file if output_file else filepath
}
python
def _record_history(self, filepath: str, keys: List[str], new_values: Dict[str, str]):
    """Record rotation history (optional)."""
    try:
        history = []
        if self.history_file.exists():
            with open(self.history_file) as f:
                history = json.load(f)

        entry = {
            "timestamp": datetime.now(timezone.utc).isoformat(),
            "file": filepath,
            "keys": keys,
            "new_values": new_values
        }

        history.append(entry)
        # Keep only last 100 entries
        if len(history) > 100:
            history = history[-100:]

        with open(self.history_file, 'w') as f:
            json.dump(history, f, indent=2)

    except Exception:
        # History recording is optional, don't fail on error
        pass
python
def get_history(self, filepath: Optional[str] = None, key: Optional[str] = None) -> Dict[str, Any]:
    """Get rotation history."""
    try:
        if not self.history_file.exists():
            return {"status": "success", "history": [], "count": 0}

        with open(self.history_file) as f:
            history = json.load(f)

        # Filter by file and/or key
        filtered = []
        for entry in history:
            i
...[truncated 3494 chars]
Remediation
View remediation

Remediation Suggestions

  1. Disable rotation history by default and require an explicit option such as --enable-history before retaining metadata.
  2. Never store secret values in history. Retain only non-sensitive metadata such as timestamps, normalized file identifiers, rotated key names, and operation status.
  3. If a metadata file is required, create it atomically with owner-only permissions (0600) and verify existing file ownership and permissions before reading or writing it.
  4. Remove new_values from normal JSON output. Return key names and operation status instead.
  5. Do not include secret-bearing Vault commands in default output. Provide templates, accept secrets through protected standard input, or require a dedicated explicit reveal option.
  6. If plaintext display remains available, present a clear warning and require affirmative user action. Document that the output must not be used in logged CI or Agent environments.
  7. Ensure the history command cannot return legacy plaintext values. Provide a migration or cleanup procedure that securely removes existing new_values fields from ~/.env-rotation-history.json.
  8. Add automated tests confirming that default rotations neither persist nor print generated secret values.
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (40)

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 · README.md (reported line 3)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · README.md (reported line 8)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · README.md (reported line 9)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · README.md (reported line 15)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · README.md (reported line 25)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · README.md (reported line 35)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · README.md (reported line 45)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 17)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 20)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 26)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 33)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 38)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 43)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 59)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 73)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 74)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 126)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 128)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 136)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 138)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · SKILL.md (reported line 143)May include surrounding context.

md
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · scripts/main.py (reported line 16)May include surrounding context.

python
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · scripts/main.py (reported line 20)May include surrounding context.

python
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · scripts/main.py (reported line 44)May include surrounding context.

python
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start

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 · scripts/main.py (reported line 50)May include surrounding context.

python
# Environment Secrets Rotator

A CLI tool to rotate secrets in .env files and generate Vault commands for secret rotation workflows.

## Quick Start