Back to skill

Security audit

Secure P2p Messenger Real

Security checks for vulnerabilities and agentic risk

Overview

This is a local encrypted-messaging tool, but it overstates important security guarantees and can mislead users about encryption, authentication, metadata protection, and key safety.

Install only if you treat this as experimental local tooling, not a reliable secure messenger. Do not use it for confidential contracts, credentials, legal material, or agent-to-agent trust decisions until the crypto implementation is corrected, sender signatures and metadata authentication are added, contact IDs are validated, private-key storage is hardened, and the documentation accurately reflects what is implemented.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
secure-messenger.sh:100
Finding

Cryptographic failures are suppressed and reported as successful authenticated encryption

Content
View full analysis
/dev/null) # 使用对方公钥加密会话密钥 local encrypted_key=$(echo -n "$session_key" | openssl rsautl -encrypt -pubin -inkey "$CONTACTS_DIR/$recipient.pub" -oaep | base64 -w0) # 创建消息包 local message_package=$(cat </dev/null) echo -e "${GREEN}✅ 消息解密成功!${NC}" echo "" echo -e "${YELLOW}📨 来自 $sender 的消息:${NC}" echo "$decrypted_msg" ``` ### Technical Analysis The script redirects OpenSSL error output to `/dev/null` and does not inspect the exit status of either the encryption or decryption command. Standard `openssl enc` implementations do not support AEAD modes such as GCM, so the command can fail without producing valid ciphertext. Nevertheless, the script continues and reports that encryption or decryption succeeded. The generated package also has no authentication-tag field. AES-GCM requires an authentication tag to verify ciphertext integrity. Without producing, transporting, and verifying that tag, the implementation does not provide its advertised authenticated-encryption guarantee. The shell does not enable `set -e` or `set -o pipefail` in the main script. A failure inside a command substitution or pipeline therefore does not reliably stop execution. ### Attack Path 1. A user invokes `secure-messenger.sh send` with sensitive plaintext. 2. The `ope ...[truncated 1064 chars]
Remediation
View remediation
/dev/null` suppression or capture and report sanitized errors. - Enable strict shell behavior, including `set -euo pipefail`, while explicitly handling expected failures. - Refuse to emit a message package if encryption, key wrapping, JSON construction, or Base64 encoding fails. - Refuse to display a success message unless decryption and authentication both complete successfully. - Add negative tests for malformed ciphertext, missing tags, invalid IVs, invalid keys, and unsupported OpenSSL versions. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
secure-messenger.sh:107
Finding

Message sender identity and metadata are not authenticated

Content
View full analysis
/dev/null) if [ -z "$session_key" ]; then echo -e "${RED}❌ 解密失败:无效的消息包或密钥不匹配${NC}" return 1 fi # 使用AES解密消息 local decrypted_msg=$(echo "$encrypted_msg" | openssl enc -aes-256-gcm -d -K "$session_key" -iv "$iv" -a -A 2>/dev/null) echo -e "${GREEN}✅ 消息解密成功!${NC}" echo "" echo -e "${YELLOW}📨 来自 $sender 的消息:${NC}" echo "$decrypted_msg" ``` ### Technical Analysis The sender, recipient, timestamp, IV, wrapped session key, and ciphertext are not signed. The receiver reads `.sender` directly from attacker-supplied JSON and displays it as the verified message origin. The receive path does not retrieve the claimed sender's contact public key and does not verify a signature. RSA encryption to the recipient proves only that the recipient can unwrap a session key; it does not prove who created the package. Anyone with the recipient's public key can construct a package addressed to that recipient and place an arbitrary identity in the `sender` field. The metadata is also not included as authenticated additional data. Consequently, even a corrected AES-GCM ciphertext implementat ...[truncated 1309 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
secure-messenger.sh:63
Finding

Unvalidated contact identifiers allow directory traversal and unauthorized file writes

Content
View full analysis
<姓名> <公钥base64>${NC}" return 1 fi echo "$public_key" | base64 -d > "$CONTACTS_DIR/$contact_id.pub" 2>/dev/null echo "$contact_name" > "$CONTACTS_DIR/$contact_id.name" echo -e "${GREEN}✅ 联系人 $contact_name 添加成功!${NC}" } ``` ### Technical Analysis The `contact_id` argument is concatenated directly into two filesystem paths. Shell quoting prevents word splitting and shell metacharacter expansion, but it does not prevent path normalization of `../` components or absolute-path-like input. A value containing traversal sequences can cause the `.pub` and `.name` files to be written outside `CONTACTS_DIR`. The appended suffixes constrain the final filenames, but they do not enforce the intended directory boundary. Existing files with those suffixes can also be truncated and overwritten. The function additionally suppresses Base64-decoding errors and announces success without validating the decoded key or checking both write operations. ### Attack Path 1. An attacker or untrusted caller controls the contact ID passed to `add-contact`. 2. The caller supplies an ID containing traversal components, such as `../attacker`. 3. The generated destination becomes: - `~/.openclaw/secure-p2p/contacts/../attacker.pub` - `~/.openclaw/secure-p2p/contacts/../attacker.name` 4. Files are therefore created in `~/.openclaw/secure-p2p` rather than the contacts directory. 5. Additional `../` components can reach other existing directories writable by the current user. 6. The attacke ...[truncated 541 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
secure-messenger.sh:22
Finding

