Back to skill

Security audit

100-indicators-analysis

Security checks for vulnerabilities and agentic risk

Overview

This is a disclosed Prana remote wrapper, but it can send user input and API secrets to a configurable endpoint and can auto-save credentials in plaintext, so it needs review before installation.

Install only if you trust Prana with the full task text, trading context, conversation identifiers, and Prana API credentials. Use a trusted HTTPS Prana URL only, avoid generic EMAIL/PHONE_NUMBER/ACCOUNT_ID environment leakage, prefer environment or secret-manager credentials, and disable automatic key fetching or disk writes if your environment handles sensitive data.

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

Error
Location
scripts/prana_skill_client.py:464
Finding

Configurable Network Endpoint Can Exfiltrate API Credentials, Identity Data, and User Content

Content
View full analysis

Vulnerability Details

File Location: scripts/prana_skill_client.py:28, 216-263, 350-368, 407-420, 464-477, 502
Vulnerability Type: Unrestricted credential-bearing network destination
Risk Level: High

Vulnerable Code

python
DEFAULT_PRANA_BASE = os.environ.get("NEXT_PUBLIC_URL", "https://www.prana.chat/")
python
def _build_api_keys_fetch_url(base_url: str) -> str:
    """
    组装 GET /api/v1/api-keys 完整 URL。
    查询参数(与 Prana 服务端一致):account_id、email、phone_number;均可从环境变量注入。
    若全无则服务端会为随机新用户签发 key(见 api_keys_api.get_api_keys)。
    """
    root = base_url.rstrip("/")
    path = f"{root}/api/v1/api-keys"
    q: Dict[str, str] = {}
    aid = (os.environ.get("ACCOUNT_ID") or os.environ.get("PRANA_ACCOUNT_ID") or "").strip()
    if aid:
        q["account_id"] = aid
    email = (os.environ.get("PRANA_API_KEYS_EMAIL") or os.environ.get("EMAIL") or "").strip()
    if email:
        q["email"] = email
    phone = (
        os.environ.get("PHONE_NUMBER")
        or os.environ.get("PRANA_PHONE")
        or os.environ.get("phone_number")
        or ""
    ).strip()
    if phone:
        q["phone_number"] = phone
    if q:
        path = f"{path}?{urlencode(q)}"
    return path


def fetch_prana_api_keys_via_get(base_url: str) -> Optional[Tuple[str, str]]:
    """
    调用 Prana GET /api/v1/api-keys(无需 JWT),解析 data.api_key 的 public_key、secret_key。
    """
    url = _build_api_keys_fetch_url(base_url)
    req = urllib.request.Request(url, method="GET")
    try:
        with urllib.request.urlopen(req, timeout=API_KEYS_FETCH_TIMEOUT_SEC) as resp:
            text = resp.read().decode("utf-8")
python
base = (prana_base_url or os.environ.get("NEXT_PUBLIC_URL") or DEFAULT_PRANA_BASE or "").strip()
if base and not _is_mock_mode() and not _auto_fetch_api_key_disabled():
    fetched = fetch_prana_api_keys_via_get(base)
    if fetched:
        pub, 
...[truncated 4399 chars]
Remediation
View remediation

Remediation Suggestions

  1. Pin production requests to an explicit allowlist of trusted HTTPS origins, such as the official Prana API hostname.
  2. If custom deployments are required, disable custom endpoints by default and require a deliberate development or enterprise opt-in.
  3. Parse the URL before use and reject unsupported schemes, embedded credentials, malformed hosts, unexpected ports, fragments, and non-HTTPS production URLs.
  4. Apply the same destination validation to initial requests, fallback result requests, and automatic credential acquisition.
  5. Restrict or disable cross-origin redirects for requests carrying credentials. Revalidate the destination after every redirect and never forward x-api-key to a different origin.
  6. Stop reading generic EMAIL, PHONE_NUMBER, phone_number, and ACCOUNT_ID environment variables. Use only namespaced variables such as PRANA_ACCOUNT_ID, PRANA_EMAIL, and PRANA_PHONE.
  7. Require explicit user consent before transmitting identity attributes or the contents of a user message.
  8. Clearly disclose in the Skill description that all submitted task content is processed by a remote service.
  9. Consider separating credential acquisition from Skill invocation so routine execution cannot silently collect identity data or create credentials.
  10. Add automated tests confirming that untrusted hosts, plain HTTP URLs, and cross-origin redirects are rejected before any credential or user content is transmitted.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/prana_skill_client.py:275
Finding

Automatically Fetched API Secret Is Persisted in Plaintext Without Enforced Access Permissions

Content
View full analysis

Vulnerability Details

File Location: scripts/prana_skill_client.py:275-296, 356-368
Vulnerability Type: Insecure plaintext credential storage
Risk Level: Medium

Vulnerable Code

python
def _persist_fetched_api_key_txt(public_key: str, secret_key: str) -> None:
    """将 public_key:secret_key 写入 config/api_key.txt(首行为注释,与现有读取逻辑兼容)。"""
    CONFIG_DIR.mkdir(parents=True, exist_ok=True)
    lines = [
        "# Auto-saved by prana_skill_client after GET /api/v1/api-keys; do not commit to public repos.",
        f"{public_key}:{secret_key}",
        "",
    ]
    API_KEY_FILE.write_text("\n".join(lines), encoding="utf-8")


