Back to skill

Security audit

MaxKB

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it claims, but it can send prompts and high-value MaxKB credentials over an operator-configured endpoint that is not required to use HTTPS.

Review before installing. Use only a trusted HTTPS MaxKB endpoint, avoid non-loopback HTTP, use a least-privileged service account or scoped token instead of admin credentials, protect the .env file, and assume any question routed through this skill is sent to the configured MaxKB server.

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

Error
Location
scripts/main.py:42
Finding

Plaintext Transmission of Credentials, Tokens, and User Prompts

Content
View full analysis

Vulnerability Details

File Location: scripts/main.py:42-50, 69-90, 98-127, 150-159, 219-230; README.md:77-94, 162-179
Vulnerability Type: Sensitive information transmitted over an unencrypted network connection
Risk Level: High

Vulnerable Code

python
MAXKB_DOMAIN = os.environ.get("MAXKB_DOMAIN", "<maxkb_domain>")
MAXKB_API_PREFIX = os.environ.get("MAXKB_API_PREFIX", "/admin").rstrip("/")
MAXKB_TOKEN = os.environ.get("MAXKB_TOKEN", "")
MAXKB_WORKSPACE_ID = os.environ.get("MAXKB_WORKSPACE_ID", "default")
MAXKB_USERNAME = os.environ.get("MAXKB_USERNAME", "")
MAXKB_PASSWORD = os.environ.get("MAXKB_PASSWORD", "")
python
def _headers() -> dict:
    return {
        "Authorization": f"Bearer {MAXKB_TOKEN}",
        "Content-Type": "application/json",
    }


def _chat_headers(token: str) -> dict:
    return {
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json",
    }


def _get(path: str, token: str = None) -> dict:
    api_path = _build_api_path(path)
    url = f"{MAXKB_DOMAIN}{api_path}"
    headers = _headers() if token is None else _chat_headers(token)
    req = request.Request(url=url, headers=headers, method="GET")
    try:
        with request.urlopen(req) as resp:
            charset = resp.headers.get_content_charset() or "utf-8"
            return json.loads(resp.read().decode(charset, errors="replace"))
python
def _post_json(path: str, body: dict, token: str = None) -> dict:
    api_path = _build_api_path(path)
    url = f"{MAXKB_DOMAIN}{api_path}"
    data = json.dumps(body).encode("utf-8")
    headers = _headers() if token is None else _chat_headers(token)
    req = request.Request(url=url, data=data, headers=headers, method="POST")
    try:
        with request.urlopen(req) as resp:
            charset = resp.headers.get_content_charset() or "utf-8"
            return json.loads(resp.read().decode(charset, errors="replace"))
