Back to skill

Security audit

lotto-agent

Security checks for vulnerabilities and agentic risk

Overview

This lottery skill is mostly coherent, but it asks for overbroad host-agent control while creating persistent tasks and enabling automated outbound notifications.

Review before installing. This skill can create recurring local tasks, store lottery records and costs, fetch unverified public draw data, and send task results through OpenClaw notifications. Only use it if you want Chinese lottery automation, trust the configured draw source, and are comfortable reviewing/disabling tasks and notification settings yourself.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
SKILL.md:3
Finding

Skill instructions attempt to override host-agent routing and decision authority

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/lotto.py:423
Finding

Manual ticket records are accepted without number-range and uniqueness validation

Content
View full analysis
list[dict[str, Any]]: if key == "ssq": if len(nums) >= 7: return [{"red": sorted(nums[:6]), "blue": [nums[6]]}] elif key == "dlt": if len(nums) >= 7: return [{"front": sorted(nums[:5]), "back": sorted(nums[5:7])}] elif key == "qlc": if len(nums) >= 7: return [{"basic": sorted(nums[:7])}] elif key == "kl8": if 1 <= len(nums) <= 10: return [{"nums": sorted(nums), "play_count": len(nums), "play_type": str(len(nums))}] elif key == "qxc": digits = _expand_digits(nums) if len(digits) >= 7: return [{"digits": digits[:7]}] elif key == "pl5": digits = _expand_digits(nums) if len(digits) >= 5: return [{"digits": digits[:5]}] elif key in {"fc3d", "pl3"}: digits = _expand_digits(nums) if len(digits) >= 3: play = "group6" if len(set(digits[:3])) == 3 else ("group3" if len(set(digits[:3])) == 2 else "single") return [{"digits": digits[:3], "play_type": play}] return [] ``` ### Technical Analysis The parser validates primarily the number of extracted integers. It does not enforce the configured minimum and maximum values for each lottery section, uniqueness requirements, or an exact input length for most lottery types. Examples of accepted invalid records include: - Duplicate values in sections that require unique numbers. - Values outside the legal lottery range. - More values than expected, with surplus values silently ignored. - Invalid multi-digit input that is expanded into digits for positional lotteries. - Structurally invalid combinations that are nevertheless inserted as active tickets. After parsing succeeds, `r ...[truncated 1038 chars]
Remediation
View remediation
= expected`. 3. Reject surplus values instead of silently truncating them. 4. Enforce minimum and maximum values for every number. 5. Enforce uniqueness for sections configured as unique. 6. Validate positional lottery digits strictly as individual values between zero and nine. 7. Validate lottery-specific play types and reject impossible combinations. 8. Perform all validation before calling `store.insert_ticket`. 9. Add unit tests for duplicate, out-of-range, insufficient, surplus, and malformed input. 10. Return a precise validation error identifying the invalid section and value. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/fetch.py:30
Finding

Mutable third-party draw data is trusted for prize and financial calculations without integrity verification

Content
View full analysis
str: base = os.environ.get("LOTTERY_PUBLIC_DATA_BASE_URL") if base: return base.rstrip("/") return str(CONFIG.get("api_base_url", "https://raw.githubusercontent.com/wenjinliuu/lottery-data-repo/main/public_data")).rstrip("/") def fetch_draw(lottery: str = "all", issue: str | None = None) -> dict[str, Any]: if lottery == "all": results = [] ok = 0 for key in DEFAULT_WEEKLY: r = fetch_draw(key, issue=issue) results.append(r) ok += 1 if r.get("ok") else 0 return {"ok": ok == len(results), "results": results, "message_text": f"Draw retrieval completed: {ok}/{len(results)} succeeded"} try: payload = _read_json(_url(lottery, issue)) draw = _select_draw(lottery, issue, payload) store.upsert_draw(draw) return {"ok": True, "draw": draw, "message_text": _render_draw(draw)} except (OSError, ValueError, KeyError, json.JSONDecodeError, HTTPError, URLError, TimeoutError) as exc: return {"ok": False, "error": str(exc), "lottery": lottery, "message_text": f"{lottery} retrieval failed: {exc}"} def _url(lottery: str, issue: str | None) -> str: base = _api_base() if issue: return f"{base}/draws/{lottery}.json" return f"{base}/latest.json" def _read_json(location: str) -> dict[str, Any]: if location.startswith(("http://", "https://")): with urlopen(location, timeout=12) as resp: return json.loads(resp.read().decode("utf-8")) with Path(location).open("r", encoding="utf-8") as fh: return json.load(fh) ``` The configured default source is: ```json { "api_base_url": "https://raw.githubusercontent.com/wenjinliuu/lottery-data ...[truncated 2356 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (20)

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The README mandates that the host immediately invoke this skill whenever a message contains lottery-related words, which is an overly broad trigger that can cause the agent to act without clear user intent. In an agent environment, such forced invocation increases the chance of unintended automation, privacy exposure of message content to the skill, and unsafe chaining into commands like scheduling or notifications based on incidental mentions.

Content

No source excerpt is available for this finding.

Vague Triggers

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill declares an extremely broad highest-priority trigger on many common lottery-related words and explicitly instructs the agent to invoke the skill instead of general chat. This can cause frequent unintended routing of normal conversations into a transactional workflow, creating unsafe side effects such as unwanted task creation, record insertion, or automated actions based on ambiguous user text.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README is written as an unconditional Chinese-language operational policy for activation and time parsing, with no indication that users may choose another language or locale. This can violate language/locale policy requirements when the skill is used in broader environments without explicit opt-in.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The README promotes scheduled execution, cron-driven automation, and push notifications, but does not prominently warn that these features create persistent tasks, store data, and may send outbound notifications automatically. In a host agent setting, users may not realize that a one-time interaction can lead to recurring background actions and message delivery, which raises consent and operational safety concerns.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The comment on L1 states '仅使用' in Chinese and appears to present the skill in a single language context without any opt-in or alternative locale guidance. Per the policy, forcing or implying a specific language without user choice can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

This file emits user-facing status and result messages in Chinese string literals, such as the database status text, without any visible language selection or opt-in mechanism. That creates a natural-language policy concern because the skill appears to force a specific locale on all users.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The cancel command invokes a destructive state-changing operation via store.cancel_recent and only reports the result after the action completes. In this file there is no pre-action confirmation prompt, warning message, or disclosure that recent records will be removed from cost and prize accounting.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The cancellation response message is hard-coded in Chinese and there is no visible mechanism in this file for users to choose another language. This indicates the CLI enforces a specific locale rather than offering or documenting a language preference.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The module docstring is written to indicate a China-specific lottery-fetching workflow and the file consistently uses Chinese-language natural-language strings for user-facing messages. There is no indication that users can choose another language or that the locale restriction is explicitly documented as a justified policy constraint.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The function fetches data from a remote URL via _read_json and then writes the resulting draw record to local storage with store.upsert_draw, but there is no confirmation prompt, warning-oriented log, or explanatory comment/docstring disclosing these external network and file/database side effects. Because this file is code, safety-relevant operations that transmit or persist data should include some visible disclosure unless clearly communicated elsewhere in code-facing text.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The file-level docstring is entirely in Chinese, and user-facing messages throughout the file are also Chinese-only. This forces a specific language/locale experience without any opt-in or indication that the skill is intentionally restricted to a Chinese-speaking or region-specific context.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The generate flow creates a batch UUID and inserts each ticket via store.insert_ticket, which writes user betting selections to persistent storage. There is no confirmation prompt, warning string, or explanatory comment here disclosing that the user's data will be saved, beyond a post-action follow-up that the numbers have already been recorded.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The record_manual flow parses user input and persists each ticket using store.insert_ticket. The only disclosure appears after the save in followup_messages, so users are not warned in advance that their manually entered betting data will be recorded.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The module docstring and all user-facing clarification messages are written only in Chinese, which implies the skill forces a specific language for interaction. Under the policy, locale or language constraints should be optional, user-selected, or clearly justified as region-specific.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

This code file contains natural-language strings entirely in Chinese, beginning with the module docstring at L001, and there is no indication anywhere in the file that users may choose another language or that the skill is intentionally limited to a Chinese-only regional context. Under the policy, forcing a specific language without opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
79% confidence
Finding

The skill includes an outbound messaging feature that can send arbitrary task-generated content to externally configured recipients through an external CLI. In this context, the capability is intentional, but it still creates a data-exfiltration and unauthorized-notification channel if an attacker can alter configuration, create tasks, or influence message content, especially because scheduled jobs can trigger pushes automatically.

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/schedule.py (reported line 320)May include surrounding context.

python
if account:
        args.extend(["--account", account])
    try:
        proc = subprocess.run(args, text=True, capture_output=True, check=False)
    except OSError as exc:
        return {"ok": False, "sent": False, "error": str(exc)}
    return {"ok": proc.returncode == 0, "sent": proc.returncode == 0,

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file hard-codes a China timezone (CN_TZ = timezone(timedelta(hours=8))) and uses it for all generated timestamps via now_iso() and cn_now(). This is a natural-language/policy concern because it imposes a specific locale setting globally without any visible user choice or justification in this file.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

This JSON file contains numerous natural-language values such as names, labels, prize levels, and aliases exclusively in Chinese, including entries like "双色球", "红球", and "一等奖". Because the file provides no documented locale selection or opt-in mechanism, it may enforce a specific language/locale contrary to the policy for user choice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
85% confidence
Finding

The check_prize function calls store.update_ticket_prize to modify persisted ticket state and prize amounts. Although the final return message reports that prize checking completed, the code provides no explicit warning or confirmation that existing records will be updated as part of the operation.

Content

No source excerpt is available for this finding.