Back to skill

Security audit

B.Fun AI

Security checks for vulnerabilities and agentic risk

Overview

The skill is openly a blockchain trading tool, but it asks users to run mutable external CLI code with wallet signing access.

Review this carefully before installing. Use a low-value dedicated wallet, avoid npx for secret-bearing workflows, prefer an exact reviewed package version or pinned commit, verify transaction details independently, and only provide PRIVATE_KEY when you intentionally want state-changing on-chain actions.

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

Error
Location
SKILL.md:54
Finding

Mutable and Unverifiable External CLI Dependency

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:54-66
Vulnerability Type: Supply-chain risk caused by mutable, externally retrieved executable code
Risk Level: High

Vulnerable Code Snippet

markdown
## Installation and execution

**Installation (required):** `npm install -g @b-fun/bfun-ai@latest`. After install, run `bfun <command> [args]`; with local install only, use `npx bfun <command> [args]` from the project root. Run `bfun --help` for usage.

This repository keeps the canonical production package identity in source. Release exports map `main` to `@b-fun/bfun-ai` and `dev` to `bfun-agent-dev`; the dev package name is injected only into generated export artifacts, not the source tree.

Alternatively, clone and run locally without global install:

git clone https://github.com/bfun-ai/bfun-ai.git cd bfun-ai npm install npx bfun [args]

text

Technical Analysis

The Skill requires installation and execution of code that is not included in the audited artifact. The primary installation command uses the mutable npm tag @latest, while the alternative clones the current, unpinned head of a remote Git repository. The npx execution path may also resolve or install packages dynamically.

The artifact contains only Markdown instructions and references; it does not contain the CLI source, a dependency lockfile, package integrity values, or a reviewed commit identifier. Therefore, the effective executable payload can change after this Skill has been audited.

This risk is especially significant because the external CLI is intentionally given access to sensitive and high-impact capabilities:

  • A raw PRIVATE_KEY for signing BSC transactions.
  • Wallet funds and token allowances.
  • .env files loaded from the current working directory.
  • Local image files selected for token creation.
  • Network access to RPC and B.Fun API services.
  • Authority to buy, sell, transfer assets, create tokens, and register NFTs.

Although the doc ...[truncated 1702 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace @latest with an exact, reviewed package version.
  2. Pin the package tarball integrity using a cryptographic hash and verify it before execution.
  3. Pin Git-based installation to a full reviewed commit hash rather than the repository’s mutable default branch.
  4. Include the complete executable source, package manifest, and lockfile in the auditable Skill artifact.
  5. Disable npx package auto-installation and require execution only from a preverified local installation.
  6. Use reproducible builds and publish signed provenance or attestations for release artifacts.
  7. Audit and lock all transitive dependencies; enforce dependency allowlists and automated integrity verification.
  8. Run the CLI in a sandbox with narrowly scoped filesystem and network access.
  9. Avoid exposing a raw private key to the CLI. Use a constrained wallet or signing interface that displays and authorizes exact transaction fields.
  10. Use a low-value dedicated wallet and restrict token allowances to exact amounts and known contracts.
  11. Verify chain ID, destination contract, calldata, asset amount, and value independently before signing.
  12. Explicitly disclose that token metadata and image files are uploaded to the B.Fun backend during creation.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (11)

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

{ "success": true, "data": { "tokenAddress": "0x825e...", "phase": "curve", "pairType": "eth", "expectedOut": "2350672.37...", "minOut": "2233138.75...", "fee": "0.0006", "feeAsset": "BNB", "taxApplied": true, "taxRateBps": "500" } }

// error { "success": false, "error": "PRIVATE_KEY is not set. Export it or add it to .env" }

text

## Capability overview

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

md
Set **PRIVATE_KEY** only when you need state-changing commands. Read-only commands can run without it. Optionally set **BSC_RPC_URL** via the process environment so it is available when running `bfun` or `npx bfun`:

- **.env file**: Put a `.env` file in **the directory where you run the `bfun` command** (i.e. your project / working directory). Example: if you run `bfun quote-buy ...` from `/path/to/my-project`, place `.env` at `/path/to/my-project/.env`. The CLI automatically loads `.env` from that current working directory. Use lines like `PRIVATE_KEY=...` and `BSC_RPC_URL=...`. Do not commit `.env`; add it to `.gitignore`.
- **Shell export**: `export PRIVATE_KEY=your_hex_key` and `export BSC_RPC_URL=https://bsc-dataseed.binance.org` (or another BSC RPC), then run `bfun <command> ...`.

> **BSC_RPC_URL recommendation:** While optional, explicitly setting `BSC_RPC_URL` is recommended. The default public RPC may be unavailable in some networks or regions. After setting it, run `bfun verify` to confirm connectivity.

Rp1

Medium
Category
MCP Rug Pull
Confidence
95% confidence
Finding

The manifest-level allowed-tools includes Bash(npx bfun *), authorizing the agent to execute an unpinned package through npx. This is a true security issue because it grants runtime code execution from mutable upstream package resolution inside a skill that may hold a blockchain private key and can send funds.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The skill allows execution via npx bfun *, which can fetch and run whatever package currently resolves as bfun at execution time rather than a cryptographically pinned local artifact. In a wallet-enabled skill, this creates a supply-chain execution risk: a malicious or hijacked package version could exfiltrate PRIVATE_KEY, alter transaction parameters, or execute arbitrary code on the host.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
93% confidence
Finding

The installation guidance explicitly instructs users to run npx bfun <command>, which is an unpinned runtime package invocation. If the package resolution is compromised or updated maliciously, users may execute attacker-controlled code in an environment that may contain wallet secrets and can perform blockchain transactions.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding

The local run instructions again direct use of npx bfun <command> [args], preserving the same unpinned code execution path. Because this skill is designed to interact with PRIVATE_KEY and perform state-changing on-chain operations, any package substitution or typosquatting event could directly lead to credential theft or unauthorized transfers.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
92% confidence
Finding

The invocation section permits npx bfun <command> as an approved command path, normalizing unpinned package execution as part of the agent workflow. In the context of a trading and transfer skill, this meaningfully increases the blast radius of supply-chain compromise because the executed code may access environment variables, .env, wallet state, and transaction flows.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
91% confidence
Finding

The standalone environment configuration section tells users to make secrets available when running bfun or npx bfun, extending the unpinned execution risk into the exact environment where secrets are present. That combination makes exploitation more dangerous than a generic unpinned tool because the executed package can immediately read and misuse wallet credentials.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The first-buy flow can change ERC20 allowance state, including resetting allowance to 0 and then setting a new approval amount for certain tokens, but this state-changing behavior is only described operationally and not emphasized as a user-risk warning. In a wallet-connected CLI, silent or poorly surfaced approval changes can surprise users and expand spend permissions to the factory or related contract.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The create flow explicitly states that token metadata and a local image are uploaded to the B.Fun backend, but the operator guidance does not prominently warn that local file contents will leave the system. In an agent-operated context, this can lead to unintended disclosure of local files or sensitive metadata if a user or wrapper mis-specifies the image path or assumes all processing is local.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file tells the agent to ask the user to configure PRIVATE_KEY in the skill environment or a .env file, which involves handling highly sensitive credentials. The guidance does not include any warning about the security implications of storing or exposing a private key, despite the operation affecting wallet security and user funds.

Content

No source excerpt is available for this finding.