Back to skill

Security audit

xiaoya-auto-doing

Security checks for vulnerabilities and agentic risk

Overview

The skill is meant to automate WHUT login and page capture, but its script can submit stored WHUT credentials to an arbitrary URL and its workflow also instructs automatic answer submission.

Review this skill carefully before installing. It handles real account credentials and authenticated page data, and the current script should not be used with stored WHUT credentials unless URL validation is added before opening pages, before filling fields, and before submitting login forms. Treat any generated latest_page_dump.json as sensitive data and do not rely on the automatic answer-submission instructions without explicit user approval.

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/auto_login.py:198
Finding

WHUT Credentials Can Be Submitted to an Attacker-Controlled Host

Content
View full analysis

Vulnerability Details

File Location: scripts/auto_login.py:198-224
Vulnerability Type: Unvalidated destination for credential submission
Risk Level: High

Vulnerable Code

python
def main():
    username, password = load_secret()
    url = sys.argv[1] if len(sys.argv) > 1 else f'https://{TARGET_HOST}'

    ab('open', url)
    time.sleep(2)

    for _ in range(8):
        snap = snapshot()
        changed = close_popup_once(snap)
        if not changed:
            break

    for _ in range(20):
        snap = snapshot()
        close_popup_once(snap)
        user_ref, pass_ref = find_login_fields(snap)
        if user_ref and pass_ref:
            fill_ref(user_ref, username)
            time.sleep(0.4)
            fill_ref(pass_ref, password)
            time.sleep(0.5)
            login_ref = find_login_button(snap)
            if login_ref:
                click_ref(login_ref)
            else:
                press('Enter')
            time.sleep(2)
            if is_logged_in():
                build_page_dump('LOGIN_OK')
                return

Technical Analysis

The script accepts a target URL directly from the first command-line argument and opens it without validating its scheme, hostname, port, or origin. It then searches the resulting page for fields that resemble username and password controls. If matching controls are found, the script automatically fills them using credentials loaded from environment variables or a local secret file and submits the form.

Although is_logged_in() later checks whether the current URL contains whut.ai-augmented.com, that check occurs only after the credentials have already been entered and the login form has been submitted. It therefore cannot prevent credential disclosure.

