Back to skill

Security audit

embedded-engineer

Security checks for vulnerabilities and agentic risk

Overview

This embedded engineering skill is coherent, but its example code includes unsafe IoT and industrial control patterns that users could copy without adequate warnings.

Review carefully before installing or using as a coding reference. Treat the included IoT and industrial examples as demonstration sketches only, and require secure OTA signing, TLS, authenticated command channels, scoped network binding, access control, and explicit warnings before adapting this material for real devices.

Vulnerability Patterns
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (4)

T03 · Remote Payload Retrieval and Execution

Error
Location
references/examples.md:114
Finding

Unauthenticated Remote Firmware Retrieval and Execution

Content
View full analysis
0) { performUpdate(updateUrl); } } } http.end(); } void performUpdate(const char* url) { updateInProgress = true; WiFiClient client; t_httpUpdate_return ret = httpUpdate.update(client, url); switch(ret) { case HTTP_UPDATE_FAILED: Serial.printf("Update failed: %s\n", httpUpdate.getLastErrorString().c_str()); break; case HTTP_UPDATE_NO_UPDATES: Serial.println("No updates available"); break; case HTTP_UPDATE_OK: Serial.println("Update successful, restarting..."); ESP.restart(); break; } updateInProgress = false; } ``` The update check is also invoked automatically: ```cpp // Periodic OTA check (once per hour) static unsigned long lastOTACheck = 0; if (millis() - lastOTACheck > 3600000) { otaHandler.checkForUpdate(); lastOTACheck = millis(); } ``` ### Technical Analysis Firmware metadata is retrieved over plaintext HTTP. The `url` field from that unauthenticated response is passed directly to `httpUpdate.update()` using a plaintext `WiFiClient`. The implementation does not e ...[truncated 1725 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/examples.md:326
Finding

Unauthenticated Commands over a Plaintext Public MQTT Channel

Content
View full analysis
doc; doc["device_id"] = DEVICE_ID; doc["status"] = "online"; doc["firmware"] = FIRMWARE_VERSION; doc["ip"] = WiFi.localIP().toString(); char buffer[256]; serializeJson(doc, buffer); mqtt.publish("iot/devices/ESP32_SENSOR_001/status", buffer, true); } } ``` ```cpp void mqttCallback(char* topic, byte* payload, unsigned int length) { StaticJsonDocument<256> doc; DeserializationError error = deserializeJson(doc, payload, length); if (error) { Serial.print("JSON parse error: "); Serial.println(error.c_str()); return; } if (strcmp(topic, "iot/devices/ESP32_SENSOR_001/commands") == 0) { const char* command = doc["command"]; if (strcmp(command, "restart") == 0) { ESP.restart(); } else if (strcmp(command, "update") == 0) { otaHandler.checkForUpdate(); } else if (strcmp(command, "calibrate") == 0) { calibrateSensors(); } } } ``` ### Technical Analysis The ESP32 connects to `broker.hivemq.com` on the standard plaintext MQTT port, 1883, using `WiFiClient`. The call to `mqtt.connect(DEVICE_ID)` supplies no username, password, client cer ...[truncated 1804 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
references/examples.md:30
Finding

Hard-Coded Wi-Fi Credential in ESP32 Source

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/examples.md:811
Finding

Unauthenticated Writable OPC UA Service Exposed on All Interfaces

Content
View full analysis
opcua.Node: """Add a variable to the server""" var = self.device.add_variable(self.idx, name, value) var.set_writable() return var async def update_variable(self, node: opcua.Node, value: Any): """Update variable value""" node.set_value(value) ``` ### Technical Analysis The OPC UA server binds to `0.0.0.0:4840`, exposing it on every available network interface. Variables created through `add_variable()` are explicitly marked writable. The example does not configure OPC UA security policies, message encryption, server certificates, client certificate trust, user authentication, role-based permissions, or node-level authorization. As a result, reachable clients may be able to establish an anonymous or otherwise insufficiently protected session and modify exposed variables. The risk is elevated because OPC UA commonly carries industrial process information and control values. Writable nodes should never rely only on network location as their security b ...[truncated 1250 chars]
Remediation
View remediation
Vulnerability Patterns
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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
Findings (2)

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The ESP32 example includes insecure OTA behavior and destructive reset functionality without warnings or safeguards: it fetches update metadata over plain HTTP, performs firmware updates from a URL without visible authenticity verification, accepts remote MQTT-triggered update/restart commands, and exposes a factory reset path that erases storage. In an embedded/IoT skill, this is more dangerous because readers may reuse the example in production firmware, leading to remote code execution through malicious firmware delivery or device wipe/denial of service.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

At L1403-L1405, the doc comment says the communication task "handles UART, CAN, and network protocols." However, the implemented body at L1431-L1456 processes UART traffic, CAN messages, and a local Modbus RTU handler, with no actual network stack or network protocol handling shown. This is an active documentation-to-code mismatch rather than a mere omission.

Content

No source excerpt is available for this finding.