Back to skill

Security audit

x402 pay

Security checks for vulnerabilities and agentic risk

Overview

This skill is for real blockchain payments and is mostly coherent, but it gives agents broad wallet/secret discovery and raw-key payment authority that users should review carefully before installing.

Install only in an agent environment that requires explicit human approval for every command and every transaction. Prefer a dedicated low-balance wallet or managed signer with spend limits and allowlists. Avoid generic PRIVATE_KEY-style variables in the agent environment, do not fund it with more than you can afford to lose, and review any generated .env files, wallet sessions, and paid endpoint URLs before use.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (5)

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
references/detecting-wallets.md:12
Finding

Overbroad wallet discovery instructs the agent to inspect sensitive configuration and execution context

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/pay.mjs:25
Finding

Payment code automatically reuses generic private-key environment variables

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/wallet.mjs:75
Finding

Raw private keys are exposed through command-line arguments, standard output, and plaintext environment files

Content
View full analysis
in your .env file. Keep it out of version control.'); ``` The payment command also accepts the private key directly through `--key`: ```js // Usage: // node scripts/pay.mjs --url --max-price [--method GET|POST] [--body ] [--key ] const keyArg = getArg('--key') || process.env.X402_PRIVATE_KEY || process.env.PRIVATE_KEY || process.env.WALLET_PRIVATE_KEY || process.env.ETH_PRIVATE_KEY || process.env.AGENT_PRIVATE_KEY; ``` The wallet-flow documentation then instructs the agent to persist the key in a plaintext project-root `.env` file: ```markdown Immediately write the key to `.env` in the project root so it is persisted — do not just display it and move on: X402_PRIVATE_KEY= The key must be persisted so it survives session restarts. ``` These mechanisms expose the key across several channels: - Standard output may be retained by agent transcripts, CI logs, terminal recording, or command telemetry. - Command-line arguments can be visible in process listings and shell history. - Project-root `.env` files may be readable by other local users, copied into backups, included in support bundles, or accidentally committed. - The code does not create the file itself with restrictive permissions or verify existing file permissions. The ...[truncated 1274 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/check-price.mjs:15
Finding

Unrestricted endpoint requests enable server-side request forgery from the agent environment

Content
View full analysis
[--method GET|POST] [--body ] [--max-price ]'); process.exit(1); } // ... const reqHeaders = body ? { 'Content-Type': 'application/json' } : {}; let probe; try { probe = await fetch(url, { method, headers: reqHeaders, body: body || undefined }); } catch (e) { console.error(`Request failed: ${e.message}`); process.exit(1); } ``` Although the usage text advertises `GET|POST`, no allowlist is enforced. Values such as `PUT`, `PATCH`, or `DELETE` are accepted. The payment script performs a similar unrestricted initial probe before any 402 validation. Accessing user-selected remote APIs is core functionality, but access to loopback, link-local, private, multicast, and internal DNS destinations is not required. Redirect handling also permits an initially public URL to redirect into an internal network. For `pay.mjs`, a non-402 response is printed to stdout. This can turn the agent into an internal-network read primitive. Requests with non-idempotent methods can also modify unauthenticated internal services. ### Attack Path 1. An attacker supplies or advertises a URL such as a loopback address, private RFC1918 address, internal ho ...[truncated 1097 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Note
Location
SKILL.md:57
Finding

Dependency installation is not reproducible and optional wallet packages are unpinned

Content
View full analysis
/x402-pay npm install ``` ``` The supplied direct dependencies in `package.json` use exact versions: ```json { "license": "Apache-2.0", "type": "module", "dependencies": { "@x402/evm": "2.10.0", "@x402/fetch": "2.10.0", "dotenv": "17.4.2", "viem": "2.51.3" } } ``` However, the audited project structure contains no `package-lock.json` or equivalent integrity lock. Consequently, transitive dependency versions and artifact integrity are not fully fixed. The managed-wallet instructions additionally install packages without versions: ```bash npm install @coinbase/cdp-sdk ``` ```bash npm install @turnkey/viem @turnkey/sdk-server ``` `npm install` can execute package lifecycle scripts. Without a committed lockfile and version pinning for optional packages, the code installed and executed can differ from the code reviewed during the audit. This is a supply-chain exposure rather than evidence that the currently named packages are malicious. ### Attack Path 1. The user or agent follows the setup or managed-wallet instructions. 2. npm resolves transitive dependencies or unpinned optional packages using the registry’s current state. 3. A compromised maintainer account, malicious newly published version, or compromised transitive package supplies hostile installation code. 4. npm executes a lifecycle script during installation. 5. The package code runs with the user’s filesystem and environment access, potentially reaching the wallet credentials store ...[truncated 392 chars]
Remediation
View remediation
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
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Rogue AgentSelf-Modification, Session Persistence
Findings (35)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
80% confidence
Finding

