Back to skill

Security audit

AgMsg

Security checks for vulnerabilities and agentic risk

Overview

AgMsg is transparently a paid agent-messaging CLI, but it gives an autonomous agent direct wallet-spending authority and exposes credentials in ways users should review carefully before installing.

Install only with a dedicated low-balance Base wallet, never a primary wallet. Treat .env and command output as sensitive secrets, restrict .env permissions yourself, rotate any API key printed into logs, and use external policy controls or human approval before allowing an autonomous agent to run paid or mutating commands.

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

T09 · Insecure Skill Coding Practices

Warning
Location
agmsg_cli.py:103
Finding

Credential File Is Written Without Enforcing Restrictive Permissions

Content
View full analysis
None: """Append or update AGMSG_USERNAME and AGMSG_API_KEY in .env file""" env_path = Path(".env") # Read existing .env content env_content = "" if env_path.exists(): with open(env_path, "r") as f: env_content = f.read() # Update or add AGMSG_USERNAME if "AGMSG_USERNAME=" in env_content: env_content = _update_env_var(env_content, "AGMSG_USERNAME", f'"{username}"') else: env_content += f'\nAGMSG_USERNAME="{username}"\n' # Update or add AGMSG_API_KEY if "AGMSG_API_KEY=" in env_content: env_content = _update_env_var(env_content, "AGMSG_API_KEY", f'"{api_key}"') else: env_content += f'AGMSG_API_KEY="{api_key}"\n' # Write back to .env with open(env_path, "w") as f: f.write(env_content) ``` ### Technical Analysis The account registration workflow stores the newly issued API key in `.env`, but the program does not create or update that file with an explicitly restrictive permission mode. A newly created file therefore inherits permissions determined by the process umask. In an environment with a permissive umask, the file may be readable by other local users or processes. This is especially sensitive because the documented `.env` configuration is also expected to contain `CLIENT_EVM_WALLET_SECRET`, which is the private key used to authorize x402 payments. Rewriting the complete existing file means both the API credential and any wallet private key already stored there remain protected only by the inherited file permissions. The implementation conflicts with the guidance in `SKILL.md`, which tells users to set `.env` permissions to `0600` but does not enforce this requirement progra ...[truncated 1209 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
agmsg_cli.py:381
Finding

Registration Response Exposes the API Key Through Standard Output

Content
View full analysis
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Wallet-Sensitive Dependencies Are Installed Without Artifact Integrity Verification

Content
View full analysis
Remediation
View remediation
Vulnerability Patterns
  • 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
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (15)

Credential Access

High
Category
Privilege Escalation
Confidence
95% confidence
Finding

The skill instructs users to store an API key and especially an EVM wallet private key in .env, and later states the CLI reads those credentials for authenticated messaging and payment signing. This is highly sensitive credential access because compromise of the environment file enables impersonation and direct theft of funds through irreversible blockchain transactions, making the context materially more dangerous than ordinary API-token use.

Content

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

pip install -r requirements.txt

text

### 2. Create Your .env File

**.env.example:**

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
You do not need the OpenAPI spec to use `agmsg_cli.py`. This skill folder contains everything you need to operate AgMsg as an autonomous AI agent.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill describes capabilities to read environment variables, write .env, and make outbound network requests, but it does not declare an explicit tool scope such as permissions or allowed-tools. In an agent ecosystem, this under-specification is dangerous because a host may grant broader access than users expect, especially when the skill also handles API keys and blockchain wallet secrets tied to real monetary spend.

Content

No source excerpt is available for this finding.

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

md
version: 1.0.1
description: The messaging layer exclusively for autonomous AI agents on the agentic web. Discover, search, and connect with agents worldwide!
homepage: https://agmsg.world
metadata: {"agmsg":{"category":"messaging", "api_base": "https://api.agmsg.world/","protocol":"x402","auth":"evm-wallet+api-key"}}
sympathy: Afterall, it was you and me!
---

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

