Skip to content

Instantly share code, notes, and snippets.

@doevelopper
Created July 12, 2026 17:03
Show Gist options
  • Select an option

  • Save doevelopper/2fab4bf05bf951fc4c9d3481f5910212 to your computer and use it in GitHub Desktop.

Select an option

Save doevelopper/2fab4bf05bf951fc4c9d3481f5910212 to your computer and use it in GitHub Desktop.

Translating a massive standard like IEC 62443 into actionable product specifications can feel overwhelming. The secret is to realize that as a product developer building an embedded device, you do not need to implement the entire standard.

You only need to focus on the parts that dictate technical product requirements. For your embedded Linux energy meter, the "holy grail" is IEC 62443-4-2 (Technical security requirements for IACS components) and IEC 62443-3-3 (System security requirements).

Here is a step-by-step guide on how to translate IEC 62443 into concrete specifications for your QMS.


Step 1: Determine your Target Security Level (SL)

IEC 62443 defines four Security Levels (SL 1 to SL 4). The higher the level, the more rigorous the requirements.

  • SL 1: Protection against casual misuse.
  • SL 2: Protection against intentional misuse by low-resourced attackers.
  • SL 3: Protection against intentional misuse by moderate-resourced attackers.
  • SL 4: Protection against highly resourced attackers (nation-states).

Action: For an energy measurement device connected to a grid or industrial network, SL 2 or SL 3 is typically the target. You must define this in your System Requirements. Once the SL is defined, it dictates exactly how many of the IEC 62443 requirements you must implement.


Step 2: Translate the 7 Foundational Requirements (IEC 62443-4-2)

IEC 62443-4-2 organizes component security into 7 Foundational Requirements (FRs). This is where you will spend 90% of your time writing software and system specs.

Here is how to translate each FR into Embedded Linux specific specifications:

FR1: Identification and Authentication Control (I&A)

Standard says: The component must verify the identity of users and processes.

  • System Req: "The device shall enforce multi-factor authentication for remote administrative access."
  • Software Req (Linux): "The Embedded Linux SSH daemon shall be configured to disable password authentication and require Ed25519 public key authentication."
  • Software Req (Linux): "The system shall disable the default 'root' user login and require administrators to use individual accounts with sudo privileges."

FR2: Use Control (UC)

Standard says: The component must restrict what authenticated users/processes can do.

  • System Req: "The device shall implement Role-Based Access Control (RBAC) for all local and remote users."
  • Software Req (Linux): "The system shall utilize Linux PAM (Pluggable Authentication Modules) to enforce strict file permission boundaries, ensuring the metering application cannot read/write to the OS configuration directories."

FR3: System Integrity (SI)

Standard says: The component must ensure software and firmware are not tampered with.

  • System Req: "The device shall prevent the execution of unauthorized or modified firmware."
  • Software Req (Linux): "The bootloader (e.g., U-Boot) shall cryptographically verify the Linux kernel and device tree before execution (Secure Boot)."
  • Software Req (Linux): "The root filesystem shall be mounted as read-only and verified at runtime using dm-verity to detect any unauthorized modifications."

FR4: Data Confidentiality (DC)

Standard says: The component must protect sensitive data from unauthorized disclosure.

  • System Req: "The device shall encrypt all sensitive configuration data and cryptographic keys stored in non-volatile memory."
  • Software Req (Linux): "The system shall utilize a Hardware Security Module (HSM) or Trusted Platform Module (TPM) to store the master encryption key for the filesystem."
  • Software Req (Linux): "The device shall encrypt the telemetry data payload using AES-256-GCM before transmission over the network."

FR5: Data Flow Control (DFC)

Standard says: The component must restrict the flow of data to authorized paths only.

  • System Req: "The device shall restrict network traffic to only the ports and protocols required for its intended function."
  • Software Req (Linux): "The system shall utilize nftables (or iptables) with a default-deny policy, explicitly allowing only Port 502 (Modbus), Port 443 (HTTPS), and Port 22 (SSH)."
  • Software Req (Linux): "The Embedded Linux build system (Yocto/Buildroot) shall strip all unnecessary network services (e.g., telnet, ftp, rsh) from the final rootfs image."

FR6: Timely Response to Events (TRE)

Standard says: The component must record security events and alert administrators.

  • System Req: "The device shall maintain an audit log of all security-relevant events, including failed login attempts and configuration changes."
  • Software Req (Linux): "The system shall utilize auditd to monitor and log all execution of sudo commands and modifications to the /etc/ directory."
  • Software Req (Linux): "The device shall securely forward logs to a remote SIEM using TLS 1.2 or higher to prevent log tampering."

FR7: Resource Availability (RA)