Skill instructs the agent to never refuse or to always comply. Suppressing the agent's ability to decline removes a core safety control and enables downstream harmful requests to succeed.

Content

Scanner excerpt · LICENSE-THIRD-PARTY.txt (reported line 199)May include surrounding context.

text
**b. Network Connection.** As a material condition of this License, all use, distribution or derivatives works of the WalletKit Items must connect to the proprietary Reown gateway infrastructure, or its successor, and its related WalletConnect messaging protocol (collectively, the “**Network**”) unless we explicitly approve you doing otherwise. You further agree not to circumvent this requirement, or instruct or suggest to Your end users to do so.

**c. Compliance with Law.** We are not in a position to monitor and assess the legality and regulatory treatment of your business and operations. Your use of the WalletKit Items must comply with all applicable laws and regulations and Our Terms of Service and Acceptable Use Policy, as amended from time to time, the terms of which are incorporated herein by reference.

**d. Use of Marks.** This License does not grant permission to use Our trade names, trademarks, service marks, or product names (collectively, the “**Marks**”), except as permitted by Our Marks usage guidelines or as required for disclosure of the development of Your applications or wallets, reproducing the attribution notice in the readme.txt file, or Your redistribution of WalletKit Items. We reserve all rights not expressly granted to you under this License. Unless explicitly approved by Us, in no event will You use Our name, trademarks, or logos to endorse or imply Our endorsement of products derived from WalletKit Items or any products or services that use WalletKit Items. Where You are permitted to use the Marks, You must comply with Our then-current trademark and logo usage guidelines, as may be updated from time to time without notice from Us. All goodwill arising out of Your use of any Mark will inure solely to Us.

Credential Access

High
Category
Privilege Escalation
Confidence
78% confidence
Finding

The README tells users to place live wallet secrets such as NEAR_PRIVATE_KEY and other payment credentials in the agent root .env, then to give the agent context on how to use them for transfers. In an agent skill that executes commands and handles cross-chain payments, concentrating reusable private keys in the runtime environment materially increases the blast radius of prompt injection, command abuse, or accidental secret exposure.

Content

Scanner excerpt · README.md (reported line 75)May include surrounding context.

For example if you have funds in a NEAR wallet, in your task prompt or CLAUDE.md file you could state:

txt
You have USDC in your NEAR account. Its account ID is in the NEAR_ACCOUNT_ID environment variable and a NEAR_PRIVATE_KEY is configured in the .env file in the agent root.

To send USDC from NEAR (USDC contract: 17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1):

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search-services.mjs search

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search-services.mjs search

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
node scripts/search-services.mjs search

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
Check your wallet's USDC balance on Base — see `references/wallet-flows.md` for the method for your wallet (if you don't already know it) — and compare it again

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
Check your wallet's USDC balance on Base — see `references/wallet-flows.md` for the method for your wallet (if you don't already know it) — and compare it again

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
Check your wallet's USDC balance on Base — see `references/wallet-flows.md` for the method for your wallet (if you don't already know it) — and compare it again

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
Check your wallet's USDC balance on Base — see `references/wallet-flows.md` for the method for your wallet (if you don't already know it) — and compare it again

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/load-env.mjs (reported line 1)May include surrounding context.

js
// Shared .env loader for scripts that need wallet credentials or RPC config.
//
// Precedence (highest wins):
//   1. Shell env     — already in process.env from `export VAR=...`

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/load-env.mjs (reported line 5)May include surrounding context.

js
// Shared .env loader for scripts that need wallet credentials or RPC config.
//
// Precedence (highest wins):
//   1. Shell env     — already in process.env from `export VAR=...`

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/load-env.mjs (reported line 6)May include surrounding context.

js
// Shared .env loader for scripts that need wallet credentials or RPC config.
//
// Precedence (highest wins):
//   1. Shell env     — already in process.env from `export VAR=...`

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/wallet.mjs (reported line 84)May include surrounding context.

js
// Shared .env loader for scripts that need wallet credentials or RPC config.
//
// Precedence (highest wins):
//   1. Shell env     — already in process.env from `export VAR=...`

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/load-env.mjs (reported line 15)May include surrounding context.

