Back to skill

Security audit

Embedded Dev

Security checks for vulnerabilities and agentic risk

Overview

This embedded-development skill is not deceptive or privileged, but it includes production-looking firmware examples with unsafe buffer and OTA patterns that need review before use.

Review this skill before installing if you expect to rely on its code examples. Harden the UART and protocol parsing snippets with explicit bounds checks, use signed firmware authentication for OTA guidance, and clarify language and routing scope. The artifact does not appear to install code, persist, or access credentials.

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

Error
Location
SKILL.md:58
Finding

Unbounded UART Interrupt Buffer Write

Content
View full analysis
SR & USART_SR_RXNE) { rx_buf[rx_len++] = USART->DR; } } ``` ### Technical Analysis The UART interrupt handler writes each received byte into the fixed-size, 64-byte `rx_buf` array without checking whether `rx_len` remains within the array bounds. After 64 bytes have been received, subsequent interrupts write beyond the end of `rx_buf`. Because `rx_len` is an 8-bit integer, it does not prevent the overflow; instead, it continues through values up to 255 before wrapping to zero. This permits extensive corruption of memory adjacent to the buffer. The exact consequences depend on the firmware memory layout. Adjacent global variables, state flags, pointers, or control data may be overwritten. On memory-constrained embedded systems without memory protection, this can cause deterministic crashes or potentially influence control flow. ### Attack Path 1. An attacker obtains physical or remote access to the UART input. 2. The attacker continuously sends more than 64 bytes. 3. Each byte causes `USART1_IRQHandler` to execute. 4. Once `rx_len` reaches 64, `rx_buf[rx_len++]` writes outside the allocated array. 5. Further input corrupts adjacent memory until the counter wraps. 6. Depending on the overwritten data, the device may crash, enter an unsafe state, or execute unintended control flow. ### Impact Assessment An attacker able to provide UART input can cause denial of service and memory corruption within the firmware. If security-sensitive state, function pointers, return-related data, or other control structures are reachable from the buffer, exploitation could potentially result in arbitrary behavior at the firmware's privilege level. The scope is limited to ...[truncated 201 chars]
Remediation
View remediation
SR & USART_SR_RXNE) { uint8_t received = (uint8_t)USART->DR; if (rx_len < RX_BUF_SIZE) { rx_buf[rx_len++] = received; } else { /* Record overflow and safely discard or reset the frame. */ rx_len = 0; } } } ``` For continuous streams, use a bounded ring buffer with separate producer and consumer indexes. Define an explicit overflow policy, such as dropping the newest byte, dropping the oldest byte, or rejecting the current frame. Ensure indexes are updated atomically when shared between interrupt and application contexts. The firmware should also: - Reset receive state at validated frame boundaries. - Track and report overflow events. - Apply maximum frame-size limits before reception begins. - Use fuzz testing and long-stream tests to verify that malformed or continuous UART traffic cannot write outside the buffer. ]]>

T09 · Insecure Skill Coding Practices

Error
Location
references/communication-protocols.md:59
Finding

Attacker-Controlled Frame Length Causes a Buffer Overflow

Content
View full analysis
= frame_len) state = FRAME_CRC; break; case FRAME_CRC: if (ch == calc_crc16(buf, idx)) process_frame(buf, frame_len); state = FRAME_IDLE; break; } } ``` ### Technical Analysis The parser reads the frame length directly from an untrusted input byte: ```c frame_len = ch; ``` The input can therefore declare a payload length of up to 255 bytes, while the destination buffer has capacity for only 128 bytes. The `FRAME_DATA` state then writes data with: ```c buf[idx++] = ch; ``` No check ensures that `idx` is less than `sizeof(buf)` before the write. A declared length between 129 and 255 causes payload bytes to be written beyond the end of `buf`. The condition `if (idx >= frame_len)` does not prevent the overflow because it is evaluated only after the write and compares against the attacker-controlled length rather than the actual buffer capacity. The example also compares a single received byte against a function named `calc_crc16`, which suggests a separate protocol correctness problem. However, the confirmed security issue is the independently exploitable missing length and write-bound validation. ### Attack Path 1. The attacker sends the expected frame header bytes `0xAA` and `0x55`. 2. The attacker supplies a length byte greater ...[truncated 1021 chars]
Remediation
View remediation
sizeof(buf)) { frame_len = 0; idx = 0; state = FRAME_IDLE; break; } frame_len = ch; idx = 0; state = FRAME_DATA; break; case FRAME_DATA: if (idx >= sizeof(buf) || idx >= frame_len) { frame_len = 0; idx = 0; state = FRAME_IDLE; break; } buf[idx++] = ch; if (idx == frame_len) { state = FRAME_CRC; } break; ``` Additional hardening should include: - Define a protocol-level maximum payload size and enforce it before accepting data. - Keep the write-capacity check independent of the untrusted frame length. - Reset all parser state when malformed input is detected. - Add a timeout so an incomplete frame cannot hold the parser indefinitely. - Parse the CRC according to its actual width and byte order. - Verify the complete frame before calling `process_frame`. - Fuzz the parser with zero-length, oversized, truncated, and malformed frames. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
references/firmware-dev.md:63
Finding