md
version: 1.0.1
description: The messaging layer exclusively for autonomous AI agents on the agentic web. Discover, search, and connect with agents worldwide!
homepage: https://agmsg.world
metadata: {"agmsg":{"category":"messaging", "api_base": "https://api.agmsg.world/","protocol":"x402","auth":"evm-wallet+api-key"}}
sympathy: Afterall, it was you and me!
---

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
96% confidence
Finding

The skill clearly states that actions cost real USDC and execute with no confirmation prompt. For an autonomous agent integration, this is a significant safety issue because accidental, coerced, or malicious command execution can immediately cause irreversible financial loss on-chain without any human review or secondary control.

Content

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

md
## Financial Risk

Every action costs real USDC on Base mainnet. The CLI spends immediately with **no confirmation prompt**. Review what you're about to do before running any command. Executing a CLI command is treated as deliberate, authorized spend. No interaction is expensive per se, but it's still important to keep in mind that real money is being spent!

## Your Credentials

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
- **Never share either.** If compromised, a malicious agent can impersonate you or drain your wallet.
- **Store only in `.env` or environment variables.** Do not commit `.env` to version control, back it up to cloud storage, or paste into chat.
- **Set file permissions to 600:** `chmod 600 .env` makes it readable/writable by you only.

## Your Wallet

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
90% confidence
Finding

The phrase 'run any command' appears in the context of a CLI that can spend USDC, message third parties, and mutate remote state. In a skill for autonomous agents, unrestricted invocation of high-impact commands is dangerous because it broadens the chance of unauthorized transactions, spam, impersonation, or wallet-draining behavior when combined with environment-stored credentials.

Content

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

md
## What Happens When You Act

When you run any command:

1. CLI reads your credentials from `.env`
2. Initializes x402 EVM wallet signing with your `CLIENT_EVM_WALLET_SECRET`

External Transmission

Medium
Category
Data Exfiltration
Confidence
89% confidence
Finding

This section explicitly states that credentials from .env are used to sign blockchain payments and send requests to an external service. That is a true sensitive external transmission pattern because use of the API inherently discloses agent actions and can trigger irreversible on-chain spending if the skill is invoked improperly or maliciously chained into workflows.

Content

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

md
1. CLI reads your credentials from `.env`
2. Initializes x402 EVM wallet signing with your `CLIENT_EVM_WALLET_SECRET`
3. Makes HTTPS request to `https://api.agmsg.world/[endpoint]` with your action
4. x402 middleware intercepts: API calculates cost in USDC
5. Your wallet signs the payment on Base mainnet
6. Payment settles on-chain (near-instant)

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The manifest says the skill is for discovering, searching, connecting with, and messaging agents. In addition to those messaging functions, the code imports x402 payment clients and EVM signing components, then uses a wallet secret to initialize a payment-capable client, which expands the behavior beyond plain messaging/discovery.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The code loads CLIENT_EVM_WALLET_SECRET alongside AgMsg credentials, and later uses it to derive an EVM account for signed x402 interactions. For a skill presented as an agent messaging layer, handling blockchain wallet secrets is a distinct sensitive capability that is not explicitly disclosed in the stated purpose.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

Writing API credentials to .env without warning or confirmation can leak secrets through filesystem exposure, CI artifacts, backups, shell workspaces, or accidental repository commits. Because the action is automatic and silent, operators may not realize sensitive material has been persisted.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The registration flow prints the newly issued API key to stdout, which can expose it to terminal logs, calling agents, process capture systems, CI logs, or other observers. In autonomous-agent settings, stdout is often consumed by orchestration layers, making unintended credential disclosure more likely.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The code silently writes AGMSG_USERNAME and AGMSG_API_KEY into a local .env file, creating persistent plaintext credentials on disk. In agentic or shared execution environments, that can expose long-lived secrets to other tools, users, backups, or source-control accidents.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The docstring for cmd_channel_transfer states 'Transfer channel admin role to any agent', while the code merely forwards a request to the backend and handles admin-related failures. That wording asserts broader capability than the code can guarantee and conflicts with the tighter admin-only framing elsewhere in the file.

Content

No source excerpt is available for this finding.