python
def _post_sse(path:
...[truncated 4359 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce HTTPS by default

    • Parse MAXKB_DOMAIN with urllib.parse.urlparse.
    • Reject schemes other than https.
    • If local development requires HTTP, allow it only for verified loopback addresses such as 127.0.0.1, ::1, or localhost, behind an explicit development-only option.
  2. Validate the configured destination

    • Require a nonempty hostname.
    • Reject embedded URL credentials.
    • Consider an administrator-configured hostname and port allowlist.
    • Normalize the base URL before appending API paths.
  3. Restrict redirects

    • Disable automatic redirects for authenticated requests or implement a redirect handler that only permits same-origin HTTPS redirects.
    • Never forward authentication headers or sensitive request bodies to a different origin or a downgraded HTTP destination.
  4. Use least-privileged authentication

    • Replace administrator credentials with a dedicated service account or token limited to listing published agents, obtaining the required application access token, and creating chats.
    • Rotate any credentials previously used over plaintext HTTP.
    • Prefer short-lived tokens where supported.
  5. Correct the documentation

    • Replace non-loopback http:// examples with https://.
    • Clearly state that plaintext HTTP is prohibited outside isolated loopback development.
    • Avoid recommending administrator credentials where a scoped service token is sufficient.
  6. Add transport-security tests

    • Verify that non-loopback HTTP URLs are rejected.
    • Verify that HTTPS-to-HTTP downgrade redirects fail.
    • Verify that cross-origin redirects do not receive bearer tokens.
    • Test malformed URLs, embedded credentials, unexpected ports, and untrusted hostnames.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (15)

Tainted flow: 'req' from os.environ.get (line 124, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
93% confidence
Finding

The request URL is built from environment-controlled configuration such as MAXKB_DOMAIN and then sent via urllib.request.urlopen. If an attacker can influence the environment or .env file, they can redirect requests and Authorization headers/tokens to an attacker-controlled host, creating an SSRF-style outbound exfiltration path for credentials and user prompts.

Content

Scanner excerpt · scripts/main.py (reported line 89)May include surrounding context.

python
headers = _headers() if token is None else _chat_headers(token)
    req = request.Request(url=url, headers=headers, method="GET")
    try:
        with request.urlopen(req) as resp:
            charset = resp.headers.get_content_charset() or "utf-8"
            return json.loads(resp.read().decode(charset, errors="replace"))
    except HTTPError as e:

Tainted flow: 'req' from os.environ.get (line 124, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
93% confidence
Finding

POST requests use the same environment-derived domain and include sensitive authentication material in headers and request bodies. A malicious or tampered configuration can cause tokens, login credentials, and application data to be transmitted to an untrusted remote endpoint.

Content

Scanner excerpt · scripts/main.py (reported line 106)May include surrounding context.

python
headers = _headers() if token is None else _chat_headers(token)
    req = request.Request(url=url, data=data, headers=headers, method="POST")
    try:
        with request.urlopen(req) as resp:
            charset = resp.headers.get_content_charset() or "utf-8"
            return json.loads(resp.read().decode(charset, errors="replace"))
    except HTTPError as e:

Tainted flow: 'req' from os.environ.get (line 124, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
91% confidence
Finding

The SSE chat request streams user questions and bearer tokens to a URL derived from environment configuration without host validation. In this skill context, that means both user content and session tokens may be exposed to an attacker-controlled service if configuration is poisoned.

Content

Scanner excerpt · scripts/main.py (reported line 127)May include surrounding context.

python
req = request.Request(url=url, data=data, headers=_chat_headers(token), method="POST")
    chunks = []
    try:
        with request.urlopen(req) as resp:
            for raw_line in resp:
                line = raw_line.decode("utf-8", errors="replace").rstrip("\r\n")
                if not line.startswith("data:"):

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

复制示例文件并填写实际值:

bash
cp .env.example .env

编辑 .env:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
try:
    from dotenv import load_dotenv
except ImportError:
    # 如果没有 python-dotenv,提供简单的 .env 加载实现
    def load_dotenv(dotenv_path=None):
        if dotenv_path and os.path.exists(dotenv_path):
            with open(dotenv_path) as f:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/main.py (reported line 22)May include surrounding context.

python
try:
    from dotenv import load_dotenv
except ImportError:
    # 如果没有 python-dotenv,提供简单的 .env 加载实现
    def load_dotenv(dotenv_path=None):
        if dotenv_path and os.path.exists(dotenv_path):
            with open(dotenv_path) as f:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/main.py (reported line 36)May include surrounding context.

python
# ── 路径配置 ──────────────────────────────────────────────────────
SCRIPT_DIR = Path(__file__).resolve().parent
SKILL_DIR = SCRIPT_DIR.parent
ENV_FILE = SKILL_DIR / ".env"

# 加载环境变量
if ENV_FILE.exists():

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The README explicitly documents sending user questions, workspace data, and authentication material to remote MaxKB endpoints, but it does not warn operators about privacy, data handling, or the sensitivity of admin credentials and prompts. In an agent skill context, this omission can lead to unintentional disclosure of sensitive user input or overprivileged secrets to an external service.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
90% confidence
Finding

The skill exposes capabilities that use environment variables and network access, but the manifest does not declare any tool scope or permission boundaries. This can lead to unintended execution in hosts that rely on manifest-level disclosure, reducing visibility into the fact that user input may trigger outbound API calls using local credentials.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill is designed to forward user questions to another agent, but the documentation does not clearly warn that user content will be transmitted to an external service or that authenticated API access may be used. This creates a privacy and consent risk because users or integrators may unknowingly send sensitive prompts to a remote system.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The environment variable section documents use of an administrator API key and username/password credentials without any warning about the sensitivity of those secrets or the risks of broad-privilege authentication. In a routing skill that performs network calls, this increases the chance of over-privileged deployment and accidental misuse or leakage of high-value credentials.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The file’s natural-language description and usage instructions are written entirely in Chinese, indicating a fixed language expectation for interacting with the skill. There is no visible opt-in, language selection, or justification that this skill is intended only for a Chinese-language context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
81% confidence
Finding

The skill sends the user's question in an HTTP POST request to the MaxKB chat endpoint, which is a privacy-relevant network operation. While the code comments describe the mechanics, there is no clear user-facing disclosure, confirmation, or warning in this file that user input will be transmitted to an external service.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The natural-language content of the skill file is presented only in Chinese, and there is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-speaking context. This can violate a language/locale policy when a specific language is effectively forced without opt-in or justification.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The code reads sensitive values including MAXKB_TOKEN, MAXKB_USERNAME, and MAXKB_PASSWORD from environment variables for authentication. Although this is a common implementation pattern, this file does not provide a user-facing warning or explanation about credential usage and authentication behavior.

Content

No source excerpt is available for this finding.