Back to skill

Security audit

Embedded Code Skill

Security checks for vulnerabilities and agentic risk

Overview

This skill is not overtly malicious, but it needs review because it broadly auto-triggers and can preserve bugs in production embedded firmware rewrites.

Review this skill before installing in projects where generated firmware may affect safety, hardware control, or compliance. If used, narrow its activation to explicit embedded C requests, require explicit approval for web research or self-optimization, tell it whether to fix security and safety defects during rewrites, and set the repository's comment language convention up front.

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

Warning
Location
SKILL.md:218
Finding

Rewrite Policy Preserves Known Security and Safety Defects

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 218-235
Vulnerability Type: Unsafe defect-preservation policy
Risk Level: Medium

Vulnerable Skill Instructions

The following is an English rendering of the relevant instructions:

markdown
Core principle: functional flow takes priority.

The source code supplied by the user represents the existing functional
implementation flow. Even if the code contains errors, its complete
functional flow must be understood before modification. The existing
functional flow must not be damaged merely to comply with the specification.

Regarding bugs in the original code:
- Bugs in the original code are part of the "functional flow."
- If a bug is behavior the user expects to preserve, such as a known
  workaround, preserve it.
- If the original code contains syntax errors and cannot compile, identify
  the problem but do not fix it without authorization.
- Unless explicitly requested by the user, do not change the functional
  logic of the original code.

Technical Analysis

The rewrite policy conflates intended externally observable behavior with implementation defects. It directs the Agent to preserve bugs by default and discourages correction unless the user explicitly requests a functional change.

In embedded firmware, an implementation defect can include an out-of-bounds access, integer overflow, unchecked buffer length, race condition, missing timeout, unsafe register operation, invalid interrupt synchronization, fail-open error handling, or undefined behavior. Preserving such a defect during a standards-oriented rewrite can produce code that appears cleaner and more trustworthy while retaining the original vulnerability.

The risk is heightened because the Skill advertises production-grade output and includes guidance for automotive, aerospace, industrial, and military systems. Formatting and structural improvements may obscure the conti ...[truncated 1670 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the instruction to preserve bugs with a requirement to preserve only documented, intended, externally observable behavior.
  2. Require the Agent to distinguish among:
    • Intended behavior.
    • Documented hardware workarounds.
    • Compatibility constraints.
    • Security defects.
    • Safety defects.
    • Syntax errors and undefined behavior.
  3. Require a security and safety review before completing every rewrite.
  4. Never silently preserve memory-safety defects, undefined behavior, invalid synchronization, missing bounds checks, or fail-open error handling.
  5. If changing a defect could alter compatibility, require the Agent to:
    • Describe the defect clearly.
    • Explain its security or safety consequences.
    • Provide a corrected implementation.
    • Optionally provide a separate compatibility-preserving variant.
  6. Allow documented hardware workarounds to remain only when their purpose, affected hardware revision, assumptions, and validation evidence are recorded.
  7. Change the syntax-error policy so that non-compiling output is not presented as a completed production-grade rewrite.
  8. Add an explicit checklist item confirming that the rewritten output contains no known unresolved security or safety defects.
  9. Clearly label any intentionally unresolved issue in the final output and prevent claims of production readiness until it is resolved.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (13)

Vague Triggers

High
Category
Not specified by scanner
Confidence
96% confidence
Finding

The manifest declares very broad automatic trigger phrases such as 'generate', 'create', 'write code', 'review', and 'check', which overlap with many ordinary software requests. This can cause the skill to activate outside narrowly intended embedded-C contexts, increasing the chance that restrictive or mismatched instructions are injected into unrelated tasks and unexpectedly shape model behavior.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill explicitly states '中文优先' as a core readability requirement, which can override or bias the agent's response language without the user's consent. In an agent setting, forcing a language preference can degrade user comprehension, cause review mistakes, and conflict with higher-priority user instructions, though it is not directly code-execution dangerous.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

The documented trigger phrases for self-evolution are broad enough to match normal user requests about improving or evaluating the skill, which can cause the agent to enter an optimization workflow unexpectedly. In a code-generation skill, this may override the user’s intended task, invoke additional sub-agents, or apply self-modifying behavior without clear user consent, increasing prompt-injection and control-flow confusion risk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The README introduces a self-evolution and optimization subsystem that extends beyond the declared purpose of generating, rewriting, and reviewing embedded C code. This scope expansion can cause the agent to perform unintended self-modification or optimization workflows, increasing the chance of prompt-triggered behavior outside user expectations and outside normal review boundaries.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The use of sub-agents for effect validation is not necessary for the stated embedded C authoring purpose and introduces an additional execution/decision layer. Extra agent delegation broadens the attack surface, can leak task context to components with different instruction handling, and may enable behavior that bypasses the main skill's intended constraints.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger phrases for self-evolution are broad and lack precise activation and exclusion conditions, making accidental or adversarial invocation more likely. In a skill that should only handle embedded C generation/rewrite/review, ambiguous optimization triggers can redirect the agent into higher-risk meta-behavior not clearly requested by the user.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill sets Chinese comments as the default without user opt-in, which can override user intent and reduce transparency for users or reviewers who do not read Chinese. In an auto-invoked skill, this creates an instruction-channel integrity issue because output format and language are being silently constrained by the skill rather than the user's request.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The checklist explicitly requires rewriting comments in Chinese regardless of prior context, which hard-codes a language transformation even during review or rewrite flows. This is risky because it can alter nonfunctional but important source attributes, reduce accessibility, and conflict with user or repository conventions in a way that is automatically enforced.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The section from L098 onward presents all fallback handling, search workflow, user communication templates, and reminders exclusively in Chinese, including prescribed user-facing response formats. This imposes a specific language/locale behavior without any opt-in or alternative, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The skill explicitly instructs use of WebSearch/WebFetch for unknown architectures, which expands the skill from embedded-C generation/review into network-assisted information gathering. That broadens the trust boundary, can introduce prompt-injection or untrusted-content risks from fetched material, and exceeds the narrowly described manifest scope.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

Documenting network search/fetch as a normal workflow for unknown architectures introduces unnecessary external data access for a code-generation skill whose stated purpose does not inherently require browsing. This can expose the agent to malicious or misleading web content and cause data exfiltration or scope creep if user-provided architecture names or surrounding context are sent to external services.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file presents itself as 'Peripheral driver templates' and labels the block as C code, but the identifiers 1553_MODE_BC, 1553_MODE_RT, 1553_MODE_BM, and 1553_mode_t start with digits, which is not valid C syntax. That means the documented template does not actually do what the surrounding documentation claims: provide usable embedded C driver template code.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill hard-codes a preference for Chinese comments ('语言: 优先使用中文') without instructing the agent to follow the user's or team's language requirements. In an agentic coding context, this can cause generated or rewritten code to violate repository standards, reduce reviewability for maintainers, and create process or safety gaps when comments contain important operational or hardware rationale that some team members cannot read.

Content

No source excerpt is available for this finding.