Hardware:
- esp_image_verify: walks the segment table (load/length), XORs the segment
data against the stored checksum, aligns to 16 bytes and, when
hash_appended is set, compares the appended SHA-256 with the computed digest
up to the padding. Reports segments, entry, checksums and a valid flag; the
offset supports OTA partitions.
Red:
- crlf_probe: injects an encoded CRLF + X-Apex-Injected: yes through one
parameter (GET/POST) and checks whether the response carries the header;
the response is evidence on a hit.
Blue:
- audit_rules: parses /etc/audit/audit.rules and rules.d/*.rules (root
prefix): rule count, -e 2, an execve rule and watches on /etc/passwd,
/etc/shadow, /etc/sudoers and /etc/group; reports missing watches, missing
execve and unlocked rules.
Tests: generated valid/corrupted ESP images, CRLF-reflecting and filtering
endpoints, full and sparse audit rule sets. 728 checks, ASan suite green,
analyze clean, release-check green including distcheck 1.23.0.
Fixture lesson: the ESP image header is exactly 24 bytes; three extra filler
bytes shift every segment.