Back to skill

Security audit

CCDB Factor Search

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate CCDB carbon-factor lookup purpose, but it can send business-derived search terms to external or overridden endpoints without clear user confirmation or endpoint containment.

Install only if users understand that factor-search terms may be sent to Carbonstop or to a configured replacement endpoint. In sensitive business environments, require explicit confirmation before remote lookup, avoid submitting full BOMs or supplier-identifying details, and restrict the base URL to the intended Carbonstop endpoint.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/query_ccdb.py:18
Finding

Unrestricted API Endpoint Override Enables SSRF and Search-Query Disclosure

Content
View full analysis

Vulnerability Details

File Location: scripts/query_ccdb.py:18-21, 412-420, 492
Vulnerability Type: Server-Side Request Forgery (SSRF) and data redirection
Risk Level: Medium

Vulnerable Code

python
DEFAULT_BASE_URL = os.environ.get(
    "CCDB_API_BASE_URL",
    "https://gateway.carbonstop.com/management/system/website/queryFactorListClaw",
)
python
def query_api(base_url: str, name: str, lang: str) -> dict:
    payload = {'sign': make_sign(name), 'name': name, 'lang': lang}
    body = json.dumps(payload, ensure_ascii=False).encode('utf-8')
    headers = {
        'Accept': 'application/json, text/plain, */*',
        'Content-Type': 'application/json',
        'User-Agent': 'OpenClaw-CCDB-Skill/1.0',
    }
    req = Request(base_url, data=body, headers=headers, method='POST')
    try:
        with urlopen(req, timeout=30) as resp:
            raw = resp.read().decode('utf-8', errors='replace')
python
parser.add_argument('--base-url', default=DEFAULT_BASE_URL)

Technical Analysis

The script allows the API destination to be replaced through either the CCDB_API_BASE_URL environment variable or the --base-url command-line option. The supplied URL is passed directly to urllib.request.Request and urlopen without validating its scheme, hostname, port, resolved IP address, path, or redirect destination.

This exceeds the minimum network privilege required for the declared functionality. CCDB factor lookup only requires access to the documented Carbonstop HTTPS endpoint, whereas the implementation can issue POST requests to arbitrary Internet or internal-network destinations.

The request body contains the user-derived search term, language, and an MD5-derived signature:

json
{
  "sign": "<derived signature>",
  "name": "<user-derived search term>",
  "lang": "<language>"
}

The default Carbonstop request is necessary and documented. The vulnerability arises specifically from allowing unrestricted destina ...[truncated 1762 chars]

Remediation
View remediation

Remediation Suggestions

  1. Remove --base-url and CCDB_API_BASE_URL from production builds unless custom endpoints are an explicit operational requirement.
  2. Allowlist the exact destination:
    • Scheme: https
    • Host: gateway.carbonstop.com
    • Port: 443
    • Approved API path or paths only
  3. Reject URLs containing user information, fragments, unexpected ports, non-HTTPS schemes, or malformed hostnames.
  4. Resolve the hostname and reject loopback, private, link-local, multicast, reserved, and unspecified IP ranges for both IPv4 and IPv6.
  5. Disable redirects, or validate every redirect target using the same scheme, hostname, path, and IP-address controls.
  6. Ensure endpoint configuration can only be changed by a trusted administrator and cannot be derived from user prompts or untrusted task input.
  7. Document that search terms are transmitted to Carbonstop and advise callers not to include complete BOMs, supplier identities, credentials, personal data, or unrelated confidential content.
  8. Add automated tests covering malicious destinations such as localhost, private IP addresses, link-local addresses, HTTP URLs, alternate ports, credential-bearing URLs, and cross-host redirects.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • System Prompt LeakageDirect Leakage, Indirect Extraction, Tool-Based Exfiltration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (27)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
85% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

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

md
- a few nearby synonyms where needed

### 3. Rank candidates instead of trusting the first hit
Do not judge a factor from one field only.
Key ranking dimensions include:
- semantic fit (`name`, `description`, `specification`)
- region fit (`countries`)

Anti-Refusal Statement

