Back to skill

Security audit

message-hub-socneo

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed message-hub client, but it handles API keys and message contents over configurable HTTP and overstates message signature verification, so it should be reviewed before use.

Install only if you control the Message Hub endpoint and can use HTTPS for any non-local deployment. Treat all pushed, pulled, and broadcast messages as potentially sensitive and avoid sending secrets. Do not rely on the claimed message signature verification unless the server or downstream client independently verifies messages.

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

T09 · Insecure Skill Coding Practices

Warning
Location
hub_client.py:53
Finding
API Credentials and Message Data Can Be Transmitted over Plaintext HTTP## Vulnerability Details **File Location**: `hub_client.py:53, 62-66, 71-74`; identical code in `message_hub.py:53, 62-66, 71-74` **Vulnerability Type**: Cleartext transmission of sensitive information **Risk Level**: Medium ### Vulnerable Code ```python self.base_url = base_url or os.getenv("MESSAGE_HUB_URL", "http://localhost:8000") self.api_key = api_key or os.getenv("MESSAGE_HUB_API_KEY") self.sender = sender or os.getenv("MESSAGE_HUB_SENDER", "Unknown") self.retry_times = retry_times self.retry_delay = retry_delay if not self.api_key: raise ValueError("API Key must be configured") self.session = requests.Session() self.session.headers.update({ "Content-Type": "application/json", "X-API-Key": self.api_key }) ``` ```python def _request(self, method: str, endpoint: str, data: Optional[Dict] = None) -> Dict: """Send an HTTP request with retries.""" url = f"{self.base_url}{endpoint}" for attempt in range(self.retry_times): try: response = self.session.request(method, url, json=data, timeout=30) response.raise_for_status() return response.json() except requests.exceptions.RequestException as e: if attempt == self.retry_times - 1: raise RetryError(f"Request failed after {self.retry_times} attempts: {e}") time.sleep(self.retry_delay * (attempt + 1)) ``` The insecure configuration is also promoted in the examples at `README.md:23, 39, 111, 120, 144`. ### Technical Analysis The client accepts arbitrary HTTP endpoints and defaults to an `http://` URL. Every request made through the session includes the `X-API-Key` credential. Push requests also contain message contents, sender identities, recipients, and other potentially sensitive metadata. HTTP provides neither transport confidentiality nor server authentication. Although the default loopback address is less exposed, the ...[truncated 1824 chars]
Remediation
## Remediation Suggestions 1. Require HTTPS for every non-loopback Message Hub endpoint. 2. Parse and validate `base_url` during initialization. Reject `http://` unless the hostname is explicitly verified as a loopback address and insecure development mode has been deliberately enabled. 3. Preserve the default TLS certificate and hostname verification behavior of `requests`; do not introduce `verify=False`. 4. Change documentation and examples to use `https://` for all non-local deployments. 5. Consider requiring an explicit option such as `allow_insecure_localhost=True` for local HTTP development rather than silently permitting plaintext transport. 6. Rotate any API key that may previously have been sent over an untrusted plaintext connection. 7. Use narrowly scoped API keys with expiration, revocation, and per-operation authorization to reduce the impact of credential theft. 8. Consider using mutual TLS or another strong client-authentication mechanism for high-trust deployments.

T09 · Insecure Skill Coding Practices