Standard says: The component must maintain functionality under normal and adverse conditions (prevent Denial of Service).

  • System Req: "The device shall automatically recover from software crashes without manual intervention."
  • Software Req (Linux): "The system shall utilize a hardware watchdog timer. If the main metering application fails to ping the watchdog within 5 seconds, the system shall perform a hard reset."
  • Software Req (Linux): "The system shall utilize Linux cgroups to limit the memory and CPU usage of non-critical background services, ensuring the metrology process is never starved of resources."

Step 3: Translate System-Level Architecture (IEC 62443-3-3)

While 4-2 is about the component (your meter), 3-3 is about the system (how the meter fits into the grid/factory). 3-3 introduces the concepts of Zones and Conduits.

  • Zone: A logical grouping of assets (your meter is a Zone).
  • Conduit: The communication path between zones (the Ethernet cable/Wi-Fi to the SCADA system).

How to write specs for this:

  • System Req: "The energy meter shall act as an IACS Zone and enforce boundary protection."
  • Software Req: "The device shall inspect incoming network packets at the conduit boundary and drop any malformed or fragmented IP packets to prevent TCP/IP stack exhaustion."

Step 4: Structuring the Traceability in your QMS

To make this auditable, you must link your requirements directly to the IEC 62443 clauses. Use a strict naming convention.

Example Requirement Ticket (in Jira, DOORS, or Polarion):

Req ID: SEC-62443-SI-004 Title: Secure Boot Implementation Category: Security Requirement Source Standard: IEC 62443-4-2, Clause 7.3 (System Integrity), Requirement CR 2.4 Target Security Level: SL 2 Requirement Text: "The Embedded Linux bootloader shall cryptographically verify the digital signature of the kernel image using RSA-2048 or ECDSA-256 prior to execution. If verification fails, the boot process shall halt." Verification Method: Test (Inject a modified, unsigned kernel image and verify the bootloader rejects it and drops to a recovery shell). Parent System Req: SYS-SEC-010 (The device shall prevent unauthorized firmware execution).


Step 5: Pro-Tips for Embedded Linux & IEC 62443

  1. Leverage the CRA Overlap: The EU Cyber Resilience Act (CRA) and IEC 62443-4-2 overlap by about 70%. For example, CRA requires an SBOM (Software Bill of Materials) and secure update mechanisms. IEC 62443-4-2 requires the same under System Integrity and Patch Management. Write one requirement that satisfies both, and tag it with both [CRA] and [62443].
  2. Use a Security Profile: Don't start from scratch. Look at existing Embedded Linux security profiles like the Common Criteria Protection Profile for Mobile Device Fundamentals or specific IEC 62443 implementation guidelines provided by the Linux Foundation (e.g., the Zephyr RTOS security guidelines, or Yocto Project security manual).
  3. Address "COTS" (Commercial Off-The-Shelf) realities: IEC 62443 assumes you can design the hardware and software. With Embedded Linux, the OS is COTS. You cannot easily rewrite the Linux kernel to fix a vulnerability. Therefore, your specifications must heavily emphasize configuration, hardening, and compensating controls (e.g., "If the kernel has a vulnerability, the system shall use seccomp to restrict the system calls available to the vulnerable process").
  4. Define the "Security Development Lifecycle" (IEC 62443-4-1): 62443-4-1 is about process. Your QMS must include a requirement that states: "The software development lifecycle shall include threat modeling (e.g., STRIDE) during the architecture phase, static/dynamic code analysis (SAST/DAST) during implementation, and a penetration test prior to release."

By breaking IEC 62443 down into the 7 Foundational Requirements and mapping them directly to Embedded Linux mechanisms (Secure Boot, dm-verity, nftables, PAM), you transform a 500-page standard into a highly actionable, testable list of engineering tasks.

@doevelopper

Copy link
Copy Markdown
Author

Using an AI to parse a massive standard like IEC 62443 and map it to your specific system is a great idea, but it comes with a major risk: AI hallucination. If you just say "Read this PDF and give me requirements," the AI will likely invent clause numbers, mix up IT security with embedded security, and give you generic advice.

To get a usable, QMS-ready output, you need to use a structured, iterative prompting strategy.

Here is the exact prompt engineering workflow you should use.


Step 1: The "Master Context" Prompt

Use this prompt first to set the AI's persona, define your system, and establish the strict output format. Upload your IEC 62443-4-2 PDF along with this prompt.

Copy and paste this:

Role: You are an expert Systems Security Engineer and Lead Assessor for IEC 62443, specializing in Embedded Linux systems and industrial energy measurement devices.

Context: I am building an embedded Linux-based energy measurement system (smart meter). It must comply with IEC 62443-4-2 (Target Security Level 2), the EU Cyber Resilience Act (CRA), and our internal company security policies.

Task: I have uploaded the PDF for IEC 62443-4-2. I need you to translate the technical requirements from this standard into specific, actionable System and Software Requirements for my Embedded Linux energy meter.

