Back to skill

Security audit

Nex Keyring

Security checks for vulnerabilities and agentic risk

Overview

This skill has a coherent local credential-tracking purpose, but it should be reviewed before installation because its installer has an arbitrary-code-execution path flaw and its encryption claims are not backed by the implementation.

Install only after reviewing or fixing setup.sh path handling and the inaccurate encryption claims. Treat the database as plaintext sensitive metadata, avoid scanning production .env files unless necessary, and use explicit file paths rather than broad environment scans.

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 (4)

T09 · Insecure Skill Coding Practices

Error
Location
setup.sh:55
Finding

Installation Path Injection Enables Arbitrary Code Execution

Content
View full analysis
"$BIN_DIR/$SERVICE_NAME" << WRAPPER #!/usr/bin/env bash exec python3 "$SKILL_DIR/nex-keyring.py" "\$@" WRAPPER ``` ### Technical Analysis `SKILL_DIR` is derived from the directory containing `setup.sh`. The script directly interpolates this filesystem path into Python source code passed to `python -c`. A directory name containing a single quote can terminate the Python string supplied to `sys.path.insert`, after which additional Python statements can be injected. Shell quoting around the overall `-c` argument does not protect the generated Python source from syntax injection. The path is also inserted into a generated shell script through an expanding heredoc. If the installation path contains shell syntax such as command substitutions, quotes, or newlines, that syntax can become active when the generated `~/.local/bin/nex-keyring` wrapper is later executed. This is an exploitable coding flaw rather than intentional embedded malicious behavior. Exploitation requires influence over the path from which the user runs the setup script. ### Attack Path 1. An attacker distributes or places the project under a directory whose name contains crafted Python or shell syntax. 2. The user follows the documented installation instructions and runs `bash setup.sh`. 3. During database initialization, the crafted `SKILL_DIR` is inserted into the source passed to `python -c`. 4. A si ...[truncated 1012 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
lib/config.py:54
Finding

Encryption Is Reported as Enabled but Is Never Implemented

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
setup.sh:119
Finding

Unpinned Third-Party Dependency Installation Guidance

Content
View full analysis
/dev/null; then echo " cryptography: installed (Fernet encryption enabled)" else echo " cryptography: not installed (optional, recommended)" echo "" echo " For stronger encryption, install it:" echo " pip install cryptography" echo "" fi ``` The same unpinned command appears in the documentation: ```bash pip install cryptography ``` ### Technical Analysis The project recommends installing `cryptography` without: - Pinning an audited version. - Verifying package hashes. - Specifying a trusted package index. - Using an isolated virtual environment. - Binding pip to the interpreter used by the application. The referenced package name is legitimate, and the setup script does not automatically execute the installation command. Therefore, this is not evidence of a malicious dependency. The risk arises because following the recommendation causes pip to resolve mutable content according to the user’s active pip configuration. A compromised index, malicious mirror, altered pip configuration, or compromised future release could cause unintended code to be installed. Using bare `pip` may also install into a different Python environment from the one selected by the setup script. ### Attack Path 1. A user follows the setup or troubleshooting guidance. 2. The user executes `pip install cryptography`. 3. pip consults the user’s configured package indexes and resolves the current available version. 4. A compromised index, mirror, configuration, or package release supplies unintended package content. 5. Package installation or later import runs that content with the user’s permissions. 6. Because no expected version or hash is defined, ...[truncated 617 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Note
Location
lib/storage.py:321
Finding

Rotation Recording Does Not Update the Current Credential Hash

Content
View full analysis
int: """Record a rotation event.""" now = datetime.now().isoformat() with self._get_connection() as conn: cursor = conn.cursor() cursor.execute(""" INSERT INTO rotation_history (secret_id, rotated_at, old_key_hash, new_key_hash, notes) VALUES (?, ?, ?, ?, ?) """, (secret_id, now, old_hash, new_hash, notes)) # Update last_rotated cursor.execute("UPDATE secrets SET last_rotated = ? WHERE id = ?", (now, secret_id)) self._audit_log_entry_internal(cursor, secret_id, "rotated", f"Hash: {new_hash}") return cursor.lastrowid ``` ### Technical Analysis The method inserts `new_hash` into `rotation_history` and updates `last_rotated`, but it never updates `secrets.key_hash`. As a result, the main secret record continues to represent the previous hash or no hash at all. Subsequent calls to `cmd_rotate` obtain `old_hash` from this stale field, causing later history entries to contain an incorrect old hash. The `show` command can also display stale current-state information. The CLI accepts arbitrary text through `--hash` and does not validate that the value is a 64-character hexadecimal SHA-256 digest. This further weakens the integrity of rotation records. ### Attack Path 1. A user registers a secret whose current hash is empty or already populated. 2. The user records a rotation and supplies a new hash. 3. `record_rotation` adds the supplied value to the history table. 4. Only `last_rotated` is updated in the main `secrets` table. 5. The user later views or rotates the same secret. 6. The application reads the stale `secrets.key_has ...[truncated 818 chars]
Remediation
View remediation
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 (160)

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

