# Plc Basics Firmware Review

> Use when reviewing PLC firmware, PLC logic, or engineering workstation software on an authorized OT engagement or lab. Covers firmware inventory and hashing, version and patch comparison, logic change review, hardcoded credential and unsafe default checks, and change control evidence. Also use when a PLC program must be proven to match its approved baseline before it is trusted again.

- Skill: `mizazhaider-ceh/plc-basics-firmware-review` (Agent Skill)
- Install (CLI): `npx get-skill add mizazhaider-ceh/plc-basics-firmware-review`
- Raw SKILL.md: https://api.skillmd.com/api/skills/mizazhaider-ceh/plc-basics-firmware-review/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: mizazhaider-ceh (https://skillmd.com/u/mizazhaider-ceh)
- Updated: 2026-11-22
- Page: https://skillmd.com/skills/mizazhaider-ceh/plc-basics-firmware-review

---


A PLC runs whatever logic and firmware it was last given, and that
state is rarely checked after commissioning. Firmware review answers
three questions. What version is actually running, does the logic
match the approved baseline, and who could have changed either one.
All three are answered offline, from copies, never by flashing or
editing a live controller to see what happens.

Safety warning. Never upload, download, or flash firmware or logic
to a live PLC during a security review. Work from exports and
backups provided by operations, in a lab or on an offline
workstation. A failed or interrupted transfer can stop a process,
and a logic change made for testing can leave a plant in an unsafe
state after you leave.

## Quick Workflow

1. Get written authorization and the approved baseline from
   operations. Without a baseline, you can inventory but you cannot
   verdict a difference.
2. Inventory every PLC in scope. Vendor, model, firmware version,
   logic version, and engineering workstation software version.
3. Hash every firmware image, logic export, and project file the
   moment you receive it, and keep the hashes with your notes.
4. Compare firmware versions against vendor advisories and the
   approved patch level. Flag unsupported or known vulnerable
   versions with their advisory reference.
5. Diff the logic against the baseline. List added rungs, changed
   timers, changed set points, and new network or remote access
   blocks separately.
6. Check for unsafe defaults. Default or shared engineering
   passwords, programming mode left enabled, and unused protocols
   still listening.
7. Review change control. Who approved the last change, when, and
   is there a backup that matches what is running now.
8. Report each controller with its version verdict, its logic diff
   summary, and the exact remediation, such as patch in a
   maintenance window or restore from the approved baseline.

## 1. Inventory and hashing

Hash first, analyze second. A hash taken at receipt proves the copy
you analyzed is the copy operations gave you.

```bash
# Inventory template: one line per controller, filled with operations
cat > /tmp/plc_inventory.csv << 'EOF'
hostname,ip,vendor,model,firmware,logic_version,mode
plc-press-01,192.168.10.20,example-vendor,example-model,see-export,v1.4,run
plc-mixer-02,192.168.10.21,example-vendor,example-model,see-export,v1.2,run
EOF
cat /tmp/plc_inventory.csv

# Hash every export the moment you receive it
mkdir -p /tmp/plc_review
sha256sum /tmp/plc_review/* > /tmp/plc_review/hashes.txt 2>/dev/null || true
cat /tmp/plc_review/hashes.txt
```

```python
#!/usr/bin/env python3
"""Hash a directory of PLC exports and write a manifest."""
import hashlib
import pathlib

BASE = pathlib.Path("/tmp/plc_review")
out = []
for path in sorted(BASE.iterdir()):
    if path.is_file() and path.name != "hashes.txt":
        digest = hashlib.sha256(path.read_bytes()).hexdigest()
        out.append("%s  %s" % (digest, path.name))
        print("%s  %s" % (digest, path.name))
(BASE / "hashes.txt").write_text("\n".join(out) + "\n")
```

## 2. Logic diff against the baseline

Logic diffs are most useful when they separate cosmetic changes from
process changes. A renamed tag is noise. A changed timer, a new
output coil, or a removed interlock is a finding.

```python
#!/usr/bin/env python3
"""Diff two plain text logic exports, grouped by change type."""
import difflib
import pathlib

baseline = pathlib.Path("/tmp/plc_review/baseline_logic.txt").read_text().splitlines()
current = pathlib.Path("/tmp/plc_review/current_logic.txt").read_text().splitlines()
for line in difflib.unified_diff(baseline, current, lineterm="",
                                 fromfile="baseline", tofile="current"):
    print(line)
print("\nReview each added or removed line and classify it:")
print("  cosmetic: rename, comment, layout only")
print("  process: timer, counter, set point, output coil, interlock")
print("  access: new comms block, new remote access, new user or role")
```

```bash
# Quick text signals in an exported project (offline copy only)
grep -r -i -n "password\|default\|admin" /tmp/plc_review/ \
  | head -40
echo "Every hit needs context. A password string in an export is"
echo "evidence for review, not proof of a live credential."
# Look for programming mode and protocol exposure in the export notes
grep -r -i -n "program mode\|remote\|ethernet\|serial" /tmp/plc_review/ \
  | head -40
```

## 3. Version and advisory comparison

Versions only mean something against a reference. Record the vendor
advisory or release note for each version, and never guess a patch
level from a version string you have not checked.

```python
#!/usr/bin/env python3
"""Version comparison table that forces an advisory reference."""
controllers = [
    {"name": "plc-press-01", "running": "see-export",
     "approved": "see-baseline", "advisory": "vendor advisory reference here",
     "verdict": "unverdicted until advisory is checked"},
    {"name": "plc-mixer-02", "running": "see-export",
     "approved": "see-baseline", "advisory": "vendor advisory reference here",
     "verdict": "unverdicted until advisory is checked"},
]
for ctrl in controllers:
    print("%s: running %s, approved %s" % (
        ctrl["name"], ctrl["running"], ctrl["approved"]))
    print("  advisory: %s" % ctrl["advisory"])
    print("  verdict: %s" % ctrl["verdict"])
```

## Edge cases

- No baseline exists. Say so plainly. Inventory and flag obvious
  unsafe defaults, but do not claim the logic is clean or tampered
  with when there is nothing to compare it against.
- Firmware version hidden. Some controllers report firmware only
  through vendor software, not over the network. Record the version
  as not observable over the network and get it from operations.
- Logic exports differ by tool version. The same logic exported by
  two tool versions can diff heavily. Normalize with the same tool
  version for baseline and current before diffing.
- Compiled logic only. Without source, compare hashes and behavior
  notes instead of rung level diffs, and say the review depth was
  limited by the available artifact.
- Safety logic mixed with control logic. If safety logic appears in
  the same project, stop and escalate to the safety team. Do not
  verdict safety logic from a general PLC review.
- Backups that do not match. A backup dated after the last approved
  change, with no change record, is itself a finding about change
  control, even if the logic looks reasonable.

## Key references

- Vendor firmware release notes and security advisories for the
  exact controller models in scope, checked per device.
- NIST SP 800-82 Rev 3, Guide to Operational Technology Security,
  for PLC inventory, baseline, and change control practice.
- IEC 62443 patch management and system hardening concepts, for
  how firmware updates should be approved and staged in OT.
- Parent skill plc-basics, for PLC architecture, scan cycle, and
  operating modes that frame every firmware and logic finding.

