Back to skill

Security audit

Tongateway

Security checks for vulnerabilities and agentic risk

Overview

This skill is transparent about being a TON wallet and trading integration, but it includes approval-free autonomous fund transfers and local credential/key storage with limited documented safeguards.

Review carefully before installing. Use only a dedicated low-balance agent wallet for autonomous mode, avoid storing meaningful funds there, revoke keys promptly, protect or delete `~/.tongateway` credentials when not needed, and prefer a pinned or source-audited MCP install in a restricted environment.

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

T08 · Insecure Dependencies

Error
Location
SKILL.md:10
Finding

Unpinned npm Package Is Downloaded and Executed Through npx

Content
View full analysis

Vulnerability Details

File Location: SKILL.md:10; additional configuration examples appear at README.md:16-17 and README.md:30-31
Vulnerability Type: Unpinned third-party dependency execution
Risk Level: High

Vulnerable Code

markdown
**MCP package:** `@tongateway/mcp` (install via `npx -y @tongateway/mcp`)

The README configuration similarly invokes the package without a version or integrity constraint:

json
"command": "npx",
"args": ["-y", "@tongateway/mcp"],

Technical Analysis

The documented command uses npx -y to retrieve and execute @tongateway/mcp without pinning an exact package version or verifying an integrity digest. Consequently, the code executed on a user's system can differ from the code that was reviewed when this Skill was published.

The -y option automatically accepts installation prompts, reducing the opportunity for users to inspect the selected package version before execution. Although the documentation links to public source repositories, the audited project contains no executable MCP source and no mechanism proving that the npm artifact corresponds to a reviewed commit.

This creates a supply-chain trust boundary around the current npm package publication. A compromised publisher account, malicious future release, or compromised build pipeline could cause arbitrary package lifecycle or runtime code to execute under the MCP client's operating-system account.

Attack Path

  1. An attacker compromises the npm publisher account, release workflow, or package distribution process for @tongateway/mcp.
  2. The attacker publishes a malicious package version under the existing package name.
  3. A user installs or starts the documented MCP configuration.
  4. npx -y @tongateway/mcp resolves and downloads the attacker-controlled current version without an exact version constraint.
  5. npm executes the package under the user's local account.
  6. The mal ...[truncated 832 chars]
Remediation
View remediation

Remediation Suggestions

  • Pin the dependency to a reviewed exact version, such as @tongateway/mcp@x.y.z, rather than resolving the current release.
  • Maintain a lockfile and verify the npm package integrity digest before execution.
  • Publish reproducible-build information that maps the npm artifact to a specific reviewed source commit.
  • Download and inspect the package tarball before deployment in sensitive environments.
  • Disable automatic acceptance where practical so package changes remain visible to administrators.
  • Run the MCP server in a sandbox, container, or dedicated low-privilege account with narrowly scoped filesystem and network access.
  • Restrict the process from unrelated credentials, SSH keys, browser profiles, and wallet files.
  • Establish dependency monitoring and require review before updating the pinned package version.

T09 · Insecure Skill Coding Practices

Error
Location
SECURITY.md:70
Finding

Autonomous-Wallet Signing Keys and Session Tokens Are Persisted Without Explicit Restrictive Storage Controls

Content
View full analysis

Vulnerability Details

File Location: SECURITY.md:70-74; token persistence is also documented at SKILL.md:23, SKILL.md:129, and README.md:53
Vulnerability Type: Plaintext sensitive credential storage with unspecified file permissions
Risk Level: High

Vulnerable Code

markdown
| File | Contents | Purpose |
|------|----------|---------|
| `~/.tongateway/token` | JWT session token | Persists authentication across restarts |
| `~/.tongateway/wallets.json` | Agent wallet signing keys | Only created if you deploy an Agent Wallet |

Both files are created with standard file permissions and can be deleted at any time to reset the state.

Technical Analysis

The system persists a JWT session token and autonomous-wallet signing keys in files under the user's home directory. The documentation states only that “standard file permissions” are used; it does not guarantee owner-only permissions, secure file creation, encryption at rest, ownership validation, or integration with an operating-system credential store.

