Back to skill

Security audit

双色球开奖查询

Security checks for vulnerabilities and agentic risk

Overview

This skill is a purpose-aligned lottery-results lookup tool, with notable data-integrity weaknesses but no evidence of hidden access, persistence, exfiltration, or destructive behavior.

Install only if you are comfortable with a Chinese-locale lottery lookup skill that contacts external lottery websites. Treat returned numbers as convenience information, not authoritative proof, especially because official sources are accessed over HTTP and the script does not strictly validate or cross-check every result.

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

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/ssq_lottery.py:31
Finding
Prioritized Official Data Sources Use Unauthenticated Cleartext HTTP## Vulnerability Details **File Location**: `scripts/ssq_lottery.py:31-41` **Vulnerability Type**: Cleartext transmission of integrity-sensitive lottery data **Risk Level**: Medium ### Vulnerable Code ```python { 'name': '中国福彩网', 'url_list': 'http://kaijiang.zhcw.com/zhcw/html/ssq/list.html', 'url_issue': 'http://kaijiang.zhcw.com/zhcw/html/ssq/{issue}.html', 'priority': 'official', 'timeout': 15, }, { 'name': '福彩网手机版', 'url_list': 'http://m.zhcw.com/ssq/', 'url_issue': 'http://m.zhcw.com/ssq/{issue}.html', 'priority': 'official_backup', 'timeout': 15, }, ``` ### Technical Analysis The first two and most trusted data sources use HTTP rather than HTTPS. HTTP does not authenticate the remote endpoint and does not protect response integrity. An attacker capable of observing or modifying the network path can replace the returned HTML before it reaches the parser. Because these sources have the highest priority, manipulated responses can be labeled and displayed as official data. The skill documentation also recommends the same cleartext endpoints, making the insecure behavior part of the documented workflow. ### Attack Path 1. A user invokes the skill to retrieve current or historical lottery results. 2. The script connects to one of the prioritized official sources over HTTP. 3. An attacker controlling a local network, proxy, gateway, DNS path, or other intermediary intercepts the request. 4. The attacker returns modified HTML containing fabricated issue, date, ball, or prize-pool values. 5. The parser extracts the attacker-controlled values. 6. The script presents the result as originating from an official source. ### Impact Assessment Exploitation does not grant local code execution, filesystem access, or elevated system privileges. Its scope is the integrity and authenticity of financially relevant lottery information returned by the skill. An attacke ...[truncated 121 chars]
Remediation
## Remediation Suggestions - Replace all HTTP endpoints with verified HTTPS endpoints. - Reject redirects from HTTPS to HTTP. - Retain normal certificate and hostname verification; do not introduce an unverified TLS context. - Fail closed when an official endpoint is unavailable over authenticated transport rather than silently downgrading to HTTP. - Clearly distinguish official and third-party data after transport and content validation. - Update `SKILL.md` and `references/data_sources.md` so they no longer recommend cleartext URLs. - Add automated tests that assert every configured endpoint uses HTTPS and that downgrade redirects are rejected.

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/ssq_lottery.py:244
Finding
Weak Result Validation Accepts Incomplete, Unrelated, or Manipulated Draw Data## Vulnerability Details **File Location**: `scripts/ssq_lottery.py:244-264` **Vulnerability Type**: Insufficient validation of remotely supplied data **Risk Level**: Medium ### Vulnerable Code ```python def try_data_sources(issue: str = None) -> tuple: """按优先级尝试所有数据源""" for source in DATA_SOURCES: if issue: url = source['url_issue'].format(issue=issue) else: url = source['url_list'] print(f" 尝试 {source['name']}...", file=sys.stderr) html = fetch_lottery_page(url, source['timeout']) if not html.startswith("ERROR:"): draw = parse_draw(html, source['name']) # 验证数据完整性 if draw['issue'] or (len(draw['red_balls']) >= 6 and draw['blue_ball']): return (True, draw) print(f" ❌ {source['name']} 失败", file=sys.stderr) return (False, {'error': '所有数据源都无法获取数据'}) ``` ### Technical Analysis The acceptance condition treats a result as successful when either of the following is true: - Any nonempty issue value was parsed, even if all draw numbers are absent. - At least six red values and any nonempty blue value were parsed. The code does not require: - Exactly six red balls. - Unique red balls. - Red-ball values in the range 1–33. - A blue-ball value in the range 1–16. - A valid issue format. - Equality between a user-requested issue and the parsed issue. - A valid or corresponding draw date. - Agreement between independent sources. The function returns immediately after the first nominally acceptable response. Consequently, the documented claim that data is cross-validated across sources is not implemented. This is particularly significant for the 500.com configuration, whose issue URL points to a general list page instead of a requested-issue endpoint. ### Attack Path 1. A user requests a draw, optionally specifying an ...[truncated 1058 chars]
Remediation
## Remediation Suggestions Implement and invoke one strict validator before accepting any parsed result. It should: - Require an issue identifier matching the expected format. - Require exact equality with the requested issue when an issue was supplied. - Require exactly six unique red balls. - Convert ball values safely to integers and reject conversion failures. - Enforce red-ball values from 1 through 33. - Require exactly one blue ball from 1 through 16. - Validate the date format and, where possible, its relationship to the issue. - Reject partial results rather than presenting them as successful. - Cross-check third-party results against an independent source. - Report discrepancies instead of selecting the first response. - Add parser tests containing duplicate, out-of-range, missing, stale, and mismatched-issue values. A suitable acceptance structure would require all validation conditions rather than using an issue-only alternative: ```python if validate_draw(draw, expected_issue=issue): return True, draw ```

T09 · Insecure Skill Coding Practices

Note
Location
scripts/ssq_lottery.py:74
Finding
Remote HTTP Responses Are Read Without a Size Limit## Vulnerability Details **File Location**: `scripts/ssq_lottery.py:74-78` **Vulnerability Type**: Unbounded allocation from an untrusted network response **Risk Level**: Low ### Vulnerable Code ```python if 'charset=' in content_type: charset = content_type.split('charset=')[-1].split(';')[0].strip() raw_html = response.read() try: html = raw_html.decode(charset) ``` ### Technical Analysis Calling `response.read()` without a byte limit buffers the entire response body in process memory. The request timeout limits how long network operations may wait, but it does not impose a maximum response size. A compromised data source or an attacker capable of modifying traffic can therefore return an excessively large body. The script then creates an additional decoded string and applies regular expressions to it, potentially increasing memory use and processing cost beyond the original response size. ### Attack Path 1. The script requests a configured lottery page. 2. A malicious source or network intermediary returns a very large response body. 3. `response.read()` continues buffering the response without enforcing a maximum size. 4. The process allocates memory for both the raw bytes and decoded text. 5. Memory pressure degrades the process or causes termination, preventing the skill from completing. ### Impact Assessment No additional privileges, persistent access, or code execution are obtained. The impact is limited to availability: the skill or its hosting Agent process may experience high memory use, excessive parsing work, degraded responsiveness, or termination. The precise scope depends on the memory limits and isolation of the runtime.
Remediation
## Remediation Suggestions - Define a conservative maximum response size appropriate for lottery HTML pages. - Check `Content-Length` when present and reject responses exceeding the limit. - Read incrementally into a bounded buffer rather than calling an unlimited `read()`. - Abort when the cumulative byte count exceeds the configured maximum. - Consider limiting decompressed size as well if compressed responses are enabled. - Avoid running expensive regular expressions over unexpectedly large documents. - Add a test server that sends oversized and chunked responses to verify that the client terminates safely. Example bounded-read pattern: ```python MAX_RESPONSE_BYTES = 2 * 1024 * 1024 raw_html = response.read(MAX_RESPONSE_BYTES + 1) if len(raw_html) > MAX_RESPONSE_BYTES: return "ERROR:Response exceeds maximum allowed size" ```
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
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (6)

Ae1

High
Category
analysis-evasion
Content
python scripts/ssq_lottery.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python scripts/ssq_lottery.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Ae1

High
Category
analysis-evasion
Content
python scripts/ssq_lottery.py
Confidence
100% confidence
Finding
Referenced artifact was not completely inspected

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The entire skill file is written in Simplified Chinese and presents all instructions, warnings, and examples only in that language. Under the stated policy, language-only content can be a natural-language policy violation when it imposes a locale without offering user opt-in or documenting a justified regional constraint.

Natural-Language Policy Violations

Low
Confidence
94% confidence
Finding
The Accept-Language header is fixed to 'zh-CN,zh;q=0.9,en;q=0.8', which imposes a specific language/locale behavior. Under the policy, locale constraints should be optional, user-selectable, or clearly justified as region-specific; this script does not provide such opt-in or explanation beyond being a lottery query tool.

Natural-Language Policy Violations

Low
Confidence
90% confidence
Finding
This code file contains user-facing natural-language text that forces a specific language/locale experience. The policy allows locale constraints only when the skill offers user choice or clearly documents a justified region-specific limitation, which is not present here.

Static analysis

No suspicious patterns detected.