Warning
Location
hub_client.py:80
Finding
Incoming Message Signatures Are Not Verified and Outgoing Signatures Do Not Cover Security-Relevant Fields## Vulnerability Details **File Location**: `hub_client.py:80-88, 107-119, 125-136`; identical code in `message_hub.py:80-88, 107-119, 125-136` **Vulnerability Type**: Incomplete message integrity protection and missing authenticity verification **Risk Level**: Medium ### Vulnerable Code ```python def _sign_message(self, message: Dict) -> str: """Generate a message signature.""" msg_data = json.dumps({ "message_id": message.get("message_id"), "sender": message.get("sender"), "content": message.get("content"), "timestamp": message.get("timestamp") }, sort_keys=True) return hmac.new(self.api_key.encode(), msg_data.encode(), hashlib.sha256).hexdigest() ``` ```python message = { "message_type": message_type, "sender": self.sender, "recipients": recipients, "priority": priority, "task_type": task_type, "content": content, "timestamp": datetime.now().isoformat() } message["signature"] = self._sign_message(message) result = self._request("POST", "/api/v1/message/push", message) return result ``` ```python def pull_messages(self, receiver: Optional[str] = None) -> List[Dict]: """ Pull pending messages. Args: receiver: Recipient, defaulting to the configured sender. Returns: Message list. """ receiver = receiver or self.sender result = self._request("GET", f"/api/v1/message/pull/{receiver}") return result.get("messages", []) ``` The project advertises “Message signature verification” in `SKILL.md:28` and `README.md:10`, but no incoming verification operation exists. ### Technical Analysis `pull_messages()` returns server-supplied message dictionaries directly. It does not reconstruct an authenticated payload, verify an HMAC, compare signatures in constant time, validate timestamp freshness, or reject replayed message identifiers. Consequently, caller ...[truncated 3070 chars]
Remediation
## Remediation Suggestions 1. Implement fail-closed verification for every incoming message before returning it from `pull_messages()`. 2. Define a versioned canonical message format that includes every security-relevant field, including: - Message identifier - Message type - Sender - Recipients - Priority - Task type - Content - Timestamp - Protocol or signature version 3. Ensure a stable message identifier is assigned before calculating the outgoing signature. 4. Use deterministic JSON serialization, including an explicit character encoding and stable separators, or adopt a standardized canonical JSON scheme. 5. Compare HMAC values with `hmac.compare_digest()` to avoid timing-sensitive comparisons. 6. Reject missing, malformed, or invalid signatures rather than returning the message with a warning. 7. Enforce a bounded timestamp acceptance window and maintain replay protection using unique message identifiers or nonces. 8. Use separate, purpose-specific signing credentials where possible instead of directly reusing the API authentication key. 9. Define clear key ownership and sender authorization so possession of one client key cannot forge messages attributed to another sender. 10. Add tests covering modified content, modified recipients, changed message type, changed priority, replayed identifiers, expired timestamps, and malformed signatures. 11. If signature verification is intentionally performed only by the server, remove the unsupported client-side claim from the documentation and clearly state the actual trust boundary.
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 (11)

Credential Access

High
Category
Privilege Escalation
Content
## Configuration Example

### .env File

```bash
# Message Hub Configuration
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The README promotes push and broadcast features, including Feishu group broadcasting, but does not clearly warn that message contents may be sent to external recipients or shared channels. In a collaboration tool, users may transmit sensitive task data, audit results, or credentials-containing payloads without realizing the disclosure scope, increasing the risk of unintended data leakage.

Lp3

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding
The skill advertises network and environment-variable dependent behavior but does not declare any explicit tool scope or permissions boundary. For a communication client that can push, pull, and broadcast messages, this omission weakens reviewability and can lead to unexpected access to secrets or outbound communication when the skill is installed or executed.

Natural-Language Policy Violations

Medium
Confidence
77% confidence
Finding
The natural-language documentation and user-facing descriptions are entirely in Chinese, with no indication that users may choose another language or locale. Per the policy, forcing a specific language without opt-in is a natural-language policy concern unless the locale restriction is explicitly justified.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
This code sends arbitrary message payloads over the network via requests.Session.request, and the payload includes sender, recipients, and content. While the module docstrings describe functionality, there is no explicit warning, confirmation, or user-facing disclosure that user-provided content will be transmitted to an external service.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The client defaults to using plain HTTP (http://localhost:8000) and sends the API key in an X-API-Key header along with message content. If the base URL is changed to any non-local or intercepted network path without TLS, credentials and message data can be exposed to eavesdropping or manipulation in transit.

Missing User Warnings

Low
Confidence
85% confidence
Finding
The examples show pulling messages and printing their contents directly to stdout without warning that messages may contain sensitive or untrusted data. This can expose private information in terminal logs, CI logs, shared shells, screenshots, or monitoring systems, especially in multi-user or automated environments.

Missing User Warnings

Low
Confidence
80% confidence
Finding
The client reads MESSAGE_HUB_API_KEY from the environment and immediately uses it for authentication headers, but there is no visible warning or comment about handling sensitive credentials. For code files, access to sensitive environment variables should have some form of disclosure unless clearly documented elsewhere.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
The natural-language documentation and CLI help text in this file are entirely in Chinese, with no indication that another language is available or that the locale restriction is intentional. The policy requires avoiding fixed language/locale behavior unless the skill offers user choice or clearly justifies a region-specific constraint.

Description-Behavior Mismatch

Low
Confidence
87% confidence
Finding
The manifest presents the skill as an AI team message hub client for async collaboration, which implies ordinary hub messaging primitives. The broadcast_message function is documented and implemented as broadcasting to a Feishu group, introducing a platform-specific mass-messaging capability not reflected in the manifest description.

Description-Behavior Mismatch

Low
Confidence
84% confidence
Finding
The manifest description frames this skill as a client for team messaging and collaboration. In addition to sending and receiving messages, the code queries /api/v1/health and /api/v1/stats, which are operational introspection features rather than core collaboration actions.

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
README.md:29