js
const SKILL_DIR = join(dirname(fileURLToPath(import.meta.url)), '..');

export function loadEnv() {
  config({ path: join(process.cwd(), '.env'), quiet: true });
  config({ path: join(SKILL_DIR, '.env'),    quiet: true });
}

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/load-env.mjs (reported line 16)May include surrounding context.

js
const SKILL_DIR = join(dirname(fileURLToPath(import.meta.url)), '..');

export function loadEnv() {
  config({ path: join(process.cwd(), '.env'), quiet: true });
  config({ path: join(SKILL_DIR, '.env'),    quiet: true });
}

Rp1

Medium
Category
MCP Rug Pull
Confidence
87% confidence
Finding

The README instructs users to run npx skills add NearDeFi/agent-payments-skill without pinning a version or commit. That creates a supply-chain risk because the fetched package can change over time, and this skill is explicitly used in money-moving agent environments where compromised updates could lead to credential theft or unauthorized payments.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
81% confidence
Finding

The skill may reuse an existing wallet session or create a new wallet automatically, and specifically instructs AWAL login via the terminal session used by the agent. Persistent authenticated wallet sessions in an agent runtime increase the risk that subsequent prompts, chained tools, or session compromise can trigger unauthorized transactions without re-authentication.

Content

Scanner excerpt · README.md (reported line 45)May include surrounding context.

Wallet configuration

The skill will check the agent's context for configured wallets. It requires a wallet on Base, and will either use an existing wallet or create one if none is already configured. The skill has explicit wallet support for AWAL, CDP, Privy, Turnkey, and private key. To use your AWAL wallet, log in via the terminal where the agent executes commands. For other wallets, configure the relevant environment variables in a .env file in the root of your agent.

env
# To use CDP configure the following environment variables

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill explicitly requires internet access and references numerous environment variables for wallets and API credentials, yet it does not declare an explicit tool/permission scope such as allowed-tools or permissions. In an agent platform, this can cause the skill to run with broader-than-expected access to network and secrets, increasing the chance of unintended outbound requests or exposure/misuse of wallet material during payment and funding flows.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
92% confidence
Finding

The skill instructs the agent to embed the unique deposit address into a third-party QR generation service URL, which transmits sensitive transaction metadata off-platform. In this skill's context, deposit addresses are tied to a live payment quote and may reveal wallet relationships or payment activity to an external service; if that service is compromised or altered, users could also be misled into sending funds to an incorrect address despite the warning to visually verify it.

Content

Scanner excerpt · references/near-intents-funding.md (reported line 101)May include surrounding context.

When you give the deposit address to the user to send to (external-wallet funding), you can also offer a scannable QR of it:

text
https://api.qrserver.com/v1/create-qr-code/?size=240x240&data=<Deposit to: address>

Put the exact Deposit to: address in the data parameter. Always tell the user to check that the address their wallet shows after scanning matches the Deposit to: address printed by the script — if they differ, the QR is wrong or corrupted and they must not send.

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · references/wallet-flows.md (reported line 90)May include surrounding context.

}); const fetchWithPayment = wrapFetchWithPayment(fetch, client);

const res = await fetchWithPayment('https://api.example.com/data'); console.log(await res.text()); // the paid response body

text

External Transmission

Medium
Category
Data Exfiltration
Confidence
50% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/search-services.mjs (reported line 12)May include surrounding context.

js
import https from 'https';

const X402LIST_API = 'https://x402-list.com/api/v1';
const BAZAAR_API   = 'https://api.cdp.coinbase.com/platform/v2/x402/discovery/resources';
const PAGE_SIZE    = 1000;

const args   = process.argv.slice(2);

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

Scanner excerpt · LICENSE-THIRD-PARTY.txt (reported line 15)May include surrounding context.

text
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

========================================================================
2. BSD 2 Clause

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

Scanner excerpt · LICENSE-THIRD-PARTY.txt (reported line 27)May include surrounding context.

text
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

========================================================================
2. BSD 2 Clause

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

Scanner excerpt · LICENSE-THIRD-PARTY.txt (reported line 41)May include surrounding context.

text
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

========================================================================
2. BSD 2 Clause

Scope Creep

Low
Category
Excessive Agency
Confidence
70% confidence
Finding

Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Content

Scanner excerpt · LICENSE-THIRD-PARTY.txt (reported line 219)May include surrounding context.

text
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

========================================================================
2. BSD 2 Clause

Static analysis

No suspicious patterns detected.