The skill's core capability is to access .env files and environment variables to detect credentials, which is direct interaction with sensitive secret material. Even if the implementation claims to avoid storing raw values, accessing credential sources creates high risk if logs, errors, exports, or downstream tooling mishandle them.

Content

Scanner excerpt · SKILL.md (reported line 3)May include surrounding context.

md
---
name: nex-keyring
description: Local API key and secret rotation management system for tracking and securing all API credentials, tokens, and database passwords. Monitor API keys from popular services (OpenAI, Cloudflare, Firebase, GitHub, Stripe, Telegram, DashScope/Qwen, TransIP) and custom credentials. Never stores actual key values, only cryptographic hashes for change detection. Track rotation status and days since last rotation with automatic risk level assessment (FRESH under 30 days, OK 30-90 days, STALE 90-180 days, CRITICAL over 180 days). Detect stale credentials that haven't been rotated recently and enforce organization-specific rotation policies (typical: 90 days for API keys, 180 days for infrastructure tokens). Scan .env files and environment variables to auto-detect and register all API keys and secrets with appropriate service categories and rotation policies. Generate audit logs for every access, rotation, and modification event for compliance documentation. Export credential registries (metadata only, never actual keys) in CSV, JSON, or Markdown formats for security audits. Ideal for DevOps engineers, system administrators, and development teams managing multiple credentials across systems and services.
version: 1.0.0
metadata:
  clawdbot:

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

Advertising '.env' scanning for secrets indicates the skill is designed to inspect files that commonly contain plaintext credentials. In a security-sensitive assistant ecosystem, this is a real credential-access capability and should be treated as high risk unless tightly constrained.

Content

Scanner excerpt · SKILL.md (reported line 33)May include surrounding context.

md
- Which API keys haven't been rotated recently
- Stale or overdue credentials
- Tracking API keys from specific services (OpenAI, Cloudflare, Firebase, etc.)
- Scanning .env files for secrets
- Importing keys from environment files
- Security audit or credential management
- Credential expiration or rotation history

Credential Access

High
Category
Privilege Escalation
Confidence
88% confidence
Finding

Including '.env file' and 'scan environment' as generic trigger phrases can cause the skill to activate in conversations that merely mention these topics, potentially leading users toward credential-access operations without sufficiently explicit intent. Because the capability targets secret-bearing sources, broad triggering amplifies risk.

Content

Scanner excerpt · SKILL.md (reported line 41)May include surrounding context.

md
- Password, wachtwoord, sleutel (Dutch for "key")
- API security or secret management

Trigger phrases: "API key", "secret rotation", "which keys need rotation", "stale credentials", ".env file", "rotate key", "track secrets", "credential management", "security audit", "API token", "webhook", "database password", "rotation status", "scan environment"

## Quick Setup

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

This section directly instructs scanning .env files or environment variables for API keys, which is credential access by design. Such sources often contain production secrets, so normalizing access without prominent safeguards creates substantial exposure risk.

Content

Scanner excerpt · SKILL.md (reported line 133)May include surrounding context.

Scan Environment

Scan .env files or environment variables for API keys:

bash
nex-keyring scan --env-file .env

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

This command block explicitly instructs scanning secret-bearing files and the runtime environment, which is direct credential-source access. The skill context makes it understandable but not harmless, because these stores frequently contain high-value secrets.

Content

Scanner excerpt · SKILL.md (reported line 136)May include surrounding context.

Scan .env files or environment variables for API keys:

bash
nex-keyring scan --env-file .env
nex-keyring scan --env-file /path/to/.env.production
nex-keyring scan --environment

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

This command block explicitly instructs scanning secret-bearing files and the runtime environment, which is direct credential-source access. The skill context makes it understandable but not harmless, because these stores frequently contain high-value secrets.

Content

Scanner excerpt · SKILL.md (reported line 136)May include surrounding context.

Scan .env files or environment variables for API keys:

bash
nex-keyring scan --env-file .env
nex-keyring scan --env-file /path/to/.env.production
nex-keyring scan --environment

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The production path example reinforces access to a high-sensitivity credential store. That increases the likelihood of exposure to privileged secrets during normal use.

Content

Scanner excerpt · SKILL.md (reported line 137)May include surrounding context.

bash
nex-keyring scan --env-file .env
nex-keyring scan --env-file /path/to/.env.production
nex-keyring scan --environment

Credential Access

High
Category
Privilege Escalation
Confidence
97% confidence
Finding

The production path example reinforces access to a high-sensitivity credential store. That increases the likelihood of exposure to privileged secrets during normal use.

Content

Scanner excerpt · SKILL.md (reported line 137)May include surrounding context.

bash
nex-keyring scan --env-file .env
nex-keyring scan --env-file /path/to/.env.production
nex-keyring scan --environment

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

