Back to skill

Security audit

Cortex Protocol

Security checks for vulnerabilities and agentic risk

Overview

The skill is for agent identity registration and mostly matches that purpose, but it handles wallet credentials and public identity registration in ways users should review carefully.

Install only if you are comfortable registering an agent identity through Cortex Protocol and Base. Provide your own securely managed controller address, avoid the wallet-generation path that prints a private key, use a non-sensitive explicit agent name instead of a host-derived default, and inspect the registration payload before sending it.

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

Error
Location
register.sh:29
Finding
Generated Controller Private Key Is Exposed in Standard Output<![CDATA[ ## Vulnerability Details **File Location**: `register.sh:29-35` **Vulnerability Type**: Plaintext disclosure of sensitive wallet credentials **Risk Level**: High ### Vulnerable Code ```bash CONTROLLER=$(echo "$WALLET_OUTPUT" | jq -r '.address') PRIVATE_KEY=$(echo "$WALLET_OUTPUT" | jq -r '.privateKey') echo "✅ Wallet generated:" echo " Address: $CONTROLLER" echo " Private Key: $PRIVATE_KEY" echo "" echo "⚠️ SAVE YOUR PRIVATE KEY — you'll need it to control your identity." ``` ### Technical Analysis When no controller address is supplied, the script generates a new Ethereum wallet and prints its private key directly to standard output. Standard output is not an appropriate secret-storage channel because it may be captured by CI/CD logs, terminal recording software, agent transcripts, remote execution systems, shell session managers, or centralized logging infrastructure. The private key is the sole credential controlling the generated Ethereum address. Although the script does not transmit the key to the Cortex API, disclosing it through output unnecessarily expands the number of systems and users that may obtain it. This behavior exceeds the minimum privilege and data exposure required for registration. Registration only requires the public controller address; ordinary application output does not need to contain the controller's private key. ### Attack Path 1. A user invokes `register.sh` without providing an existing controller address. 2. The script generates a wallet and extracts its private key. 3. The script prints the private key to standard output. 4. A CI logger, agent transcript, terminal recorder, support log, or another user with access to captured output obtains the key. 5. The attacker imports the exposed key into an Ethereum wallet. 6. The attacker can perform any action authorized to the generated controller address, subject to the relevant smart contract's controller permissions. ### Impact Assessment An attacker who ...[truncated 314 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Require users to provide an existing, securely managed controller address by default. - If wallet generation must remain available, store the private key in an encrypted keystore or dedicated secret manager rather than printing it. - Create any local secret file with restrictive permissions, such as mode `0600`, and avoid predictable paths. - Print only the public controller address and the location of the protected keystore. - Display an explicit warning before generating a wallet and require affirmative user consent. - Ensure CI and automated environments cannot invoke secret generation unless a secure output mechanism is configured. - Document backup and recovery procedures without exposing the raw key in logs. ]]>

T08 · Insecure Dependencies

Warning
Location
register.sh:21
Finding
Unpinned Global Installation of a Wallet-Handling Dependency Is Recommended<![CDATA[ ## Vulnerability Details **File Location**: `register.sh:21` **Vulnerability Type**: Unsafe and unpinned third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```bash echo "❌ Node.js with ethers required to generate wallet. Install: npm i -g ethers" ``` ### Technical Analysis The error message directs users to install the latest available `ethers` package globally without specifying a reviewed version, lockfile, or integrity value. Because this dependency is used to generate private keys, compromise or unexpected behavior in the installed package would affect a highly sensitive operation. A global installation also changes the user's environment beyond what is necessary for one Skill invocation. The effective package version may change over time, meaning the code executed during installation and wallet generation is not fully represented by the audited project. This is a supply-chain exposure rather than evidence that the current `ethers` package is malicious. Exploitation depends on compromise of the package source, account, distribution path, or an unsafe future release. ### Attack Path 1. The script cannot load the required `ethers` dependency. 2. The user follows the displayed instruction and runs `npm i -g ethers`. 3. npm resolves the current package version rather than a version reviewed with this Skill. 4. If the registry package, maintainer account, dependency tree, or distribution channel has been compromised, malicious installation or runtime code executes with the invoking user's privileges. 5. Because the package participates in wallet generation, malicious code could also steal or manipulate generated wallet credentials. ### Impact Assessment Potential impact includes arbitrary code execution with the privileges of the user performing the npm installation, modification of the user's global Node.js environment, and theft or substitution of generated wallet credentials. The actual impact is conditional on d ...[truncated 118 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Use a project-local dependency manifest and lockfile instead of recommending global installation. - Pin `ethers` to a reviewed exact version and retain package integrity metadata in the lockfile. - Install dependencies with a reproducible command such as `npm ci`. - Review transitive dependencies and use automated dependency and provenance verification. - Avoid running package installation with elevated privileges. - Consider removing wallet generation from the registration script and requiring a controller address produced by an established wallet or keystore. - If automatic installation is not essential, fail safely and provide documentation rather than directing users to modify their global environment. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
register.sh:45
Finding
Unescaped User Input Is Interpolated into the Registration JSON Payload<![CDATA[ ## Vulnerability Details **File Location**: `register.sh:45-52` **Vulnerability Type**: JSON structure injection and missing input validation **Risk Level**: Medium ### Vulnerable Code ```bash RESPONSE=$(curl -s -X POST "$API" \ -H "Content-Type: application/json" \ -d "{ \"name\": \"$NAME\", \"controller\": \"$CONTROLLER\", \"metadataURI\": \"\" }") ``` ### Technical Analysis The script directly interpolates the user-controlled `NAME` and `CONTROLLER` shell variables into a JSON string. It does not JSON-encode either value or validate the controller as an Ethereum address. A value containing quotation marks, backslashes, line breaks, or JSON syntax can terminate its intended string and alter or invalidate the request structure. Depending on the API parser's handling of duplicate properties and server-side validation, a crafted value may add or replace request fields. This is not shell command injection: shell metacharacters introduced through ordinary parameter expansion are not reparsed as shell syntax. The flaw is confined to construction of the outbound JSON request and its interpretation by the remote API. ### Attack Path 1. An attacker or untrusted caller supplies a crafted agent name or controller argument containing JSON delimiters. 2. The script inserts the value directly between JSON quotation marks. 3. The resulting request body becomes malformed or contains attacker-introduced properties. 4. The body is sent to `https://cortexprotocol.co/api/register`. 5. If the remote API accepts the altered structure or resolves duplicate fields in the attacker's favor, registration data may differ from what the user intended. Otherwise, the request fails, enabling denial of the registration operation. ### Impact Assessment The immediate impact includes malformed requests, registration failure, and possible manipulation of registration fields accepted by the remote service. The issue does not provide local command execution or ...[truncated 155 chars]
Remediation
<![CDATA[ ## Remediation Suggestions - Construct the payload with a JSON-aware tool instead of string interpolation. For example: ```bash PAYLOAD=$(jq -n \ --arg name "$NAME" \ --arg controller "$CONTROLLER" \ --arg metadataURI "" \ '{name: $name, controller: $controller, metadataURI: $metadataURI}') RESPONSE=$(curl --fail-with-body --silent --show-error \ -X POST "$API" \ -H "Content-Type: application/json" \ --data-binary "$PAYLOAD") ``` - Validate the controller address before sending it, including the expected `0x` prefix and 40 hexadecimal address characters. - Apply documented length and character restrictions to the agent name. - Reject control characters and invalid input with a clear error. - Use `curl --fail-with-body --silent --show-error` and explicitly handle transport failures. - Validate that the response is valid JSON before extracting properties with `jq`. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (6)

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill includes shell commands that perform network actions and wallet-related operations, but it does not declare any tool scope or allowed-tools metadata. In an agent ecosystem, this weakens reviewability and can cause users or orchestrators to permit broader execution than intended, increasing the chance of unintended command execution and data egress.

External Transmission

Medium
Category
Data Exfiltration
Content
Register your agent with a single API call:

```bash
curl -X POST https://cortexprotocol.co/api/register \
  -H "Content-Type: application/json" \
  -d '{
    "name": "YourAgentName",
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
98% confidence
Finding
The skill instructs users to generate a wallet and print the private key directly to stdout with no warning or secure handling guidance. Private keys shown in terminals, logs, transcripts, agent output, or telemetry can be copied by other processes or retained in history, leading to permanent compromise of the wallet and any assets or identity tied to it.

External Transmission

Medium
Category
Data Exfiltration
Content
```bash
# Check your agent exists
curl -s "https://mainnet.base.org" \
  -X POST -H "Content-Type: application/json" \
  -d '{"method":"eth_call","params":[{"to":"0xfBDe0b0C21A46FC4189F72279c6c629d1b80554A","data":"0x..."},"latest"],"id":1,"jsonrpc":"2.0"}'
```
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
echo "   Controller: $CONTROLLER"
echo ""

RESPONSE=$(curl -s -X POST "$API" \
  -H "Content-Type: application/json" \
  -d "{
    \"name\": \"$NAME\",
Confidence
94% confidence
Finding
The script transmits user-supplied agent metadata and the controller address to an external service without any validation, trust verification, or clear disclosure beyond the API URL. In this skill’s context, that is security-relevant because it causes on-chain identity registration through a third-party endpoint and may expose sensitive operational metadata or bind an identity to an unintended controller if inputs are manipulated.

Missing User Warnings

Low
Confidence
92% confidence
Finding
The registration script sends host-derived identity data, including a hostname-based name and controller address, to a third-party API without warning about disclosure or consent. This can leak infrastructure naming conventions and link an agent or environment to a public on-chain identity, creating unnecessary privacy and attribution risks.

Static analysis

No suspicious patterns detected.