language stringclasses 1
value | root_cause stringclasses 3
values | remediation stringclasses 3
values | source_code stringclasses 3
values | function_name stringclasses 3
values | execution_path stringclasses 3
values | issue_category stringclasses 3
values | security_impact stringclasses 3
values | vulnerable_location stringclasses 3
values |
|---|---|---|---|---|---|---|---|---|
C | The code treats the header's payload_len as sufficient evidence of available input data. It does not validate the declared length against the actual packet boundary before any consumer reads the payload. | After confirming packet_len is at least sizeof(h), reject the packet when h.payload_len > packet_len - sizeof(h). Perform this subtraction-based bounds check before verification, and pass only the validated payload span to subsequent functions. | #include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#define MAX_PAYLOAD 262144U
struct image_header {
uint32_t payload_len;
uint8_t signature[64];
};
extern bool verify_signature(const struct image_header *, const uint8_t *, uint32_t);
extern bool flash_write(uint32_t, const uint... | install_image | A packet at least sizeof(h) bytes long is accepted for header parsing. If its declared payload length is within MAX_PAYLOAD but exceeds the bytes remaining in the packet, the function passes a pointer into the packet and the oversized declared length to signature verification. If execution continues, it passes the same... | Input length validation defect | A truncated or malformed update can cause reads beyond the received packet in the verifier or flash-writing path, potentially causing a fault or denial of service. The snippet still invokes signature verification, so this defect alone does not establish that an unsigned image can be installed. | After parsing the header, the function checks the declared payload against MAX_PAYLOAD but never checks that packet_len - sizeof(h) is at least h.payload_len before passing payload to verify_signature and flash_write. |
C | The code establishes that the image matches the supplied key, but not that the key is authorized to sign firmware for this device. It therefore treats attacker-controlled verification material as a trust anchor. | Verify update signatures against a trust anchor provisioned independently of the request, such as an immutable public key or a certificate chain validated to a pinned root. Reject caller-supplied keys unless they are authenticated and authorized by that trust chain. | #include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
struct update_request {
const uint8_t *image;
size_t image_len;
const uint8_t *signature;
size_t signature_len;
const uint8_t *public_key;
size_t public_key_len;
};
extern bool verify_detached(const uint8_t *, size_t, const uint8_t *... | accept_update | A caller provides an image, signature, and public key. The function verifies the signature using that same caller-supplied key and, if verification succeeds, writes the image as an update. No trusted-key lookup or validation is present in the shown path. | Trust boundary and authentication flaw | A caller able to submit updates can generate a key pair, sign an unauthorized image, and provide the corresponding public key. If the verifier accepts it, the function proceeds to write that image, undermining firmware authenticity and integrity. | The verification call uses request->public_key, which is supplied as part of the update request, without checking it against a trusted key or certificate chain. |
C | The code commits the success state before establishing that the candidate image can pass verification and boot. It also discards the pending marker before there is a successful boot confirmation, so the transition is not recoverable through the state shown here. | Keep the existing active slot and pending state until the candidate has been verified and successfully confirmed by a defined post-boot mechanism. Persist trial-attempt state separately, retain the previous slot as a fallback, and commit the new active slot only after confirmation. | #include <stdbool.h>
#include <stdint.h>
struct boot_state {
uint32_t active_slot;
uint32_t pending_slot;
bool pending;
bool confirmed;
};
extern bool read_state(struct boot_state *);
extern bool write_state(const struct boot_state *);
extern bool verify_and_boot(uint32_t);
bool select_and_boot(struc... | select_and_boot | On boot, read_state loads a pending update. The function commits the candidate slot as active and confirmed, clears the pending flag, and persists that state. It then calls verify_and_boot for the candidate. If verification or booting fails, the persisted state no longer identifies the update as pending, and the previo... | Boot-state transition error | A candidate that fails verification or cannot boot can leave the device repeatedly selecting that slot, preventing normal startup and defeating the intended rollback path. The shown verification call still limits execution of an invalid image; the demonstrated impact is loss of recovery and availability. | In the pending-update branch, active_slot is changed and pending is cleared while confirmed is set before write_state and verify_and_boot are called. |
Embedded Firmware Update and Bootloader Security Code Reasoning Dataset
This dataset focuses on source code for firmware update, boot, and rollback workflows in IoT and OT devices, paired with security analysis examples. Samples identify issue categories, vulnerable locations, execution paths, root causes, security impacts, and remediation guidance, with emphasis on validation logic, state transitions, and trust boundaries. It supports training and evaluating models that reason about firmware code paths, locate security defects, and explain failure causes, making it suitable for code SFT and firmware security debugging.
Technical Specifications
| Field | Type | Description |
|---|---|---|
| language | string | Programming language identified from the source code. |
| root_cause | string | Explanation of why the defect occurs, including errors in validation, state management, or trust boundary handling. |
| remediation | string | Code changes or security controls recommended to address the underlying cause of the defect. |
| source_code | string | Source code for firmware update, bootloader, or rollback workflows used in security analysis. |
| function_name | string | Name of the function associated with the security issue or a critical state transition. |
| execution_path | string | Code path taken when the issue is triggered and the related state changes. |
| issue_category | string | Category of the security issue, such as a validation defect, state transition error, or trust boundary issue. |
| security_impact | string | Potential effects of the defect on firmware integrity, device booting, or update and rollback security. |
| vulnerable_location | string | Code location, statement, or logic branch associated with the defect. |
Compliance Statement
| Authorization Type | CC-BY-NC-SA 4.0 (Attribution–NonCommercial–ShareAlike) |
| Commercial Use | Requires exclusive subscription or authorization contract (monthly or per-invocation charging) |
| Privacy and Anonymization | No PII, no real company names, simulated scenarios follow industry standards |
| Compliance System | Compliant with China's Data Security Law / EU GDPR / supports enterprise data access logs |
Source & Contact
- Downloads last month
- 17