Scanning the live environment can expose process-level credentials beyond a single project file, broadening the set of secrets touched. This expands the blast radius compared with scanning a narrow, user-selected file.

Content

Scanner excerpt · SKILL.md (reported line 138)May include surrounding context.

bash
nex-keyring scan --env-file .env
nex-keyring scan --env-file /path/to/.env.production
nex-keyring scan --environment

Detects:

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The import workflow auto-registers keys from .env files, which implies reading sensitive secret containers and transforming their contents into tracked records. This is a real credential-access pathway that can expand the blast radius if parsing, logging, or storage is imperfect.

Content

Scanner excerpt · SKILL.md (reported line 146)May include surrounding context.

md
- Whether values are set
- Key names for tracking

### Import from .env

Auto-register all keys from a .env file:

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

The command 'nex-keyring import .env' instructs reading a file that commonly contains plaintext secrets. That is credential access, and in the absence of visible guardrails in the documentation, it is a meaningful security concern.

Content

Scanner excerpt · SKILL.md (reported line 148)May include surrounding context.

Import from .env

Auto-register all keys from a .env file:

bash
nex-keyring import .env

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

Importing from .env is a credential-access workflow because it requires reading plaintext secrets from disk. The benign administrative use case does not remove the sensitivity of that operation.

Content

Scanner excerpt · SKILL.md (reported line 151)May include surrounding context.

Auto-register all keys from a .env file:

bash
nex-keyring import .env
nex-keyring import .env.production --auto-register

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

Importing from .env is a credential-access workflow because it requires reading plaintext secrets from disk. The benign administrative use case does not remove the sensitivity of that operation.

Content

Scanner excerpt · SKILL.md (reported line 151)May include surrounding context.

Auto-register all keys from a .env file:

bash
nex-keyring import .env
nex-keyring import .env.production --auto-register

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Importing from a production .env file magnifies the sensitivity and potential harm due to likely presence of higher-privilege credentials. Bulk processing of these values raises the consequences of any accidental disclosure.

Content

Scanner excerpt · SKILL.md (reported line 152)May include surrounding context.

bash
nex-keyring import .env
nex-keyring import .env.production --auto-register

Creates tracked secrets for each detected key with appropriate service detection and rotation policies.

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

Importing from a production .env file magnifies the sensitivity and potential harm due to likely presence of higher-privilege credentials. Bulk processing of these values raises the consequences of any accidental disclosure.

Content

Scanner excerpt · SKILL.md (reported line 152)May include surrounding context.

bash
nex-keyring import .env
nex-keyring import .env.production --auto-register

Creates tracked secrets for each detected key with appropriate service detection and rotation policies.

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

The onboarding scenario explicitly recommends scanning a .env file, guiding users toward direct interaction with secret-bearing content. Documentation that operationalizes credential-source access increases the likelihood of real-world secret exposure.

Content

Scanner excerpt · SKILL.md (reported line 278)May include surrounding context.

Scenario: Onboard new API keys

bash
# Scan your .env file
nex-keyring scan --env-file .env

# Import all found keys

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

The onboarding workflow includes importing from .env immediately after scanning, which is a concrete credential-access sequence. This makes the documentation operationally risky for users handling real secrets.

Content

Scanner excerpt · SKILL.md (reported line 279)May include surrounding context.

bash
# Scan your .env file
nex-keyring scan --env-file .env

# Import all found keys
nex-keyring import .env

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

The onboarding workflow includes importing from .env immediately after scanning, which is a concrete credential-access sequence. This makes the documentation operationally risky for users handling real secrets.

Content

Scanner excerpt · SKILL.md (reported line 279)May include surrounding context.

bash
# Scan your .env file
nex-keyring scan --env-file .env

# Import all found keys
nex-keyring import .env

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 13)May include surrounding context.

md
"""
Nex Keyring - Scanner Module
Environment and .env file scanning for API keys and secrets.
"""

import hashlib

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 63)May include surrounding context.

md
"""
Nex Keyring - Scanner Module
Environment and .env file scanning for API keys and secrets.
"""

import hashlib

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 66)May include surrounding context.

md
"""
Nex Keyring - Scanner Module
Environment and .env file scanning for API keys and secrets.
"""

import hashlib

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 69)May include surrounding context.

md
"""
Nex Keyring - Scanner Module
Environment and .env file scanning for API keys and secrets.
"""

import hashlib

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 104)May include surrounding context.

md
"""
Nex Keyring - Scanner Module
Environment and .env file scanning for API keys and secrets.
"""

import hashlib

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 108)May include surrounding context.

md
"""
Nex Keyring - Scanner Module
Environment and .env file scanning for API keys and secrets.
"""

import hashlib

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 198)May include surrounding context.

md
"""
Nex Keyring - Scanner Module
Environment and .env file scanning for API keys and secrets.
"""

import hashlib

Static analysis

No suspicious patterns detected.