Back to skill

Security audit

Qibook Company Profile

Security checks for vulnerabilities and agentic risk

Overview

This skill appears purpose-built for company and person lookups, but it sends an API access key and user query data to a configurable external URL without destination validation or a clearly declared network scope.

Review this skill before installing. Only use it with a trusted QiBook base URL, require HTTPS and the official host if possible, and avoid casual person-name lookups unless the user clearly wants business-registry/personnel association data sent to the external API.

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/base.py:13
Finding

Unvalidated API Base URL Can Expose the Access Key to an Attacker-Controlled Endpoint

Content
View full analysis

Vulnerability Details

File Location: scripts/base.py, lines 13-37
Vulnerability Type: Unvalidated external endpoint and potential plaintext credential transmission
Risk Level: Medium

Vulnerable Code

python
ACCESS_KEY = os.environ.get('QIBOOK_ACCESS_KEY')
BASE_URL = os.environ.get('QIBOOK_BASE_URL')

# ...

url = f"{BASE_URL}/skill/entData/combinedQuery"
headers = {'access_key': ACCESS_KEY}
try:
    response = requests.get(url, headers=headers, params=filtered, verify=True, timeout=30)

Technical Analysis

The application obtains BASE_URL directly from the QIBOOK_BASE_URL environment variable and uses it to construct the destination of an authenticated HTTP request. It does not parse or validate the URL's scheme, hostname, port, or resolved network destination before attaching the access key.

Consequently, a malicious or incorrectly configured value can direct the request to an attacker-controlled server. For example, setting the variable to an attacker-operated HTTPS URL causes the script to transmit the QIBOOK_ACCESS_KEY value in the custom access_key header. Setting it to an http:// URL additionally transmits the credential without transport encryption. The verify=True argument only validates TLS certificates when HTTPS is used; it neither requires HTTPS nor establishes that the destination is an approved QiBook host.

Because the destination is configurable, the request functionality can also act as a limited server-side request primitive. Its reach is constrained to the fixed /skill/entData/combinedQuery path and a GET request, but it may still contact internal or loopback HTTP services if the runtime environment permits such connections.

requests.get() follows redirects by default. The implementation does not independently validate redirect destinations, so hardening should also account for redirects rather than validating only the initial URL.

Attack Path

  1. A ...[truncated 1506 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove arbitrary runtime endpoint selection where possible and use a fixed official API origin in code or trusted deployment configuration.
  2. Parse the configured URL with urllib.parse.urlparse and require:
    • The https scheme.
    • An exact approved hostname or a narrowly defined hostname allowlist.
    • No embedded username or password.
    • Only approved ports.
    • No unexpected path, query string, or fragment in the configured origin.
  3. Reject loopback, link-local, private, multicast, and otherwise non-public resolved IP addresses unless they are explicitly required and trusted.
  4. Disable automatic redirects with allow_redirects=False, or validate every redirect destination against the same scheme and hostname policy before following it.
  5. Attach the access-key header only after destination validation succeeds.
  6. Apply least privilege, expiration, rotation, rate limits, and usage monitoring to the API key. Rotate the key if it may previously have been used with an untrusted base URL.
  7. Fail closed with a clear configuration error when the URL does not meet the policy.
  8. Add tests covering HTTP URLs, attacker-controlled domains, embedded credentials, unusual ports, loopback and private addresses, and redirects to unapproved destinations.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (8)

Tainted flow: 'url' from os.environ.get (line 36, credential/environment) → requests.get (network output)

Critical
Category
Data Flow
Confidence
95% confidence
Finding

The request destination is built from QIBOOK_BASE_URL, an environment variable, and then used directly in requests.get. If an attacker or misconfigured deployment can control that variable, the skill will send authenticated outbound requests, including the access_key header, to an arbitrary host, enabling SSRF-like behavior and credential exfiltration.

Content

Scanner excerpt · scripts/base.py (reported line 39)May include surrounding context.

python
url = f"{BASE_URL}/skill/entData/combinedQuery"
    headers = {'access_key': ACCESS_KEY}
    try:
        response = requests.get(url, headers=headers, params=filtered, verify=True, timeout=30)
        return response.json()
    except requests.exceptions.Timeout:
        return {'code': -1, 'msg': '请求超时'}

Lp1

High
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill performs outbound network requests but the network capability is not declared in permissions. Hidden network access is dangerous in an agent context because it can transmit user queries and secrets to external services without clear consent or policy review.

Content

No source excerpt is available for this finding.

Lp1

High
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill performs outbound network requests but the network capability is not declared in permissions. Hidden network access is dangerous in an agent context because it can transmit user queries and secrets to external services without clear consent or policy review.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The skill handles potentially sensitive personal and company relationship information, including named individuals, affiliations, executive roles, shareholding, and investment links, but it does not warn users about the nature of the data being retrieved or the sensitivity of the results. This creates a privacy and misuse risk by normalizing lookups of identifiable persons without transparency, consent cues, or caution around downstream handling.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The activation guidance is broad enough to trigger on common requests about people or companies, which can cause the skill to be invoked when the user did not clearly intend a business-registry lookup. Because this skill retrieves company and personnel relationship data, over-triggering increases the chance of unnecessary collection, exposure, or processing of sensitive personal and organizational information.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The code forwards user-supplied person names, and optionally province data, to an external API via _fetch_raw(name=name, province=province) without any visible notice, consent flow, or minimization controls in this file. In a company/personnel lookup skill, names are personal data and can be used to profile individuals' corporate affiliations, so undisclosed transmission to a third party creates a real privacy and compliance risk.

Content

No source excerpt is available for this finding.

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/__init__.py (reported line 16)May include surrounding context.

python
}
    if name in _exports:
        from . import combined_query
        return getattr(combined_query, name)
    raise AttributeError(f"module {__name__!r} has no attribute {name!r}")

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

This Python file contains natural-language documentation and returned status/error messages exclusively in Chinese, which can force a locale on downstream users or operators. The policy allows locale constraints only when users are given a choice or when the restriction is clearly documented and justified, neither of which appears here.

Content

No source excerpt is available for this finding.