Long-term identity key is unencrypted and silently replaced during reinitialization

Content
View full analysis
/dev/null openssl rsa -in "$KEYRING_DIR/private.pem" -pubout -out "$KEYRING_DIR/public.pem" 2>/dev/null # 生成身份ID local identity_id="claw_$(openssl rand -hex 12)" echo "$identity_id" > "$CONFIG_DIR/identity.id" # 生成指纹 local fingerprint=$(openssl dgst -sha256 "$KEYRING_DIR/public.pem" | awk '{print $2}' | cut -c 1-16) echo "$fingerprint" > "$CONFIG_DIR/fingerprint.txt" ``` The installer only applies directory-level protection: ```bash # 创建配置目录 CONFIG_DIR="$HOME/.openclaw/secure-p2p" KEYRING_DIR="$CONFIG_DIR/keyring" LOG_DIR="$CONFIG_DIR/logs" echo "📁 创建配置目录..." mkdir -p "$KEYRING_DIR" "$LOG_DIR" # 设置权限 chmod 700 "$KEYRING_DIR" ``` ### Technical Analysis The RSA private key is generated without passphrase protection and remains a reusable long-term identity secret. The implementation does not support an operating-system key store or another mechanism that protects the key at rest. The `init` function does not check whether `private.pem`, `public.pem`, or `identity.id` already exists. Running it again writes directly to the same paths and silently replaces the established identity. There is no backup, confirmation, atomic replacement, recovery mechanism, or explicit key-rotation workflow. Although the installer restricts access to the keyring directory, it does not establish a restrictive process-wide `umask` or explicitly enforce mode `600` on the private-key file after generation. Secure behavior is therefore unnecessarily dependent on tool and environment de ...[truncated 1396 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (38)

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill claims perfect forward secrecy, but the documented design uses long-term RSA identity keys to encrypt per-message session keys. If the long-term private key is later compromised, previously captured encrypted session keys can be decrypted, so past communications are not protected as claimed.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The document claims metadata protection, but the published message format exposes sender, recipient, and timestamp in plaintext. Users may assume their communication graph and timing are hidden when they are actually visible to intermediaries or observers, enabling traffic analysis and privacy loss.

Content

No source excerpt is available for this finding.

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 · install.sh (reported line 72)May include surrounding context.

sh
# 创建环境文件
echo "🌍 设置环境变量..."
cat > "$CONFIG_DIR/.env" << 'EOF'
# 安全点对点加密通讯配置
export SECURE_P2P_HOME="$HOME/.openclaw/secure-p2p"
export SECURE_P2P_KEYRING="$SECURE_P2P_HOME/keyring"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 25)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 29)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 32)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 75)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 85)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 17)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 26)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 31)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 38)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 44)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 56)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 152)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 25)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · install.sh (reported line 75)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · secure-messenger.sh (reported line 17)May include surrounding context.

sh
# 配置目录
CONFIG_DIR="$HOME/.openclaw/secure-p2p"
KEYRING_DIR="$CONFIG_DIR/keyring"
CONTACTS_DIR="$CONFIG_DIR/contacts"
LOG_DIR="$CONFIG_DIR/logs"

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

This line generates and stores an unencrypted private key on disk, which is sensitive credential material. If local filesystem protections are weak or the endpoint is later compromised, the private key can be stolen and used to impersonate the user or decrypt messages addressed to them.

Content

Scanner excerpt · secure-messenger.sh (reported line 30)May include surrounding context.

sh
# 生成RSA密钥对
    echo -e "${BLUE}生成RSA-2048密钥对...${NC}"
    openssl genrsa -out "$KEYRING_DIR/private.pem" 2048 2>/dev/null
    openssl rsa -in "$KEYRING_DIR/private.pem" -pubout -out "$KEYRING_DIR/public.pem" 2>/dev/null
    
    # 生成身份ID

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file describes transmitting sensitive files such as a confidential contract draft, but it does not include any user-facing warning about verifying recipient identity, handling metadata exposure, or the risks of sending sensitive data through external channels. For a skill involving encrypted messaging and file transfer, the README should disclose important safety considerations that could affect user data and privacy.

Content

No source excerpt is available for this finding.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

  1. openssl命令找不到
    bash
    # Debian/Ubuntu
    sudo apt-get install openssl
    
    # macOS
    brew install openssl
    

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

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

  1. openssl命令找不到
    bash
    # Debian/Ubuntu
    sudo apt-get install openssl
    
    # macOS
    brew install openssl
    

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill declares a shell-based installer and requires shell binaries, but it does not define an explicit tool scope such as permissions or allowed-tools. That creates an authorization ambiguity where an agent or platform may permit broader shell execution than users expect, increasing the risk of unintended system changes during installation or use.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The manifest description forces a specific language presentation without any indication that users can opt into another language or that the skill is intentionally limited to a Chinese-speaking context. This can violate language/locale policy when no user choice or justification is provided.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The skill promises local encrypted storage of communication records, but the implemented feature list does not confirm that encrypted record storage exists. This can cause users to store sensitive logs locally under the false assumption they are protected at rest.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.