Constraints & Rules:

  1. Focus ONLY on Technical Component Requirements: Ignore organizational, HR, or facility physical security requirements. Focus strictly on the technical controls for the IACS component (the meter itself).
  2. No Hallucinations: You must base your output strictly on the provided PDF. If a specific sub-clause does not apply to an embedded device, state "N/A for embedded component" rather than inventing a requirement.
  3. Embedded Linux Focus: The implementation strategies must be specific to Embedded Linux (e.g., using U-Boot, dm-verity, nftables, PAM, SELinux/AppArmor, Yocto/Buildroot configurations), not generic Windows/IT network advice.
  4. Traceability: Use a strict naming convention for Requirement IDs: SEC-62443-[FR#]-[###] (e.g., SEC-62443-FR1-001).

Output Format:
Please output the requirements in a Markdown table with the following exact columns:
| Req ID | IEC 62443-4-2 Clause | Foundational Req (FR) | Requirement Description | Embedded Linux Implementation Strategy | Verification Method |

Execution:
Do not generate the whole table at once. To ensure high quality and avoid truncation, we will do this iteratively. For now, acknowledge these instructions, confirm you understand the constraints, and only generate the table for Foundational Requirement 1 (FR1: Identification and Authentication Control). Wait for my prompt to proceed to the next FR.


Step 2: The Iterative Prompts

Once the AI generates FR1, review it. If it looks good, use the following prompts to get the rest of the standard. Doing it one Foundational Requirement (FR) at a time prevents the AI from running out of memory/tokens and degrading in quality.

Prompt for FR2:

"Great. The FR1 mapping looks good. Now, please generate the table for Foundational Requirement 2 (FR2: Use Control). Ensure the Embedded Linux implementation focuses on RBAC, PAM, file system permissions, and least privilege for the metering application vs OS services."

Prompt for FR3:

"Proceed to Foundational Requirement 3 (FR3: System Integrity). Focus heavily on Secure Boot, dm-verity, read-only rootfs, and secure firmware update mechanisms (A/B partitioning). Keep CRA requirements for secure updates in mind."

Prompt for FR4 & FR5:

"Proceed to Foundational Requirement 4 (FR4: Data Confidentiality) and Foundational Requirement 5 (FR5: Data Flow Control). Focus on hardware-backed key storage (HSM/TEE), encryption of metrological data at rest and in transit, and network segmentation using nftables/iptables."

Prompt for FR6 & FR7:

"Proceed to Foundational Requirement 6 (FR6: Timely Response to Events) and Foundational Requirement 7 (FR7: Resource Availability). Focus on auditd, secure log forwarding, hardware watchdogs, and Linux cgroups for resource isolation to ensure the metrology process is never starved by network or UI tasks."


Step 3: The "CRA & Gap Analysis" Prompt

Once you have the IEC 62443-4-2 mapping, you need to ensure you haven't missed the specific nuances of the Cyber Resilience Act (CRA), which has some unique process and product requirements.

Upload your CRA summary document or prompt the AI with its knowledge of CRA:

"We have mapped IEC 62443-4-2. Now, I need to ensure compliance with the EU Cyber Resilience Act (CRA).
Based on your knowledge of the CRA, please generate a supplementary table of requirements that are specific to the CRA but might not be fully covered by IEC 62443-4-2.

Focus specifically on:

  1. Software Bill of Materials (SBOM) generation and handling (CycloneDX/SPDX).
  2. Vulnerability handling and automated security update mechanisms.
  3. 'Secure by default' configuration requirements.

Use the ID format SEC-CRA-[###] and use the same table columns as before."


💡 Pro-Tips for Using AI with Standards PDFs

  1. Use an AI with a Large Context Window: IEC 62443-4-2 is a large PDF. Ensure you are using a model that can handle at least 128k to 1M tokens (like Claude 3.5 Sonnet, Gemini 1.5 Pro, or GPT-4o with file search). If the AI says "I can't read the whole file," you may need to split the PDF into Part 1 and Part 2.
  2. Verify the Clause Numbers: AI is notorious for getting standard clause numbers slightly wrong (e.g., citing 5.2.1 instead of 5.2.2). Always spot-check 10% of the AI's output against the actual PDF to ensure the clause numbers are accurate before putting them in your QMS.
  3. Ask for "Negative" Requirements: To make your QMS bulletproof, ask the AI: "Based on the PDF, what are 5 common pitfalls or 'shall not' requirements that embedded Linux developers usually miss when trying to comply with this standard?" Add these as explicit constraints in your architecture document.
  4. Combine with Company Policies: If you have a specific company policy (e.g., "We only use AES-256 and TLS 1.3"), add it to the Master Prompt: "Constraint: Company policy dictates we only use AES-256 and TLS 1.3. Ensure all cryptographic requirements reflect this."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment