Back to skill

Security audit

LGD Change Gate(医械 AI 变更判定)

Security checks for vulnerabilities and agentic risk

Overview

Review is warranted because the skill saves complete case details by default and can approve medical-device changes without the evidence checks it promises.

Use de-identified cases until full-context retention is disclosed and made controllable. Require qualified human review of every change-control decision, and do not connect go results directly to deployment or regulatory approval. The evidence checks and inconsistent verdict handling need correction. Independent inspection found no exfiltration or malicious execution, but did not establish regulatory correctness or host access controls.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (13)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The code shares the declared medical-device regulatory context and auditable verdict structure, but its primary decision is materially different. It classifies responses to existing postmarket events, including events unrelated to AI/ML changes, rather than determining whether a proposed change requires change control. No rule evaluates the proposed change or explicitly decides whether formal change control is required. The field actions are recommendations embedded in returned reasons, not actions executed by the code. No external resource access is shown.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
87% confidence
Finding

The judge_change endpoint directly supports the declared purpose. Tool discovery, JSON-RPC transport, and local audit storage are supporting implementation details, not mismatches. However, judge_postmarket accepts a general context and invokes a separate surveillance judge without requiring a proposed change or a connection to change control. That is an additional user-facing evaluation capability not disclosed in the description. The imported judging logic is not supplied, so the completeness of the claimed LGD and regulatory evaluations cannot be verified from this chunk.

Content

No source excerpt is available for this finding.

L2 downgrade is documented as an unconditional hold signal but only adds an audit message.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

Recognizing an L2-EVIDENCED reason only appends an audit message; it does not enforce the documented hold signal. A registered judge returning that reason at a non-major level alongside 'go' and nonempty evidence can therefore produce an aggregate 'go'; current major-tagged change-judge output mitigates, but does not fix, this aggregator weakness.

Content

No source excerpt is available for this finding.

Critical predicate errors are documented as hold signals but can still produce a go verdict.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

A critical predicate exception adds a major reason but does not set a hold verdict or count as a fired rule. Malformed input, such as an unhashable value used in a membership test, can consequently yield 'go' when an evidence reference is present; GateEngine mitigates this by interpreting the major reason, but standalone judge callers remain exposed.

Content

No source excerpt is available for this finding.

Later hold assignments override critical vetoes documented as unconditional rejections.

High
Category
Excessive Agency
Confidence
100% confidence
Finding

A critical rejection can subsequently be overwritten with 'hold' by the supplier-equivalence or unknown-jurisdiction checks. GateEngine restores rejection from the retained critical reasons, but directly calling the explicitly supported judge API returns the weakened verdict, creating inconsistent safety decisions across integrations.

Content

No source excerpt is available for this finding.

Documented conservative FDA submission defaults are not enforced for material, process, and design changes.

High
Category
Excessive Agency
Confidence
98% confidence
Finding

The stated conservative default covers material, process, and design changes, but the FDA-specific implementation only holds supplier substitutions. Other such changes can fall through to 'go' with a supplied evidence reference when no separate escalation fires, allowing a safety-sensitive approval without the assessment the engine promises.

Content

No source excerpt is available for this finding.

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: file_read, network, shell.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

The CLI silently persists the complete case context to a local database.

Medium
Category
Output Handling
Confidence
97% confidence
Finding

Normal CLI execution creates a persistent database and stores the complete case context, without field minimization or redaction. Medical-device cases can contain sensitive clinical or proprietary information, so this creates an undisclosed additional copy accessible to users or processes that can read the database and its backups.

Content

No source excerpt is available for this finding.

The evidence gate can return a hold verdict without the auditable reason promised by the manifest.

Medium
Category
Excessive Agency
Confidence
98% confidence
Finding

When evidence is absent and no rules fire, the judge sets hold before the later 'go without evidence' check, leaving the reason list empty. This does not permit an unsafe approval, but it breaks the promised audit trail in a regulated decision workflow and prevents downstream reviewers from reliably identifying the missing-evidence gate.

Content

No source excerpt is available for this finding.

The server claims secrets are never logged but persists unfiltered caller-controlled values in its audit log.

Medium
Category
Excessive Agency
Confidence
90% confidence
Finding

L011 explicitly states that no secrets are ever logged, but L085–L092 persist the caller-supplied tool name and role without validation or redaction. The role is also persisted for successful calls at L109–L116, so secrets included in these values would be written to the SQLite audit store configured at L057–L059.

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 · engine/lgd_engine/mcp_smoke.py (reported line 19)May include surrounding context.

python
def main() -> int:
    proc = subprocess.Popen(
        [sys.executable, str(HERE / "mcp_server.py")],
        stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
        text=True, cwd=str(HERE.parent),

The Record Law requires persistence before verdict emission, but configures recording to trigger afterward.

Medium
Category
Excessive Agency
Confidence
96% confidence
Finding

L11–L12 require a DecisionRecord to be persisted before or at verdict emission and explicitly prohibit in-memory-only verdicts. However, L13–L14 configure write_decision_record to run on after_verdict_emitted, placing persistence after the event it is supposed to precede and undermining the stated auditability guarantee.

Content

No source excerpt is available for this finding.

Vector-recall documentation promises fastembed-backed retrieval, but the implementation always performs keyword retrieval.

Low
Category
Excessive Agency
Confidence
99% confidence
Finding

The module documentation and vector() docstring claim that fastembed is used when installed, with keyword retrieval as the fallback. Both implementation branches instead call keyword(), so semantic vector recall is never performed, regardless of dependency availability. Although returned hits disclose the fallback, the documented retrieval capability remains misleading for callers relying on it to locate relevant decision records.

Content

No source excerpt is available for this finding.