High
Category
Anti-Refusal
Confidence
85% confidence
Finding

Skill instructs the agent to omit warnings, disclaimers, or ethical commentary. Stripping safety caveats hides risk from the user and is a common jailbreak preamble.

Content

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

md
- a few nearby synonyms where needed

### 3. Rank candidates instead of trusting the first hit
Do not judge a factor from one field only.
Key ranking dimensions include:
- semantic fit (`name`, `description`, `specification`)
- region fit (`countries`)

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

print(resp.json())

text

Even in fallback mode, apply the same ranking, matching, and output rules defined above. Do not return raw API results without analysis.

---

Direct Prompt Extraction

High
Category
System Prompt Leakage
Confidence
85% confidence
Finding

Skill contains instructions that could directly expose system prompts, internal rules, or hidden instructions to users or external parties.

Content

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

print(resp.json())

text

Even in fallback mode, apply the same ranking, matching, and output rules defined above. Do not return raw API results without analysis.

---

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
- `SKILL.md`

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Line L17 states the skill adds a "China-first bias for Chinese requests without explicit region on geo-sensitive factors." This is a natural-language locale policy concern because it applies a region-specific preference based on language alone, without indicating user choice or a clearly documented region-specific compliance requirement.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The notes describe an external Carbonstop CCDB API dependency and configurable endpoint, but provide no user-facing disclosure that user-derived search terms may be transmitted off-platform. In a skill that extracts and refines natural-language requests, this can expose sensitive commercial, product, or supply-chain information entered by users, especially if they do not expect third-party processing.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The README says to 'activate proactively' when a task 'clearly needs factor data' or when a user provides BOM/material data for carbon footprint work, but it does not define precise trigger phrases, exclusions, or negative examples. This creates ambiguity about when the skill should activate versus when a user may simply be discussing related topics, increasing the risk of unintended invocation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README directs the skill to prefer Chinese candidates by default whenever the request is in Chinese and no region is specified. This ties output locale/region behavior to language rather than explicit user choice, which is a natural-language policy issue unless the regional constraint is clearly justified and accepted by the user.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
95% confidence
Finding

The documented curl fallback instructs direct POST requests to an external API with user-derived query terms. Even though this is operationally relevant to the skill, it still represents external transmission of potentially sensitive prompts or business data and increases risk if agents automatically follow fallback instructions.

Content

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

If scripts/query_ccdb.py is missing or fails to run, fall back to a direct API call:

bash
curl -s -X POST https://gateway.carbonstop.com/management/system/website/searchFactorDataMcp \
  -H 'Content-Type: application/json' \
  -d '{"sign":"<md5(\"mcp_ccdb_search\"+keyword)>","name":"<keyword>","lang":"zh"}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
92% confidence
Finding

This is the same underlying issue as the adjacent finding: sample code posts query content to an external service. In the context of a factor-search skill, user inputs may contain commercially sensitive product, supplier, or process information, making outbound transmission a meaningful confidentiality risk.

Content

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

import hashlib, requests keyword = "电力" sign = hashlib.md5(("mcp_ccdb_search" + keyword).encode()).hexdigest() resp = requests.post("https://gateway.carbonstop.com/management/system/website/searchFactorDataMcp", json={"sign": sign, "name": keyword, "lang": "zh"}) print(resp.json())

text

External Transmission

Medium
Category
Data Exfiltration
Confidence
92% confidence
Finding

This is the same underlying issue as the adjacent finding: sample code posts query content to an external service. In the context of a factor-search skill, user inputs may contain commercially sensitive product, supplier, or process information, making outbound transmission a meaningful confidentiality risk.

Content

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

import hashlib, requests keyword = "电力" sign = hashlib.md5(("mcp_ccdb_search" + keyword).encode()).hexdigest() resp = requests.post("https://gateway.carbonstop.com/management/system/website/searchFactorDataMcp", json={"sign": sign, "name": keyword, "lang": "zh"}) print(resp.json())

text

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding

