Back to skill

Security audit

Alpha Finder (x402)

Security checks for vulnerabilities and agentic risk

Overview

This skill appears purpose-aligned, but it asks for a wallet private key and passes it to unpinned code downloaded at runtime, so users should review it carefully before installing.

Install only if you are comfortable giving a third-party npm package access to a dedicated, low-balance Base wallet key. Do not use a primary wallet key; avoid project-directory config files; apply strict file permissions if you use plaintext storage; and prefer a pinned, reviewed package version or safer wallet/signing flow.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (2)

T03 · Remote Payload Retrieval and Execution

Error
Location
scripts/analyze.sh:47
Finding

Unpinned npm Package Is Downloaded and Executed with Access to a Wallet Private Key

Content
View full analysis

Vulnerability Details

File Location: scripts/analyze.sh, lines 25 and 47
Vulnerability Type: Unpinned runtime dependency and remote code execution through npx
Risk Level: High

Vulnerable Code

bash
if [ -n "$PRIVATE_KEY" ]; then
    export X402_PRIVATE_KEY="$PRIVATE_KEY"
    break
fi
bash
# Execute the market analysis
npx -y @itzannetos/x402-tools-claude alpha-finder "$QUERY"

Technical Analysis

The script exports a cryptocurrency wallet private key into its environment and subsequently invokes an npm package through npx -y. No exact package version, lockfile, integrity hash, or locally reviewed package source is provided.

Consequently, npx can retrieve and execute whichever package version the npm registry resolves at execution time. The -y option suppresses the normal installation confirmation. The downloaded package inherits the script's environment, including X402_PRIVATE_KEY, and executes with the operating-system privileges of the user running the skill.

This creates both a remote-payload and software-supply-chain trust boundary. Although the audited repository does not contain direct key-exfiltration code, a compromised package release, npm maintainer account, transitive dependency, or registry resolution could alter the effective payload after this skill has been reviewed.