The JWT provides authenticated access to wallet information and transfer or DEX request capabilities. More critically, wallets.json contains signing keys for Agent Wallets. According to the documented security model, those keys enable the agent to transfer funds from the corresponding Agent Wallet without per-transaction owner approval.

If either file is readable by an unintended local process, another local account, an insecure backup system, or a malicious dependency executed under the same user, its contents can be copied and reused. Key expiration and administrative revocation reduce the duration of exposure but do not prevent misuse before revocation.

Attack Path

  1. A user authenticates to Agent Gateway, causing the JWT to be written to ~/.tongateway/token.
  2. The user deploys and funds an Agent Wallet, causing its signing key to be stored in ~/.tongateway/wallets.json.

...[truncated 1260 chars]

Remediation
View remediation

Remediation Suggestions

  • Create ~/.tongateway with owner-only permissions such as 0700.
  • Create token and key files atomically with owner-only permissions such as 0600, independent of permissive process umask settings.
  • Validate file ownership, type, and permissions before reading or writing credentials.
  • Reject symbolic links and unsafe pre-existing files to prevent redirection or overwrite attacks.
  • Store signing keys in an operating-system keychain, hardware-backed keystore, or dedicated secrets manager instead of a plaintext JSON file.
  • Encrypt signing keys at rest when secure platform storage is unavailable, with the decryption key kept separately.
  • Apply short expiration periods, narrow authorization scopes, and automatic rotation to JWTs and agent keys.
  • Provide immediate revocation controls and notify users when keys are used or exported.
  • Keep minimal balances in autonomous wallets and enforce configurable spending limits, destination allowlists, and transaction-rate limits.
  • Exclude credential files from cloud synchronization, diagnostics, logs, and unencrypted backups.
  • Document secure deletion and incident-response procedures for suspected token or signing-key exposure.
Vulnerability Patterns
  • 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
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
96% confidence
Finding

The 'Agent Wallet (Autonomous — no approval needed)' section documents a capability for autonomous fund movement without human approval. In an AI-agent context, that is materially dangerous because prompt injection, tool misuse, compromised agent logic, or mistaken instructions could trigger real blockchain transfers that are final and difficult to recover.

Content

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

md
| `dex.create_order` | Place a limit order (fromToken, toToken, amount, price) |
| `dex.pairs` | List available trading pairs |

### Agent Wallet (Autonomous — no approval needed)

| Tool | Description |
|------|-------------|

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README explicitly advertises an autonomous agent wallet that can transfer TON with 'no approval needed' but does not provide a prominent warning about irreversible blockchain transactions, private key custody, spending limits, or misuse by prompt-injected/compromised agents. In the context of an agent tool that can move real funds, this omission increases the chance that users enable autonomous spending without understanding the financial risk.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
97% confidence
Finding

The example explicitly normalizes a transfer flow where the agent executes a blockchain payment and reports 'No approval needed.' Concrete examples strongly influence operator behavior; here, the example encourages enabling autonomous money movement without emphasizing that the action is irreversible and vulnerable to accidental or adversarial triggering.

Content

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

You: "Send 0.5 TON from my agent wallet to 0:abc..."

Agent: agent_wallet.transfer(wallet, to, amount) → Transfer executed. No approval needed.

text

## Build from Source

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The document first states that the agent cannot move funds without explicit approval, then later describes an autonomous mode where the agent can spend funds from an Agent Wallet without per-transfer approval. This inconsistency can mislead users about the trust boundary and cause them to enable a mode with materially higher financial risk than they understood.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · SECURITY.md (reported line 47)May include surrounding context.

md
- The agent gets a signing key for that specific wallet only
- The agent **cannot access the user's main wallet**

**Risk:** If the agent malfunctions or is compromised, it can spend all funds in the Agent Wallet without approval. Treat Agent Wallets as "hot wallets" — only fund them with amounts you're willing to lose.

**Mitigation:**
- Agent keys have an expiration time

Rp1

Medium
Category
MCP Rug Pull
Confidence
89% confidence
Finding