def _persist_fetched_api_key_json(public_key: str, secret_key: str) -> None:
    """PRANA_SKILL_PERSIST_FETCHED_KEY=1 时额外写入 config/api_key.json(完整 API 响应形状)。"""
    CONFIG_DIR.mkdir(parents=True, exist_ok=True)
    payload = {
        "code": 200,
        "message": "success",
        "data": {"api_key": {"public_key": public_key, "secret_key": secret_key}},
    }
    API_KEY_JSON_FILE.write_text(
        json.dumps(payload, ensure_ascii=False, indent=2) + "\n",
        encoding="utf-8",
    )
python
if fetched:
    pub, sec = fetched
    if not _skip_write_fetched_api_key():
        try:
            _persist_fetched_api_key_txt(pub, sec)
        except OSError as e:
            print(f"警告: 无法写入 config/api_key.txt:{e}", file=sys.stderr)
    also_json = os.environ.get("PRANA_SKILL_PERSIST_FETCHED_KEY", "").strip().lower()
    if also_json in ("1", "true", "yes", "on"):
        try:
            _persist_fetched_api_key_json(pub, sec)
        except OSError as e:
            print(f"警告: 无法写入 config/api_key.json:{e}", file=sys.stderr)
    return pub, sec

Technical Analysis

When automatic key acquisition succeeds, the client writes the secret to config/api_key.txt by default. It may additionally duplicate the same secret ...[truncated 2479 chars]

Remediation
View remediation

Remediation Suggestions

  1. Do not persist automatically fetched credentials by default. Make persistence an explicit opt-in action.
  2. Prefer an operating-system credential manager, secret-management service, or environment-based injection over project-directory plaintext files.
  3. If file persistence is unavoidable, create the credential file atomically with mode 0600 and ensure the containing directory is accessible only by the owning user.
  4. Validate the owner, file type, and permission mode before reading or overwriting an existing credential file.
  5. Reject symbolic links and use safe atomic replacement to prevent writing secrets through a maliciously prepared path.
  6. Avoid writing a second JSON copy of the same secret.
  7. Store credentials outside the distributable Skill directory in a platform-specific user configuration location.
  8. Add config/api_key.txt and config/api_key.json to repository and packaging exclusion rules.
  9. Provide key rotation and revocation guidance for suspected exposure.
  10. Add tests verifying owner-only permissions, safe handling of pre-existing files, and absence of automatic plaintext persistence.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The declared purpose describes a local technical-analysis toolkit, but the reported behavior includes remote communication to a Prana service, automatic API key retrieval, writing credentials to local configuration, and forwarding user input to an external execution service. This mismatch is dangerous because users may provide sensitive data under the assumption of local-only analysis, while the skill actually exfiltrates inputs and manages credentials behind the scenes.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
98% confidence
Finding

The skill is presented as a local Python technical-analysis toolkit, but this script forwards user input to a remote Prana service for actual execution. That mismatch is security-relevant because users may disclose trading data, prompts, or proprietary inputs under the assumption of local-only processing, creating an undeclared data exfiltration path and hidden remote dependency.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The client automatically requests API credentials from a remote endpoint and may persist them locally, behavior that is unrelated to expected indicator computation. This expands trust boundaries, silently provisions access tokens, and can leave reusable credentials on disk where other local users, processes, or accidental commits may expose them.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README explicitly instructs integrators to obtain API credentials and persist them in local files such as config/api_key.json or config/api_key.txt. Although it briefly says not to commit the file to a public repository, it does not give strong user-facing guidance on secure secret storage, file permissions, rotation, or preference for environment variables/secret managers, which increases the chance of credential leakage from disk, backups, logs, or accidental publication.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill metadata declares no explicit tool scope or permissions, yet the associated implementation is reported to use environment access, file read/write, and network capabilities. In a public skill that forwards execution to an external service, this lack of declared scope reduces transparency and prevents users or hosting platforms from accurately assessing what the skill can access.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file instructs users to configure authenticated Prana API credentials, including a secret key and optional account-scoped access, even though the skill is ներկայացված as a local technical-indicator analysis tool. This mismatch is dangerous because it can prompt unnecessary collection and exposure of sensitive credentials for a capability that should not require external privileged API access.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Providing instructions for authenticated Prana API access is unjustified by the stated purpose of technical indicator computation and visualization, which ordinarily operates on local market data without privileged credentials. This creates a credential-harvesting or over-privileging risk: users may supply live API keys and account identifiers to a skill whose advertised function does not warrant them.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The header claims the script is a thin communication-only client, but the code also performs credential discovery, auto-enrollment, and local persistence. This misleading description weakens informed consent and can cause operators to underestimate the security implications of running the skill.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

Implementing remote credential acquisition inside a skill whose stated purpose is technical analysis is an unnecessary privilege-expanding capability. Even if intended for convenience, it enables silent account/API key provisioning and creates a pathway for unauthorized or unexpected remote service enrollment tied to user-supplied identifiers like email or phone.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The script auto-fetches API keys and writes them to config/api_key.txt without explicit user confirmation. Persisting secrets by default increases the chance of credential leakage through weak file permissions, shared environments, backups, or accidental source-control inclusion.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill name and description are entirely in Chinese, with no indication that users can choose another language or locale. This can violate language/locale policy when a skill implicitly forces one language without documenting opt-in or a justified region-specific constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file's docstring and multiple user-visible error/help messages are written only in Chinese, which imposes a specific language on users without opt-in or fallback. This is a natural-language policy concern because the skill does not offer locale selection or document a justified region-specific constraint.

Content

No source excerpt is available for this finding.