The skill advertises executable/network-capable behavior via script and API fallback instructions, but does not declare any tool scope, permissions, or allowed-tools constraints. This increases the chance that an agent may invoke network or environment-capable tooling implicitly, making data flow and execution boundaries unclear.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The metadata says the skill should activate proactively for broad carbon-accounting tasks even when the user did not explicitly request factor search. Over-broad activation can cause the wrong skill to intercept unrelated tasks, leading to unintended data sharing, irrelevant tool use, or unsafe autonomous behavior.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The proactive activation section uses ambiguous cues like LCA modeling, scenario analysis, and BOM-based calculation as triggers without hard boundaries. In agent environments, such ambiguity can over-trigger tool usage and external queries on routine analytical tasks that may not need this skill at all.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The China-first preference biases region selection based on language rather than explicit user intent. While not directly a security exploit, it can silently steer results toward a jurisdiction-specific dataset and produce inaccurate or inappropriate outputs for multinational or non-China contexts.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
94% confidence
Finding

The documented curl fallback sends externally derived keywords to a remote API whenever the main script is unavailable. Because the skill encourages proactive activation, this fallback could cause silent network transmission in cases where the user never asked for external lookup, increasing confidentiality risk.

Content

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

If scripts/query_ccdb.py is missing or fails to run, fall back to a direct API call:

bash
curl -s -X POST https://gateway.carbonstop.com/management/system/website/searchFactorDataMcp \
  -H 'Content-Type: application/json' \
  -d '{"sign":"<md5(\"mcp_ccdb_search\"+keyword)>","name":"<keyword>","lang":"zh"}'

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

The embedded Python example again instructs agents to transmit user-supplied search terms to an external service, reinforcing direct data egress as an accepted fallback path. In the skill context, this becomes riskier because the skill is designed to activate on supply-chain and carbon-accounting tasks that may include commercially sensitive material data.

Content

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

import hashlib, requests keyword = "电力" sign = hashlib.md5(("mcp_ccdb_search" + keyword).encode()).hexdigest() resp = requests.post("https://gateway.carbonstop.com/management/system/website/searchFactorDataMcp", json={"sign": sign, "name": keyword, "lang": "zh"}) print(resp.json())

text

External Transmission

Medium
Category
Data Exfiltration
Confidence
93% confidence
Finding

The embedded Python example again instructs agents to transmit user-supplied search terms to an external service, reinforcing direct data egress as an accepted fallback path. In the skill context, this becomes riskier because the skill is designed to activate on supply-chain and carbon-accounting tasks that may include commercially sensitive material data.

Content

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

import hashlib, requests keyword = "电力" sign = hashlib.md5(("mcp_ccdb_search" + keyword).encode()).hexdigest() resp = requests.post("https://gateway.carbonstop.com/management/system/website/searchFactorDataMcp", json={"sign": sign, "name": keyword, "lang": "zh"}) print(resp.json())

text

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The instructions require using Chinese terms and synonyms for non-trivial requests as part of the mandatory search policy. This imposes a specific language workflow without offering user choice or explaining a justified region-specific constraint, which matches the locale-policy violation criteria.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The template headings and field prompts are written in Chinese, which imposes a specific language/locale on the skill output. The policy allows locale constraints only when users are given a choice or when the constraint is clearly documented and justified, neither of which appears here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The workflow instructs the agent to prioritize Chinese terms and synonyms before English terms, which imposes a language preference in the skill's behavior. The file does not offer a user language choice or explain that the workflow is intentionally limited to a Chinese-first context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill sends user-provided query terms, including potentially sensitive supply-chain, product, region, and year details, to an external Carbonstop API. Even if this is the intended functionality, there is no visible consent, warning, redaction, or minimization step in the code, so users may unknowingly disclose proprietary or personal business data to a third party.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

Several user-facing guidance and result fields are emitted only in Chinese, such as usage guidance and recommended result labels. The script accepts a --lang option for API querying, but it does not provide corresponding user-facing locale choice for its own output, which can violate language/locale policy when users have not opted into Chinese output.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

The README states that the skill 'searches in Chinese + English,' and later instructs it to 'Always try' both languages. This is a locale/language policy concern because it imposes cross-language behavior by default rather than offering the user a language choice or documenting consent for switching languages.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.