The documentation recommends running the MCP server via npx without pinning an exact package version. This creates a supply-chain risk because users may execute whatever version is current on npm at runtime, including a compromised or unexpectedly changed release.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
96% confidence
Finding

npx @tongateway/mcp fetches and runs the latest published package unless already cached, which exposes users to package takeover, malicious updates, or accidental breaking changes. In a wallet/agent context, even a brief compromise of the published package could lead to credential theft or unauthorized transaction requests.

Content

No source excerpt is available for this finding.

Rp1

Medium
Category
MCP Rug Pull
Confidence
94% confidence
Finding

The skill instructs users to run an unpinned MCP package via npx -y @tongateway/mcp, which always pulls the latest published version at execution time. If the package publisher account, dependency chain, or npm distribution is compromised, users may transparently execute malicious code with the privileges of the local agent environment.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
92% confidence
Finding

The skill advertises an autonomous wallet mode where actions can occur without human approval, materially increasing the blast radius of prompt injection, agent misalignment, or operator error. In a financial/crypto context this is especially dangerous because unintended tool use can directly move irreversible on-chain funds.

Content

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

md
| `dex.create_order` | `fromToken`, `toToken`, `amount`, `price` | Place a limit order. Price is human-readable (e.g. 20 = "1 USDT = 20 AGNT") |
| `dex.pairs` | — | List available trading pairs |

### Agent Wallet (Autonomous — NO approval needed)

| Tool | Params | Description |
|------|--------|-------------|

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
96% confidence
Finding

This line explicitly states the deployed agent wallet allows the agent to spend funds without approval. Removing human confirmation on value-transfer operations creates a direct path from prompt injection, compromised context, or mistaken agent reasoning to irreversible asset theft or loss.

Content

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

md
| Tool | Params | Description |
|------|--------|-------------|
| `agent_wallet.deploy` | — | Deploy a dedicated wallet contract. WARNING: agent can spend funds without approval |
| `agent_wallet.transfer` | `walletAddress`, `to`, `amountNano` | Send TON directly from agent wallet |
| `agent_wallet.info` | `walletAddress?` | Balance, seqno, status. Omit address to list all |

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
89% confidence
Finding

The example normalizes autonomous transfers without approval, which can encourage insecure deployment and operational use. In the context of a blockchain payment skill, examples materially shape agent/operator behavior, and showcasing no-approval transfers increases the likelihood of unsafe real-world use.

Content

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

→ Order placed on open4dev DEX. Approve in your wallet app.

text

### Autonomous transfer (no approval)

agent_wallet.deploy()

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
95% confidence
Finding

The statement that a transfer was executed with 'No approval needed' confirms the system supports direct, irreversible asset movement without a human checkpoint. In a cryptocurrency setting, that capability is intrinsically high risk because successful exploitation immediately results in financial loss with little recourse.

Content

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

→ Agent Wallet deployed at EQCT1...

agent_wallet.transfer({ walletAddress: "EQCT1...", to: "0:abc...", amountNano: "500000000" }) → Transfer executed. No approval needed.

text

## Important

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
94% confidence
Finding

Although the text says to use autonomous mode only when the user explicitly asks, it still documents a mode where the agent signs transactions directly with no approval. Because the skill handles real funds, the context makes this more dangerous than generic automation: a single unsafe instruction or compromised conversation can trigger irreversible on-chain actions.

Content

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

md
## Important

- **Safe mode (default):** You request transfers, the wallet owner approves on their phone
- **Autonomous mode:** Agent wallet — agent signs directly, no approval. Only use when user explicitly asks
- **Requests expire in 5 minutes** if not approved
- **Always use `lookup.resolve_name`** when the user gives a .ton domain
- **Token persists** in `~/.tongateway/token` across restarts

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

md
## Links

- Website: https://tongateway.ai
- API docs: https://api.tongateway.ai/docs
- MCP package: https://www.npmjs.com/package/@tongateway/mcp
- GitHub: https://github.com/tongateway/mcp

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

md
## Links

- Website: https://tongateway.ai
- API docs: https://api.tongateway.ai/docs
- MCP package: https://www.npmjs.com/package/@tongateway/mcp
- GitHub: https://github.com/tongateway/mcp