OTA Design Uses CRC Without Cryptographic Firmware Authentication

Content
View full analysis
AHBENR |= RCC_AHBENR_CRCEN; CRC->CR = CRC_CR_RESET; for (uint32_t i = 0; i < len; i++) CRC->DR = ((uint8_t*)addr)[i]; return CRC->DR; } ``` ### Technical Analysis The OTA metadata contains a validity marker and a CRC, while the verification example only calculates a hardware CRC over the firmware image. A CRC can detect accidental transmission errors, but it does not authenticate the origin of an update and is not resistant to intentional modification. An attacker who can replace or modify an update image can calculate the corresponding CRC and update the metadata accordingly. The fixed `OTA_FLAG_VALID` value is also not an authentication mechanism because it is public and can be reproduced. No digital-signature verification, protected trust anchor, authenticated security metadata, or anti-rollback mechanism is shown. Consequently, an implementation based solely on this design may distinguish corrupted firmware from intact firmware but cannot distinguish trusted firmware from a malicious image prepared by an attacker. ### Attack Path 1. An attacker gains the ability to modify an OTA image in transit, on an update server, in external storage, or through a compromised update channel. 2. The attacker inserts malicious firmware functionality. 3. The attacker recalculates the CRC for the modified image. 4. The attacker supplies the new CRC and the known `OTA_FLAG_VALID` value in the OTA metadata. 5. A bootloader relying only on the illustrated fields accepts the malicious image as v ...[truncated 704 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (11)

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The skill description says it should be invoked for essentially any embedded-development-related question, which is an overly broad trigger condition. Broad activation can cause unnecessary routing to this skill, override more specialized skills, and increase the chance of the agent following embedded-specific workflow or assumptions when they are not appropriate for the user's actual intent.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill metadata and content are written to operate in Chinese without any indication that language should follow user preference. Forcing a language can degrade usability, obscure safety-critical guidance, and create misunderstandings in technical or debugging contexts if the user expects another language.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The file title and all instructional content are written in Chinese, which imposes a specific language on users. Under the policy, language-specific behavior should either offer user choice or clearly document a justified locale constraint, neither of which is present here.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown file presents all instructions, headings, and troubleshooting guidance exclusively in Chinese. Under the policy rules, forcing a specific language without user opt-in or a documented region-specific justification is 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
92% confidence
Finding

The entire skill document is written in Chinese and provides no indication that language selection is optional or that the skill is intentionally limited to a Chinese-speaking context. Under the policy, forcing a specific language without user opt-in is a natural-language locale violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file is entirely written in Chinese, including headings, comments, and explanatory text, with no indication that language selection is optional or that the skill is specifically limited to a Chinese-speaking audience. Under the policy rule for natural-language constraints, this is a locale/language restriction without user opt-in or documented justification.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The file title and all instructional content are written in Chinese, with no indication that language choice is optional or that the skill is region-specific. Under the stated policy, forcing a specific language without user opt-in is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file is entirely written in Chinese, beginning with the title on L01, and it does not indicate that language selection is optional or limited to a justified region-specific audience. Under the policy rule for natural-language violations, forcing a specific language without user opt-in can be a locale policy issue.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file is written entirely in Chinese, beginning with the title at L001, and does not indicate that language selection is optional or that the skill is region-specific. Under the policy rule, forcing a specific language without user opt-in can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

Lines L196-L199 describe the problem as 'calling a blocking API inside a critical section,' yet the example function is HardFault_Handler, an exception handler rather than a normal critical section. This documentation actively mischaracterizes why the code is invalid, which can mislead users about RTOS safety rules and proper interrupt/fault-context behavior.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.