Back to skill

Security audit

Agent Revenue Analytics: Attribution, LTV, Cohorts, and Pricing Optimization for AI Agent Services

Security checks for vulnerabilities and agentic risk

Overview

This is a revenue analytics guide with purpose-aligned GreenHelix API use, but it under-discloses credential, dependency, and endpoint risks around live financial and customer data.

Install only after reviewing the code and the greenhelix-trading package source/version. Use a sandbox or least-privilege GreenHelix token first, avoid production billing/customer data until endpoints and webhook destinations are verified, and pin dependencies before running the implementation.

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

T08 · Insecure Dependencies

Warning
Location
SKILL.md:1814
Finding
Unpinned Third-Party Package Installation Exposes Credentials and Analytics Data to Supply-Chain Risk## Vulnerability Details **File Location**: `SKILL.md`, lines 1814-1844 **Vulnerability Type**: Unpinned third-party dependency installed from the default package registry **Risk Level**: Medium ### Vulnerable Code ```python The code below uses the actual `greenhelix_trading` library classes. Every method call maps to a real GreenHelix Gateway tool. Copy this module into your project, set `GREENHELIX_API_KEY` and `GREENHELIX_AGENT_ID` in your environment, and run it. """ Requirements: pip install greenhelix-trading """ import os from greenhelix_trading import RevenueTracker, CustomerAnalytics API_KEY = os.environ["GREENHELIX_API_KEY"] AGENT_ID = os.environ["GREENHELIX_AGENT_ID"] ``` ### Technical Analysis The guide instructs users to install `greenhelix-trading` without specifying an exact version, package hash, lockfile, or verified source. The installed package is then imported into a process that has access to `GREENHELIX_API_KEY` and `GREENHELIX_AGENT_ID`. Python packages can execute arbitrary code during installation, import, object construction, and method invocation. Consequently, a compromised package release, registry account, package distribution channel, or unexpectedly changed future version could execute code with the user's privileges. The package also receives the API key directly through constructors elsewhere in the implementation. Although `SKILL.md` describes itself as an educational, non-executable guide, it explicitly directs users to copy, install, and run this implementation. The installation behavior therefore creates a practical software supply-chain exposure. ### Attack Path 1. An attacker compromises the package publisher, distribution account, build pipeline, or a future package release. 2. The attacker publishes a malicious version under the same package name. 3. A user follows the guide and runs `pip install greenhelix-trading` without a version or hash constraint. 4. T ...[truncated 930 chars]
Remediation
## Remediation Suggestions 1. Pin the dependency to an exact, reviewed version rather than installing the latest available release. 2. Publish a lockfile or requirements file containing cryptographic hashes, and install with `pip --require-hashes`. 3. Identify and link to the authoritative package source and independently verify that the registry package is controlled by the expected publisher. 4. Review the package source and release artifacts before recommending it as a production dependency. 5. Install and run the package in an isolated virtual environment or container under a dedicated, unprivileged account. 6. Supply a narrowly scoped API token rather than a broad read/write credential. Rotate the token periodically and immediately after suspected dependency compromise. 7. Avoid exposing credentials globally in the process environment where feasible; use a secret manager and provide credentials only at the point of authorized use. 8. Update the Skill metadata to disclose the installation requirement instead of declaring `install: none`.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:153
Finding
Configurable API Endpoint Can Receive the GreenHelix Bearer Credential## Vulnerability Details **File Location**: `SKILL.md`, lines 153-171 **Vulnerability Type**: Unrestricted destination for authenticated network requests **Risk Level**: Medium ### Vulnerable Code ```python def __init__( self, api_key: str, agent_id: str, base_url: str = "https://api.greenhelix.net/v1", ): self.base_url = base_url self.agent_id = agent_id self.session = requests.Session() self.session.headers.update({ "Content-Type": "application/json", "Authorization": f"Bearer {api_key}", }) def _execute(self, tool: str, input_data: dict) -> dict: """Execute a tool on the GreenHelix gateway.""" resp = self.session.post( f"{self.base_url}/v1", json={"tool": tool, "input": input_data}, ) resp.raise_for_status() return resp.json() ``` ### Technical Analysis The constructor accepts an unrestricted `base_url`, while the GreenHelix bearer token is installed as a default header on the entire HTTP session. Every `_execute` call therefore sends the authorization credential to the configured destination. The code does not enforce HTTPS, validate the destination hostname, restrict the endpoint to an approved GreenHelix origin, or prevent credentials from being attached before origin validation. If configuration data or calling code supplies an attacker-controlled URL, the first analytics request discloses both the bearer credential and its request payload. Network communication with GreenHelix is necessary for the declared revenue-analytics functionality. Allowing the same credential to be sent to an arbitrary host, however, exceeds the minimum privilege needed for that functionality. The default URL also ends in `/v1`, while `_execute` appends another `/v1`, producing `/v1/v1`. This is primarily a correctness defect, but attempts to work around it through custom endpoint configuration may increase the likelihood ...[truncated 1373 chars]
Remediation
## Remediation Suggestions 1. Remove arbitrary endpoint configuration unless it is operationally required. 2. Validate the parsed URL before creating or sending an authenticated request: - Require `https`. - Require an explicit allowlisted hostname, such as `api.greenhelix.net`. - Reject embedded user information, unexpected ports, fragments, and malformed hosts. 3. Keep separate allowlists for production and sandbox endpoints rather than accepting any URL. 4. Attach the `Authorization` header per request only after validating the final request origin; do not install sensitive credentials globally on a reusable session. 5. Disable redirects for authenticated API requests or explicitly validate every redirect destination before forwarding authorization. 6. Correct the path construction so `/v1` is included exactly once. 7. Use a narrowly scoped, revocable token with only the read or write operations required by the selected analytics feature. 8. Avoid logging the session headers, bearer token, webhook configuration, or full sensitive request payloads.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (5)

Intent-Code Divergence

Medium
Confidence
96% confidence
Finding
Lines L0024-L0030 state this is an educational guide using a sandbox where no API key is required to get started. Later, the 'working implementation' at L1814-L1844 immediately reads GREENHELIX_API_KEY and GREENHELIX_AGENT_ID from the environment, which contradicts the earlier guidance rather than merely adding detail.

External Transmission

Medium
Category
Data Exfiltration
Content
self,
        api_key: str,
        agent_id: str,
        base_url: str = "https://api.greenhelix.net/v1",
    ):
        self.base_url = base_url
        self.agent_id = agent_id
Confidence
50% 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
self,
        api_key: str,
        agent_id: str,
        base_url: str = "https://api.greenhelix.net/v1",
    ):
        self.base_url = base_url
        self.agent_id = agent_id
Confidence
50% 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
92% confidence
Finding
The skill encourages users to run production-ready code that accesses billing, payments, identity, marketplace, and webhook data using live credentials, but it does not prominently warn about handling sensitive production data. In a revenue analytics skill, this context increases risk because the data includes financial and operational telemetry that could be exfiltrated, mishandled, or sent to unintended endpoints if copied blindly.

Intent-Code Divergence

Medium
Confidence
93% confidence
Finding
Earlier in the guide, RevenueTracker defines get_revenue_summary(start_date, end_date) and list_invoices(...), but the later implementation documents and calls different methods/signatures such as get_revenue_summary(period=period), get_usage_metrics(...), and get_transaction_history(...). This is an active contradiction between the guide's documented API and the later code, not just an omission.

Static analysis

No suspicious patterns detected.