An attacker-controlled page can expose controls whose accessible names include terms recognized by find_login_fields(), such as `use ...[truncated 2061 chars]

Remediation
View remediation

Remediation Suggestions

  1. Parse the requested URL before opening it and reject malformed URLs, user-info components, non-HTTPS schemes, unexpected ports, and unapproved hosts.
  2. Use an exact hostname allowlist. If subdomains are required, accept only the base host or names ending in . followed by the base host; do not use substring matching.
  3. Revalidate the browser's current URL immediately before filling either credential field and again immediately before submitting the form. This protects against redirects and navigation performed by page scripts.
  4. Abort if the browser leaves the approved origin at any point in the authentication flow.
  5. Prefer a fixed, trusted authentication endpoint instead of allowing arbitrary command-line destinations during credential submission.
  6. Separate navigation from authentication: arbitrary target pages may be opened only after authentication has completed on a trusted origin.
  7. Consider enforcing the following validation pattern:
    python
    from urllib.parse import urlparse
    
    def is_allowed_url(url):
        parsed = urlparse(url)
        host = (parsed.hostname or '').lower()
        allowed_host = TARGET_HOST.lower()
        return (
            parsed.scheme == 'https'
            and parsed.username is None
            and parsed.password is None
            and parsed.port in (None, 443)
            and (host == allowed_host or host.endswith('.' + allowed_host))
        )
    
    def require_allowed_current_url():
        current_url = get_url()
        if not is_allowed_url(current_url):
            raise RuntimeError(
                f'refusing to submit credentials to unapproved URL: {current_url}'
            )
    
  8. Call require_allowed_current_url() before both fill_ref() operations and before click_ref() or press('Enter').
  9. Add tests covering attacker-controlled hosts, deceptive hostnames such as whut.ai-augmented.com.attacker.example, HTTP URL ...[truncated 65 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (13)

Credential Access

High
Category
Privilege Escalation
Confidence
92% confidence
Finding

The skill explicitly instructs the agent to obtain credentials from environment variables or local secret files to perform automated login. While credential use is part of the stated functionality, this is still sensitive because it normalizes secret retrieval and use by automation, creating risk of unauthorized disclosure, misuse, or accidental propagation through logs, outputs, or downstream steps.

Content

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

md
1. `WHUT_USERNAME` and `WHUT_PASSWORD` environment variables
2. `WHUT_SECRET_PATH` environment variable pointing to a JSON file with `username` and `password`
3. `./local/whut_ai_secret.json` inside this skill folder

Do not package real credentials with the skill.

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

The notes reinforce storing credentials in a predictable local file path inside the skill folder or in environment variables, which makes secret discovery and accidental exposure more likely on shared systems or in misconfigured workspaces. Combined with browser automation and page capture, this raises the risk of both credential compromise and exposure of authenticated content.

Content

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

md
## Notes

- Keep secrets in `local/whut_ai_secret.json` or environment variables.
- Treat `latest_page_dump.json` as runtime output, not as reference content to distribute.
- If refs become stale during browser automation, take a fresh snapshot before continuing.

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

The skill is designed to access credentials from a local secret file or environment variables and use them for automated login. Credential access is security-sensitive in this context because the skill operates on external websites and combines secret retrieval with browser automation and local content export, creating a pathway for misuse, leakage, or unintended account actions if the skill is invoked in the wrong context or its outputs are exposed.

Content

Scanner excerpt · references/workflow.md (reported line 28)May include surrounding context.

凭据格式

可选本地文件:./local/whut_ai_secret.json

json
{

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

The code is explicitly designed to access credentials from a local secret file or environment variables and then automate authentication. Although this may be part of the intended functionality, it still constitutes a credential-access capability, and in an agent-executed skill this is dangerous because it enables secret retrieval and account use with little friction if the skill is triggered unexpectedly or modified later.

Content

Scanner excerpt · scripts/auto_login.py (reported line 11)May include surrounding context.

python
from pathlib import Path

SKILL_DIR = Path(__file__).resolve().parent.parent
DEFAULT_SECRET_PATH = SKILL_DIR / 'local' / 'whut_ai_secret.json'
OUTPUT_PATH = SKILL_DIR / 'latest_page_dump.json'
TARGET_HOST = 'whut.ai-augmented.com'
SESSION = 'whut-auto'

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
88% confidence
Finding

The skill advertises automation that reads environment variables and local secret files, invokes shell wrappers, and writes page dumps, but it declares no explicit tool scope or permission boundaries. This increases the chance an agent can invoke sensitive capabilities implicitly, making credential access and filesystem interaction less visible to users and reviewers.

Content

No source excerpt is available for this finding.

Unbounded Output

Medium
Category
Output Handling
Confidence
80% confidence
Finding

Output size or generation rate is not bounded. Unbounded output enables denial-of-service through resource exhaustion, log flooding, or context-window stuffing.

Content

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

md
---
name: auto-xiaoya-doing
description: Automate login and page capture for WHUT AI Augmented sites using agent-browser. Use when handling whut.ai-augmented.com or its subdomains, especially to open a target page, close blocking popups, fill login credentials from a local secret file or environment variables, verify login state, and capture current page text/questions for later processing.
---

# Auto Xiaoya Doing

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The skill is designed to submit login credentials through browser automation and capture authenticated page contents, but it does not clearly warn users that secrets and page data will be transmitted and stored as runtime output. That omission can lead to unsafe use, especially when users may not realize sensitive academic or account data is being collected and persisted.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The document instructs the agent to read credentials from environment variables or a local secret file and to save captured page content to a local JSON file, but it does not warn that the captured data may contain sensitive account or site content. In an agent context, this increases the risk of unintended exposure of credentials or private page data through local storage, logs, or later processing.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The workflow explicitly states it will automatically answer and submit questions, which goes beyond the declared purpose of opening pages, logging in, and capturing content. This creates an integrity and authorization risk because the skill may take user-impacting actions on external systems without explicit confirmation, potentially submitting incorrect answers or violating expected user consent boundaries.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/auto_login.py (reported line 18)May include surrounding context.

python
def run_cmd(args, check=True):
    res = subprocess.run(args, capture_output=True, text=True)
    if check and res.returncode != 0:
        raise RuntimeError(f'command failed: {args}\nstdout={res.stdout}\nstderr={res.stderr}')
    return res

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script automatically loads credentials from environment variables or a local secret file and uses them to log into a site without any explicit user notice, confirmation, or scope restriction beyond a default host constant. In an agent-skill context, silent credential use is sensitive because it can surprise users, normalize secret harvesting patterns, and make unauthorized or unintended account access easier if invoked on the wrong task.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The script captures full page text, extracts questions, and writes the resulting data to latest_page_dump.json on disk without any disclosure, minimization, or sensitivity checks. In this skill's context, the captured content may include account data, private prompts, coursework, or other confidential browser-visible information, creating a local data exposure risk and persistence beyond the active session.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The entire workflow instruction set is presented in Chinese and includes Chinese-only guidance such as field values and operational steps, with no indication that users may choose another language. Under the stated policy, forcing a specific language without opt-in can be a natural-language policy violation unless the locale restriction is documented and justified.

Content

No source excerpt is available for this finding.