Attack Path

  1. An attacker compromises the npm package, its maintainer account, a transitive dependency, or the applicable package-resolution path.
  2. The attacker publishes code that reads X402_PRIVATE_KEY, signs unauthorized transactions, transmits the key, or executes arbitrary local commands.
  3. A user invokes scripts/analyze.sh with a market query.
  4. The script reads and exports the wallet private key.
  5. npx -y downloads and executes the attacker-controlled package version without interactive confirmation.
  6. The package inherits the wallet key and the invoking use ...[truncated 823 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin the dependency to an exact, reviewed version rather than relying on the registry's current resolution:
    bash
    npx --yes --package '@itzannetos/x402-tools-claude@EXACT_VERSION' \
      x402-tools-claude alpha-finder "$QUERY"
    
    Verify the package's actual executable name before adopting this example.
  2. Commit a package manifest and lockfile, and install dependencies using a reproducible command such as npm ci.
  3. Verify dependency integrity and provenance. Review the pinned package and its transitive dependencies before exposing any financial secret to them.
  4. Prefer vendoring or locally installing reviewed source instead of downloading executable code during every invocation.
  5. Do not provide a general-purpose or high-value wallet private key to third-party package code.
  6. Use a dedicated, low-balance wallet with only the funds required for expected request fees.
  7. Prefer an audited local signing service or hardware-backed signer that approves narrowly scoped transactions without disclosing the raw private key.
  8. Execute the dependency in a restricted environment with minimal filesystem access, a sanitized environment, and limited network access where operationally possible.
  9. Document the package version and re-audit all dependency updates before deployment.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:28
Finding

Documentation Recommends Plaintext Wallet-Key Storage Without Enforcing Restrictive Permissions

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 28-35
Vulnerability Type: Insecure storage of a cryptocurrency private key
Risk Level: Medium

Vulnerable Code

bash
echo '{"private_key": "0x..."}' > ~/.x402-config.json

The documentation also permits a configuration file in the current working directory:

text
1. Current directory: ./x402-config.json
2. Home directory: ~/.x402-config.json
3. Working directory: $PWD/x402-config.json

Technical Analysis

The recommended command stores a wallet private key in a plaintext JSON file without explicitly setting restrictive file permissions. The resulting permissions depend on the user's current umask. In an environment with a permissive umask, other local accounts or processes may be able to read the key.

Permitting the same secret file in a project or working directory also increases the likelihood that it will be indexed, copied into build contexts, included in backups, uploaded as an artifact, or accidentally committed to version control.

The script does not validate file ownership or permissions before reading a discovered configuration file. This finding does not establish that the key is necessarily exposed on every system; exploitation depends on actual permissions, local access, and surrounding tooling.

Attack Path

  1. A user follows the documented setup command or creates x402-config.json in a project directory.
  2. The file receives permissions derived from a permissive umask, or project tooling copies or tracks the file.
  3. Another local user, process, backup consumer, artifact recipient, or repository collaborator gains access to the plaintext file.
  4. The party extracts the private_key value.
  5. The stolen key is used to impersonate the wallet owner and authorize transactions supported by that wallet.

Impact Assessment

Disclosure grants possession of the raw cryptocurrency private key. An attacke ...[truncated 409 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the documented creation command with one that enforces owner-only access:
    bash
    umask 077
    printf '%s\n' '{"private_key": "0x..."}' > "$HOME/.x402-config.json"
    chmod 600 "$HOME/.x402-config.json"
    
  2. In the script, reject configuration files that are not owned by the current user or are readable or writable by group or other users.
  3. Discourage storing wallet keys in project and working directories.
  4. Add x402-config.json and equivalent secret-file names to version-control ignore guidance.
  5. Prefer an operating-system credential store, hardware wallet, or dedicated signing service over plaintext key files.
  6. Use a dedicated, minimally funded wallet rather than a primary wallet.
  7. Document secret rotation and wallet migration procedures for suspected exposure.
  8. Avoid printing, logging, or forwarding the raw private key beyond the minimum trusted signing component.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill instructs users to place a blockchain private key in an environment variable or plaintext JSON file, including a recommended persistent location in the home directory, without warning that this credential grants spending authority. This increases the chance of key theft through shell history, overly permissive file permissions, backups, logs, or accidental inclusion in source-controlled working directories, which could lead to unauthorized wallet use and payment fraud.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
92% confidence
Finding

The recommended use of ~/.x402-config.json creates long-lived session/payment credential persistence in plaintext, making compromise more likely across sessions and unrelated projects. Because this skill performs paid requests on Base via x402, theft of the stored private key can directly enable unauthorized charges and wallet abuse, so the market-research context makes the persistence more dangerous than a non-financial API token.

Content

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

  1. Home directory: ~/.x402-config.json ← Recommended
  2. Working directory: $PWD/x402-config.json

Create the config file:

json
{
  "private_key": "0x1234567890abcdef..."

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The script reads a private blockchain payment key from disk or environment and exports it for use by a downstream tool, creating direct access to a sensitive credential. In the context of a market-research skill, this is especially risky because the skill’s primary purpose is analysis, while secret-handling and payment signing materially increase the blast radius if the called package or execution environment is compromised.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
82% confidence
Finding

The script instructs users to store a long-lived private key in the current directory or home directory, creating persistent local secret material that may be unintentionally exposed through backups, repository inclusion, weak file permissions, or later compromise of the host. For a skill that users may run casually for market research, encouraging durable credential storage increases the chance of broad, repeated misuse if that key is discovered.

Content

Scanner excerpt · scripts/analyze.sh (reported line 40)May include surrounding context.

sh
echo ""
    echo "Please configure your private key using one of these methods:"
    echo "1. Set environment variable: export X402_PRIVATE_KEY=\"0x...\""
    echo "2. Create x402-config.json in current directory with:"
    echo '   {"private_key": "0x..."}'
    echo "3. Create ~/.x402-config.json in your home directory"
    exit 1

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The script executes an npm package directly via npx without pinning an exact version, so each run may fetch whatever version is current at execution time. Because this script also loads and exports a blockchain private key into the environment, a compromised or malicious upstream package update could immediately access that key and exfiltrate it or spend funds.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.