mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 05:51:06 +00:00
53051663d3c5e262be112692d6f52444d034e8e5
55
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
baafd3535d |
docs(firmware): list the filters each firmware-mmio collection accepts
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
f06019cf09 |
docs(firmware): document inspect_firmware_mmio
Merge the literal-pool and split-immediate guides into one firmware MMIO guide covering both instruction tables, the shared access rows and groups, attribution basis, budgets and the firmware-mmio view. Update the documentation index, firmware overview and skill reference. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
0af842ad26 |
feat(firmware): disassemble RISC-V, MIPS32, PowerPC, and ARM64 split-immediate MMIO accesses (#15413)
* feat(firmware): disassemble RISC-V, MIPS32, PowerPC, and ARM64 split-immediate MMIO accesses * fix(firmware): tighten SVD interval inheritance and split-immediate register tracking * fix(firmware): bound inherited SVD block expansion and decode exact destination GPRs * fix(firmware): clear Rs across acquire-ordered ARM64 CAS and CASP variants * chore(mcp): sync advertised schema summary and budget projection with main * fix(firmware): bound CMSIS-SVD numeric widths before BigInt and index expansion * fix(firmware): keep rejected SVD addressBlocks distinct from omitted spans * fix(firmware): bound MMIO representation growth and preserve SVD ambiguity * perf(firmware): memoize SVD address lookups and pre-rank peripheral names * fix(firmware): scan a whole application image by default for MMIO syntheses On the 1.36 MB IROM segment of the MicroPython 1.24.1 ESP32-C3 image, a default call scanned 256 KiB and kept 512 of 713 matching accesses. The omitted rows were not in the retained Evidence, so the agent had to repeat the call with larger controls or page by scan_offset. Defaults now scan 4 MiB and keep up to 32,768 syntheses within a 16 MiB representation allowance, matching the literal-pool tool. Retained summary delivery still sizes what reaches the agent. The image completes in about 1 s with 4,073 syntheses. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(firmware): use MMIO synthesis maximums as their defaults directly The default scan, synthesis and representation constants only repeated their maximums, which Knip reports as duplicate exports. The budgets and the parser fallback now name the maximums. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(firmware): bound SVD match cache weight, exclude RISC-V flash, and report scan-limit stops --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
04d473ca0b |
feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads (#14447)
* feat(firmware): disassemble ARM and Xtensa PC-relative literal-pool MMIO loads Disassemble PC-relative literal-pool load instructions (`arm-thumb` 16-bit LDR and 32-bit Thumb-2 LDR.W, `arm-a32` LDR, and `xtensa` L32R) from local firmware images at an explicit `base_address` without target execution: - Byte-granular `PoolByteBitset` suppresses forward and backward pool byte ranges even at `4k + 2` unaligned file offsets (`base_address` ending in 2). - Two-pass Xtensa pool discovery preserves `L32R` alignment after leading or interleaved 4-byte literal pools and preserves valid `21 36 01` encodings. - Indexed `O(log M)` CMSIS-SVD disjoint `<addressBlock>`/`<register>` matching with cycle-safe multi-hop `derivedFrom` resolution, `mapped_image` bounds precedence, exact ARMv7-M/v8-M SCS sub-blocks, and `arm-a32` SoC neutrality. - Cooperative `setImmediate` event-loop yields with `AbortSignal` cancellation, complete retained Evidence with `detail: "summary"` and `inspect_analysis_view` (`firmware-literal-pools`), `max_svd_nodes` parameter budget, and field-specific `invalid_request` validation. * fix(firmware): bound SVD and candidate memory, preserve overshadowed loads, and report required_value * fix(firmware): resolve SVD derivedFrom chains iteratively and restore lifecycle test title * fix(firmware): bound Xtensa trace and SVD representation memory, make Evidence cooperative, and preserve unaligned literal loads * fix(firmware): retain completed literal-pool scans on late cancellation and avoid repeated SVD string hashing * fix(firmware): walk SVD register clusters, sweep dense overlaps linearly, and preserve XML depth recovery * fix(firmware): enforce profile-wide cooperative SVD cluster expansion budget and sync schema * fix(firmware): pre-parse SVD cluster templates, inherit defaults, and keep Xtensa framing * fix(firmware): share inherited SVD template chains and count compact arrays as single intervals * fix(firmware): replace SVD override chain links with persistent O(log K) treap * fix(firmware): default max_references to the representation-bounded maximum The IROM segment of the MicroPython 1.24.1 ESP32 image resolves 35,179 literal-pool loads. A default call scanned it and then refused at 16,384 references, so the agent had to repeat the whole scan with a larger max_references. The count is checked after scanning, and max_representation_bytes already bounds the Evidence these rows build. The default is now the maximum; the same image completes in 1.4 s with a 12 MB complete result. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * refactor(firmware): use the max_references maximum as its default directly Knip reported DEFAULT_LITERAL_POOL_MAX_REFERENCES as a duplicate export of MAX_LITERAL_POOL_REFERENCES. The budget now names the maximum as its default, and the provider test reads the default from the budget. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * fix(firmware): preserve inherited SVD register widths and addressBlock spans --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
bf7646b0c7 |
feat(firmware): classify privileged system-register, CSR, and port-I/O instructions (#14422)
* feat(firmware): classify privileged system-register, CSR, and port-I/O instructions Add `inspect_procedure_hardware_instructions` (`rea inspect-procedure-hardware-instructions`) to extract and classify architectural non-MMIO hardware instructions from `read_function_instructions` across `arm`, `arm64`, `riscv`, `xtensa`, `mips`, `x86`, and `x86_64`. - Parse provider `<nativeAddress>: <assembly>` lines through the shared native address grammar (`OBSERVED_NATIVE_ADDRESS_PATTERN` / `nativeAddressInputSchema`) without stripping 2-hex-letter mnemonics (`dc`) or discarding address spaces (`rom:0x1000`, `overlay%3Aspace:0x1000`). - Normalize conditional A32/T32 system, coprocessor, barrier, wait, and trap mnemonics (`mrcne`, `mcrgt`, `mrsne`, `msreq`, `cpsie.w`, `wfene`, `wfine`, `sevne`, `svcne`) while preserving original disassembled mnemonics, and cover AArch64 `dc`/`ic`/`at`/`tlbi` maintenance operations. - Parse complete 8-bit immediate x86 port tokens (`0x00..0xff` across `0x`, Intel `h`, `$`/`#`, and decimal syntax), keep register-selected `DX` ports as `unresolved_register`, and separate symbolic or unparsed port tokens as `unresolved_operand`. - Classify zero-source RISC-V CSR set/clear pseudo-instructions (`csrsi csr, 0`, `csrci csr, 0`, `csrs csr, zero`, `csrc csr, x0`) as `read` consistently with their canonical `csrrs`/`csrrc`/`csrrsi`/`csrrci` encodings. Refs #7955 * chore(firmware): refresh the hardware-instruction advertised schema summary The shared Evidence output schema on main now advertises its string patterns, so the summary recorded on the older base was stale. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
6c627682ba |
feat(artifacts): inspect and extract MCUboot firmware images (#15414)
* feat(firmware): inspect and extract MCUboot images offline * fix(firmware): align MCUboot digest tags, ParseFailureError locations, and compact summaries |
||
|
|
60d804050c |
feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables (#15404)
* feat(firmware): disassemble ARM A/R, Atmel AVR, and Motorola 68000 vector tables * fix(firmware): preserve legacy vector views and tighten AVR/ARM-AR bounds * fix(firmware): report truncated AVR vector slots and remove unused wrapper * fix(firmware): enforce ARM A/R LDR pc target rules and slot-based table coverage |
||
|
|
c50b1bae9d |
feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs (#14419)
* feat(firmware): propose CPU, endianness, and load-base candidates for firmware blobs * fix(firmware): preserve MCP caller inputs, x32 decoder width, and bounded ELF tallies * fix(firmware): leave M-profile variant and PPC width unresolved and report observed file size * chore(firmware): remove unused exported types flagged by knip * fix(firmware): recognize x86_64 leave;ret functions, keep uImage ppc width unknown, and preserve MIPS ELF flags * fix(firmware): preserve MIPS/ARM decoder uncertainty and partial scan stages * fix(firmware): preserve MIPS16 and microMIPS ELF ASE mode declarations * fix(firmware): admit Cortex-M vector tables with filled reserved slots The Raspberry Pi Pico SDK fills reserved vector slots with its default handler. The detector required them to be zero, so it missed the vector table and load base of the MicroPython 1.24.1 RP2040 image and offered only an instruction-census guess. Reserved slots may now hold a Thumb handler in the Reset region; any other value still rejects the table. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> * feat(firmware): identify ESP-IDF images from their header chip_id The detectors found no candidate for the MicroPython 1.24.1 ESP32 image. They have no Xtensa signature, and the chip is named in the image header. A new esp-image-header detector recognizes the ESP-IDF header at offset 0 or a ROM bootloader offset, and takes the ISA from the existing ESP-IDF chip table. The chip_id field now has one reader shared with the ESP image parser. ESP32 images report Xtensa and ESP32-C3 images RISC-V. Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> --------- Co-authored-by: gensokyo-dev <gensokyo-dev@users.noreply.github.com> Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
a5bf175e06 |
fix(artifacts)!: report reader admission limits as resource_constraint (#15588)
* fix(artifacts)!: report reader admission limits as resource_constraint An artifact read refused by a reader limit (artifact_limits.*) or a release-fixed allowance was code partial, which the error contract reserves for a result cut short by a delivery or decode limit. The read was refused at admission, so it is now resource_constraint, like every other admission limit. The retry class is unchanged: change_first when the limit can be raised, never when it cannot. A limit without admission facts, such as a parser budget, stays partial. The reader's own recovery, which names the parameter, its supported range and the next step, and the reader_limit fact are unchanged. Refs #15323 BREAKING CHANGE: artifact refusals with details.reason "limit" and a details.reader_limit or fixed allowance report code and category resource_constraint instead of partial. Match resource_constraint, or read details.reason and details.reader_limit, which are unchanged. * fix(errors): catalogue each artifact admission limit with the retry it returns The catalogue listed one row for reader limits and fixed allowances with change_first, though a fixed allowance and a reader limit already at its maximum return never, and the release-fixed row still said partial. List the raisable reader limit, the reader limit at its maximum and the release-fixed allowance as separate rows, and test each row against the error it projects. |
||
|
|
9b471ab6ca |
fix(uefi): name the output budget and depth limit that stopped extraction (#15434)
extract_uefi_firmware with an exhausted output budget reported one generic size-truncated gap per withheld payload (2995 with max_output_files 5), empty limitations for a whole-image target, and nothing naming the limit. Each budget gap now starts with the parameter and value that stopped it (max_output_files or max_output_bytes), and the first limitation states how many payloads and bytes the budget withheld, which parameter stopped them, its maximum and how to continue. Depth-limited gaps name max_depth. A target offset that maps nothing names inspect_uefi_firmware as the way to find valid offsets. Refs #15343 |
||
|
|
a5aee4f9e9 |
feat(artifacts): inventory Android super image metadata (#14928)
* feat(artifacts): inventory Android super image metadata Refs #14391 * fix(artifacts): preserve partial Android super metadata evidence * fix(artifacts): recognize Android super PE overlays Refs #14928 * fix(artifacts): reject an Android super device with no usable sector A first usable sector at the device size was accepted, so extent checks reported a different field. Keep stored copy failures to malformed, truncated, and unsupported now that format failures include unrecognized. * fix(artifacts): preserve Android super partial evidence on budget exhaustion * fix(mcp): preserve existing provider partial observation contracts --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> |
||
|
|
358e4e52ad |
feat(iso9660): stream files across separated extents (#15190)
* feat(iso9660): stream files across separated extents * test(iso9660): compare extracted buffers directly * fix(iso9660): keep separated read plans private --------- Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
c91c504089 |
fix(nro): exclude ASET header bytes from asset ranges (#15185)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
6053481d47 |
fix(nds): bind file names to disjoint FNT subtables (#15178)
* fix(nds): bind file names to disjoint FNT subtables * test(nds): cover FNT subtable boundaries and recovery * fix(nds): retain reached directories with unusable names --------- Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
eb5cd34258 |
fix(devicetree): read later FDT versions backwards compatible with v17 (#14136)
* fix(devicetree): read later FDT versions backwards compatible with v17 The header reader admitted only versions 16 and 17 and consulted last_comp_version only to reject a value above the version. DTSpec 5.1 requires a client to accept any version backwards compatible with version 17, and libfdt reads such a blob with the version 17 header. Admit a later version whose last_comp_version is 17 or lower and read it with the version 17 layout, reporting the declared version. A later version that needs a newer reader and any version below 16 stay unsupported, and v16 and v17 outcomes are unchanged. FIT recognition shares the reader, so it now claims a FIT in such a version as well. * test(devicetree): cover a later FDT version backwards compatible with v17 Parse the shared fixture with version 18 and last_comp_version 16: the header is read with the version 17 layout and the tree decodes as it does for v17. Raising last_comp_version to 18 keeps the blob unsupported. FIT recognition, which shares the header reader, covers the same version. On the previous reader the version 18 parse and the version 18 FIT recognition fail, because version 18 was refused before last_comp_version was read. * docs(devicetree): describe later FDT versions backwards compatible with v17 * test(devicetree): keep the unsupported-version cases on an incompatible header The CLI and MCP error cases used version 18 as an arbitrary unsupported version, but their fixture declares last_comp_version 16, which is now read as a version 17 blob. Declare last_comp_version 18 there so both cases still reach unsupported_target through the public paths. The shared fixture takes the declared compatibility version for this, and the parser case uses it instead of patching the header word. * test(devicetree): cover compatible versions through CLI and MCP --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
9ab90fd7f0 |
fix(ubi): bound smaller-grid probe memoization (#15168)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
244147a2a0 |
fix(iso9660): read a directory record's data length from its little-endian half (#14801)
* refactor(iso9660): read both-endian halves through one helper Split the half reading out of readBothEndian, and name the failure it raises, so a caller can keep a disagreeing big-endian copy or raise the same failure itself. The agreement check and its failure are unchanged. * fix(iso9660): read a directory record's data length from its little-endian half One directory record whose big-endian data_length copy differed from its little-endian half refused the whole image as malformed, wherever the record sat in the tree, so no member was inventoried. Linux isofs, libarchive and pycdlib read only the little-endian half of a record's data length, because mastering programs have written images whose big-endian copy is wrong. Records inside directory extents now use the little-endian half and keep a disagreeing copy, which the entry reports as a limitation with both values. A descriptor's own root record still requires both halves to agree, as libarchive does, and every other both-endian field keeps its agreement check. The boundary case that pinned the refusal now lists the file or the directory by its little-endian length and reads the rest of the tree. * test(iso9660): keep descriptor root records strict about data length halves A primary or Joliet descriptor whose root record stores a big-endian data length copy that differs from its little-endian half stays malformed at that field, so the little-endian reading of records inside directory extents does not reach the descriptors. * docs(iso9660): describe the little-endian data length of directory records * test(iso9660): name each disagreeing section of a multi-extent file Damage the big-endian data length copy of both sections of a contiguous multi-extent file followed by a clean file. The file keeps its summed little-endian size and verified hash, and its entry names both records with their own values, in section order. The next file carries no disagreement, so the per-member list is neither lost between sections nor carried into the following member. * test(iso9660): print the section limitation filter as an expanded chain The formatter prints the three-group chain in the multi-extent case, rows.get(path)?.limitations.filter(...), one member per line when it does not fit on one line. The previous commit kept it on one line, which failed format:check. * fix(iso): retain directory-link length disagreements --------- Co-authored-by: Vincent Koc <vincentkoc@ieee.org> |
||
|
|
72b74f090f |
fix(iso9660): read a directory record whose identifier padding byte is not zero (#15020)
* fix(iso9660): read a directory record whose identifier padding byte is not zero A record whose even-length identifier was followed by a nonzero padding byte failed as malformed, and the walk ended the whole inventory on it. The byte takes no part in decoding: Linux isofs, libarchive, pycdlib and 7-Zip step over it, and 7-Zip notes that some discs store another value there. The value is no longer checked. A record too short to hold the padding byte stays malformed. * test(iso9660): read a nonzero identifier padding byte in the Joliet tree Joliet identifiers are UCS-2, so every file and directory record in that tree has the padding byte. The case now damages the record of the tree the reader walks and checks that tree was the one listed. * docs(iso9660): describe the unchecked identifier padding byte |
||
|
|
18dfe17425 |
fix(android-ota): report bytes beyond the declared payload (#15113)
* fix(android-ota): report bytes beyond the declared payload * test(android-ota): exercise an unsigned payload suffix --------- Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
6f36de3012 |
feat(ghidra): admit raw 8051 images (#15057)
* feat(ghidra): admit raw 8051 images Add 8051 as a raw-only architecture: byte-aligned entry, mapping within 0x0000..0xffff, analyzed by Ghidra with 8051:BE:16:default in the CODE space. Hopper, IDA, Kuna and Windows Ghidra P0 keep refusing it. Document the lane, including that bank-switch thunks and Keil ?C?CCASE switch arms are not followed by auto-analysis and need REA_GHIDRA_SEED_FILE entries. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(mcp): update the advertised open_binary schema summary for raw 8051 The architecture enum gained 8051, so the committed input schema digest for open_binary changed. Regenerated with `npm run verify:advertised-schemas -- --update-summary`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test(ghidra): pin the 8051 CODE binding and correct the 8051 docs - Assert the 8051 language binding (8051:BE:16:default, CODE) and that load-image attestation requires the CODE default space; replacing CODE with ram now fails three tests. - Assert that Windows Ghidra P0 refuses raw 8051. - Derive the raw-binary architecture refusal from BINARY_ARCHITECTURES with Intl.ListFormat; the wording, and so the admission grid digest, is unchanged. - Docs: list the memory blocks Ghidra really creates for 8051 (no external RAM block), explain bank addressing for paged banks and the entry-decode requirement, state when the seed file is read, and add 8051 to the n64 guide's family list. Fix a duplicated "and" in the generic-language limitation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Alex Petrochenko <5717309+petrochen@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> |
||
|
|
adf61c7aba |
fix(nro): report bytes beyond the ASET asset ranges (#15064)
Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> |
||
|
|
a91d9fa2b5 |
feat(firmware): decode ARM M-profile and RISC-V mtvec interrupt vector tables (#14421)
* feat(firmware): decode ARM M-profile and RISC-V mtvec interrupt vector tables * fix(firmware): name vector-table exceptions per ARM variant and report unbound SVD interrupts The architecture field now takes the ARM M-profile variant names REA uses for raw images (armv6-m through armv8.1-m.main) plus riscv. ARMv8-M Baseline gets ARMv6-M's exceptions; only Mainline names MemManage, BusFault, UsageFault, SecureFault and DebugMonitor. The old armv8-m value named Mainline faults on Cortex-M23 tables. vtor_aligned checks the 128-byte ARMv7-M/ARMv8-M minimum and is null on ARMv6-M, whose VTOR is optional and implementation-defined. Slots past the end of the 32-bit address space are no longer decoded with wrapped addresses, and an initial stack pointer that is not word-aligned is flagged. CMSIS-SVD interrupts without a name or with a non-integer value are reported as anomalies instead of skipped silently, and the expanded-name budget is charged once while parsing instead of twice with two formulas. likely_default_stub is removed: every shared-handler group set it to true. RISC-V limitations now cover vectored exceptions on slot 0, CLIC address tables and the mcause numbering assumed for SVD bindings. * fix(firmware): bound SVD anomaly diagnostics, RISC-V pair addresses, and shared budget recovery * fix(firmware): index SVD duplicates per peripheral and admit one-slot RISC-V tables Duplicate interrupt declarations were found by rebuilding a key that repeats the full peripheral name for every <interrupt>, so a long name repeated across many declarations cost name length times declaration count. Bound names are now indexed per peripheral name, looked up once per <peripheral>. The 8-byte minimum held for every architecture, but only an ARM table must start with InitialSP and Reset; a RISC-V Direct-mode table can be one instruction. max_entries and max_file_bytes now admit one slot. * refactor(firmware): hoist the SVD IRQ value patterns to module scope * fix(firmware): record RISC-V pair byte extent and attribute caller input errors * style(firmware): format the vector-table provider * fix(firmware): add summary delivery and analysis views for vector tables * test(firmware): check vector-table recoveries and budgets through their owners Recovery assertions compare the delivered action with the shared refusal formatter applied to the reported limit, instead of pinning sentences. The summary-delivery test set REA_AGENT_RESULT_MAX_BYTES, which nothing reads, and used a result large enough to exceed the default budget too; it now sets REA_AGENT_RESULT_BUDGET_BYTES, asserts the reported budget, and uses a result between the minimum and default budgets, checking that the default delivers it complete. The view counts active ARM entries and recognized RISC-V slots with a loop instead of filtered copies. * perf(firmware): count active vector slots once in the report producer The analysis view recounted active ARM entries and recognized RISC-V slots on every summary and page request. The producer already collects exactly those slots as handler targets, so the report now stores active_arm_entry_count and recognized_riscv_slot_count from them, and the view reads the stored fields. The service checks the stored counts against the slots once when it validates the provider's report. --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
ba1ddffd7e |
feat(artifacts): inspect Sega Mega Drive and Genesis ROM headers offline (#14895)
* feat(artifacts): inspect Sega Mega Drive and Genesis ROM headers offline These ROMs are inventoried as containers. A plain image matches when the four bytes at offset 0x100 are SEGA; an SMD dump matches the copier mark 0xAA 0xBB and a block count whose de-interleaved bytes carry SEGA, then the odd and even halves are merged into the linear image. The root record stores the 68000 vectors, header strings, declared and computed word checksum, ROM and RAM ranges, devices, external RAM, and region, with members vectors.bin, header.bin, and program.bin (SMD members carry an image offset and a null file range). A checksum or range disagreement leaves coverage unknown, 32X and Sega CD remain labels only, and a file past 8 MiB or 512 SMD blocks is refused under the named fixed ceilings before its body is buffered; the shared region reader maps that refusal onto the typed allowance, and the guide, CLI, supported-targets table, CI scopes, and ceiling registry include the format. * Address review feedback * Address review feedback * Address review feedback * fix(artifacts): read Mega Drive work RAM on the 24-bit bus and keep ambiguous regions A header that declares work RAM as 0xE0FF0000-0xE0FFFFFF, the SGDK default, was reported outside the work-RAM window because the check compared full 32-bit values. The 68000 drives 24 address lines, so the window check now compares bus addresses; metadata keeps the declared values. A region field of a lone A, B or E is both a classic region letter and a one-digit mask, and references disagree on which it is. It was reported as letters with no limitation. It is now region_style ambiguous, keeps both readings in region_characters and region_mask, and records a limitation. * refactor(artifacts): name Mega Drive header fields once and share the SMD half layout Header field offsets and lengths were literals repeated at each read, and device support was sliced twice from separate literals. One TEXT_FIELDS table, the named numeric offsets and the EXTERNAL_RAM block now hold the layout, citing SGDK's rom_head.c and Genesis Plus GX's getrominfo and sram_init. SMD recognition and de-interleaving each encoded which block half holds the odd bytes. Both now use SMD_ODD_HALF and SMD_EVEN_HALF, and the decoder takes the block count from the de-interleaved image instead of recomputing it from the file size. The SMD round-trip test only checked the fixture against its own inverse. It now also pins the fixture's file bytes to the Genesis Plus GX deinterleave_block layout. * fix(artifacts): model the Mega Drive 68000 bus once and decide SMD dumps before ESP images Header addresses were compared in three places with two rules: the RAM check masked to 24 bits while the reset-PC check compared raw 32-bit values, and neither knew the work-RAM mirror. One owner now holds the MC68000 24-bit bus (the top byte is not driven) and the Mega Drive work RAM, 64 KiB mirrored through 0xE00000-0xFFFFFF (Genesis Plus GX gen_init maps pages 0xE0-0xFF to it). The reset PC is checked against the ROM range on that bus, so 0xFF000200 fetches from 0x200, and a RAM range is work RAM when it covers at most 64 KiB inside the mirror, such as 0xE00000-0xE0FFFF. Metadata keeps the declared values. An SMD dump of 233 or 489 blocks has 0xE9, the ESP image magic, in its copier header's block-count byte, so the ESP image recognizer claimed it. The shared recognizer table now decides the SMD layout, whose signature also needs the AA BB mark, interleaved SEGA bytes and an exact size, before the ESP recognizers, and the plain layout keeps its place after the leading-magic formats. * fix(docs): restore separate Mega Drive and N64 entries after the main merge * fix(mega-drive): read ROM range and checksum window on the 24-bit bus The reset PC check already masked the top address byte, but ROM ordering, extent, the nonzero-start note and the checksum window still used the raw declared endpoints. A 0x400-byte image declaring 0xFF000000-0xFF0002FF summed through 0x3FF instead of 0x2FF, and a full 0xFF000000-0xFF0003FF alias was marked incomplete. Derive bus addresses once in the parser and keep the declared values in metadata. * fix(artifacts): order every Mega Drive header range on the 24-bit bus The ROM range was ordered on the 68000 bus, but the RAM range and the external RAM range still compared raw 32-bit endpoints. A header whose endpoints alias through different top bytes, such as RAM 0xE0FF0000-0x00FFFFFF, was reported as reversed even though the bus range is the 0xFF0000-0xFFFFFF work RAM. The bus owner now has one ordering rule, busOrdered, and the ROM, RAM and external RAM checks all use it. Declared values stay in metadata. A range whose end wraps past the 24-bit bus, such as 0xFF0000-0x1000000, is now reported as reversed, which is what the bus sees. * fix(artifacts): keep truncated region failures typed and publish Mega Drive bus addresses A region decoder could only report malformed, limit or unsupported, and the shared DecodedRegionArtifactReader mapped every kind but malformed to a fixed-limit refusal. A recognized Mega Drive header cut short was therefore reported as malformed, and an unsupported region failure would have surfaced as a limit. RegionDecodeFailure now has truncated, with the measured extent, and the reader maps each kind to its own typed failure: malformed, truncated, unsupported or limit. The header checks already interpret ROM, RAM and reset addresses on the 68000's 24-bit bus, but metadata exposed only the stored longwords, so the raw m68k hand-off told callers to load at the stored ROM start. A header that stores 0xFF000000 then loads at the wrong address. ROM and RAM ranges now carry bus_start and bus_end, the reset vector carries reset_pc_bus, and the guide and skill hand off with rom.bus_start. --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
f6cf6a867f |
feat(firmware): decode ESP-IDF Non-Volatile Storage (NVS) flash partitions (#14436)
* feat(firmware): decode ESP-IDF Non-Volatile Storage (NVS) flash partitions
Add offline ESP-IDF v1/v2 NVS partition decoding via `inspect_esp_nvs`
(`rea inspect-esp-nvs`) with complete retained Evidence, `detail: "summary"`
and `inspect_analysis_view` (`kind: "esp-nvs"`) paging, linear O(N+M) v2
multi-chunk blob reassembly, slot-by-slot CRC recovery past damaged item
headers, fail-closed `partition_offset`/`partition_bytes` bounds validation,
and full capability conformance and provider lifecycle coverage.
* fix(firmware): follow ESP-IDF NVS page states, header rules and encryption layout
Page states now follow ESP-IDF's PageState constants (corrupt 0xfffffff0,
invalid 0, unknown otherwise), with the header CRC and whether entries were
walked reported separately. NVS encryption keeps page headers in plaintext,
so an encrypted page is reported as a valid page whose item headers are all
unreadable instead of as a header CRC failure.
Item headers follow Item::checkHeaderConsistency: span per type, BLOB_IDX
and BLOB_DATA chunk-index rules, and a variable item's span matching its
length. An inconsistent header is not trusted and the walk advances one
slot. Unrecognized types are no longer entries with unknown values, and
namespace index 0 items that are not definitions are reported instead of
skipped silently.
Adds float (0x24) and double (0x28) items, keeps the bytes of non-UTF-8
strings and keys, and marks older copies of a key superseded by a higher
page sequence number or a later slot. Spec constants are named once and
v2 blob reassembly moves to its own module.
* fix(firmware): preserve NVS key byte identity, summary retention, bitmap span checks and artifact handoff
* fix(firmware): preserve intact NVS values, copied blob chunks, unknown page versions and -0
* fix(firmware): report older copies of used NVS blob chunks instead of dropping them
An interrupted page move leaves an older copy of a BLOB_DATA chunk next to
the copy a recovered blob used.
|
||
|
|
b3f70898e4 |
feat(firmware): inspect and extract Android DTBO partition images (#14398)
* feat(firmware): inspect and extract Android DTBO partition images * fix(firmware): replace fixed DTBO limits with artifact_limits * fix(artifacts): keep saved effective_limits compatible without android_dtbo * fix(firmware): accept shared DTBO payloads and keep unknown facts unknown mkdtimg writes a repeated input file once and points every entry for it at the same payload (libufdt mkdtimg_core.c search_fdt_info), so an exactly shared range is valid; only partial overlaps are refused. A compressed entry's inner FDT magic was not examined, so fdt_magic_valid is now null rather than false. Bytes inside total_size that the header, entry table and payloads do not claim are reported with their range and make coverage unknown. dt_table_header and dt_table_entry field offsets are named after dt_table.h. * fix(firmware): charge every DTBO row against artifact_limits.expanded_bytes Shared payloads are valid, but each row is hashed and can be extracted separately, so 4096 rows naming one 16 MiB payload multiplied inventory and extraction work to 64 GiB. Admit the declared bytes of every row against the shared aggregate expansion allowance before reading any payload, as PCK aliases do. * test(firmware): throw the parser's typed error in DTBO success cases Success cases asserted ok and returned, so a parse failure showed only a boolean mismatch. They now throw the typed ParseFailureError, as the testing guide requires. * test(firmware): drop a duplicated result guard --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
17b53ee004 |
feat(artifacts): inventory Nintendo 64 ROM images and normalize byte order offline (#14911)
* feat(artifacts): inventory Nintendo 64 ROM images and normalize byte order offline An n64-rom image is recognized from the first word in z64 (80 37 12 40), v64 (37 80 40 12), or n64 (40 12 37 80) order plus a 4-byte-aligned boot address in KSEG0 or KSEG1. The reader normalizes the cartridge header and serves header.bin, ipl3.bin, and program.z64 in big-endian order, swapping v64 and n64 bytes and recording that swap as decoded. It names the IPL3/CIC variant from the CRC32 of bytes 0x40..0x1000 and, for a known variant, recomputes the CRC pair over the 1 MiB window; a mismatch, unknown CIC, short window, or non-zero reserved header bytes leave coverage unknown, and a file above 64 MiB is refused before any swap. Comparison ignores n64-rom and n64-rom-entry metadata so dump order is not treated as a content change, and decoded members share the idle-abort helper the Switch executable reader now calls. * fix(n64): admit members before reading and follow each byte order's swap unit Charge artifact_limits.expanded_bytes from the file size and byte order before the checksum window is read and swapped. The member layout now has one owner, n64RomRegions, which the parser and the allowance both use. The length rule follows the order's swap unit, as in mupen64plus-core: a z64 image of any length needs no swap, a v64 image needs an even length and an n64 image a multiple of 4. The guide now says that a printable destination byte outside the known table keeps its code with a null destination_name. * refactor(n64): name header fields from the spec and share the boot-address check Header offsets, the first-word magics, the CIC 6105 table offset and the KSEG bounds are now named constants with their reference sources, and recognition and parsing share one boot-address decision. A closed-form test checks the cartridge checksum on an all-zero window for every CIC, derived from the checksum routine rather than from n64CartridgeCrc. * fix(n64): keep the present bytes of a final partial word in the checksum window The checksum routine now reads one defined window, n64ChecksumWindow: the image through 0x101000 with only the bytes past a shorter file taken as zero. A z64 or v64 image that ends inside a word keeps that word's bytes instead of losing the whole word. The limitation now says how many bytes were assumed. --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
943a1f329e |
fix(uefi): decode LZMA sections through one shared LZMA1 owner (#14918)
* fix(uefi): decode LZMA sections through one shared LZMA1 owner UEFI LZMA custom sections whose header declared a dictionary above 64 MiB were refused as an output limit even when their output was tiny, because the worker compared the dictionary with the output budget and handed it to lzma-purejs, which allocates a window of that size. EDK II's one-call LzmaDecode uses its output buffer as the dictionary, so a valid stream never needs more window than its output. src/compression/Lzma1.ts now owns LZMA1 for UEFI and UnityFS: the LZMA-Alone header and LZMA1 property bounds (lc 0-8, lp 0-4, pb 0-4), the range coder lead-in, a decoder window of max(4 KiB, min(dictionary, output bound)), bounded output, and the verdict on a stream. Lzma1Header.ts reads the header fields with BinaryReader at the host boundary. The UEFI worker keeps its framing, x86 branch filter and reply protocol; a corrupt stream or invalid properties are now reported as malformed rather than as a decoder fault. The UnityFS worker thread loads the same module instead of an inline decoder. Closes #14917 * fix(compression): leave LZMA1 host faults to their host decodeLzma1Alone reported every exception from the codec as a malformed stream, so an allocation failure or codec defect inside the decoding host looked like corrupt input, and the codec's own verdict text was lost. Only lzma-purejs's verdict literals ("Error in data stream", "Incorrect stream properties") are now a malformed verdict; anything else is rethrown for the host to classify (UEFI reports it as a decoder fault, the UnityFS worker as a runtime failure). |
||
|
|
6b269dbd97 |
feat(uefi): read TianoCore EDK2 NVRAM variable stores (#14701)
* feat(uefi): read TianoCore EDK2 NVRAM variable stores Add read-only parsing of gEfiVariableGuid / gEfiAuthenticatedVariableGuid VARIABLE_STORE_HEADER regions to inspect_uefi_nvram via additive edk2_stores, preserving the AMI NVAR stores contract and reporting added vs superseded variable states. * fix(uefi): harden EDK2 NVRAM scan coverage and accounting Occupy store ranges and charge decoded names before retention, keep truncated and damaged-name facts, examine unread tails, and compose empty-format diagnostics from scanner facts with a provider-level test. * fix(uefi): preserve enclosing EDK2 stores and scan erased ranges in blocks Walk store GUID candidates in ascending offset order, claim only verified spans so damaged oversized headers cannot hide later stores, and checkpoint erased suffixes per 64 KiB block. * fix(uefi): keep unusable EDK2 store signatures from reading as absence A gEfiVariableGuid or gEfiAuthenticatedVariableGuid match whose header lacks the formatted marker was skipped silently, so an image holding only such a header reported that no EDK2 store exists. It is now reported as a rejected signature, and the absence statement is qualified. A formatted store that is not HEALTHY is walked with EDK2's verdict as a caveat: EDK2 treats it as invalid, while UEFITool still parses it. A store at an unaligned image offset states the HEADER_ALIGN assumption. An in-use EDK2 fault-tolerant-write queue is noted, because REA does not replay FTW writes or rebuild a store from the spare area. AMI NVAR and EDK2 scans now share one structural record budget, as the limit documents. GUID signature encoding moves to UefiGuid beside its decoder, header field offsets are named after VariableFormat.h, the limitation-line cap is a named limit, and the store walk is split from header admission with unreachable branches removed. * fix(uefi): distinguish unchecked EDK2 stores from absence Carry an explicit completed-search absence fact from the EDK2 scanner. Partial or budget-stopped searches report that presence is unknown instead of claiming no store exists. --------- Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
55bb5e78a3 |
fix(iso9660): read Joliet trees whose .. records name their own directory (#14817)
* fix(iso9660): read Joliet trees whose .. records name their own directory libisofs, behind xorriso and its mkisofs emulation, writes every Joliet subdirectory's .. record with that directory's own extent and length: write_one_dir_record() reads the block and length before it switches to the parent node. The reader required .. to name the parent and refused the whole image, so a Joliet ISO from xorriso -J, such as the Alpine 3.21 release ISOs, could be neither inspected nor extracted. A Joliet tree now also accepts a .. record that describes the directory itself. The primary tree keeps the strict check. * test(iso9660): check a self-describing Joliet .. against its own lengths The reader test gives every directory the same data length and no extended attribute record, so it would still pass if the relaxed check compared those fields with the parent's. The parent link here differs in both, and a self-describing .. carrying the parent's data length or extended attribute length is rejected. |
||
|
|
14b4d1f7ad |
feat(firmware): inventory and extract UBI image volumes offline (#13333)
* feat(firmware): inventory and extract UBI image volumes offline * docs: name ubi-volume among compared format metadata kinds The artifact comparison contract lists every format metadata kind that compare_artifacts compares. ubi-volume now carries a declaration, so the contract names it beside the other members. * fix(firmware): keep UBI LEB ranges private to the reader entries() yielded copyArtifactEntry(entry), which spreads the private volume field by reference, so a caller could rewrite volume.ranges and change the bytes the next open() read. Yield only the public entry fields, and test that a returned entry carries no volume mapping. * fix(firmware): keep LEB source ranges in ubi-volume metadata Saved Evidence now records the lnum, PEB, image offset and length of each chosen LEB, so a reassembled volume can be traced to its image bytes. The image summary keeps counts. * fix(firmware): reject smaller UBI eraseblock sizes whose LEB padding is invalid A dynamic LEB with data_size 0 and data_pad equal to a smaller candidate LEB passed the size check, so a valid aligned image was refused as ambiguous. Require data_pad below the candidate LEB, as classifyUbiPeb and the volume table alignment rule already do. * fix(ubi): refuse a UBI# file shorter than its erase-counter header recognizeUbiImage recognized any 4 to 63 byte file starting with UBI# without a CRC or version to check, so open_binary accepted it as an archive and inventory labelled it a container. It now takes the file size and refuses a file that cannot hold the 64-byte header. A short prefix read from a longer file still defers to the reader. * fix(ubi): refuse a volume whose only surviving LEB copy failed its CRC When both competing PEBs for a LEB are wear-leveling copies and both fail their data CRC, the older failed copy still won and open() served bytes that had already failed verification. Mark that LEB unverified and refuse the volume with extract refusal unverified_copy, keeping its inventory. * fix(ubi): refuse an image whose EC headers disagree instead of skipping them Eraseblock discovery and both spacing checks skipped a valid erase-counter header whose image_seq or layout differed from PEB 0, treating it as absent. Alternating sequences or a conflicting second header then measured a multiple of the real eraseblock size and read the image, so a volume became an extractable empty or header-polluted volume. Any valid header now begins an eraseblock, and classifyUbiPeb and checkUbiPebs refuse the disagreement. * fix(ubi): rule out a smaller eraseblock size whose volume table is invalid The ambiguity check declared a smaller eraseblock size equally valid from erased header positions and LEB fit alone. With 128 KiB eraseblocks, data_offset 4096 and a volume of alignment 6144, data_pad is 4096, but a 64 KiB LEB would need data_pad 0, so that size cannot describe the image and a valid image was refused. The check now also requires a volume table copy to stay valid under the smaller geometry, and runs after the table copies are read. * fix(ubi): compare the volume ID in a UBI volume declaration The compared ubi-volume declaration left out the volume ID. A volume renumbered from ID 0 to ID 1 keeps its path and reconstructed bytes, so artifact comparison reported it unchanged even though consumers that address volumes by number now see a different volume. The declaration now includes the ID, and PEB placement stays out of it. * fix(ubi): refuse a volume with no mapped LEB when PEBs are corrupt When a volume's only data PEB had a bad EC or VID header CRC, classification dropped its mapping and reassembly read the absence of surviving headers as an empty volume: a static volume got used_ebs 0, a dynamic one zero LEBs, and both were served as extractable empty files. A corrupt PEB may have held that data, so a volume with no mapped LEB in an image with corrupt PEBs is now inventoried but refused as lost_lebs, with used_ebs null and a named limitation. An image without corrupt PEBs still reads an unmapped volume as empty. * fix(ubi): accept EC headers in static LEB data no smaller eraseblock holds A static volume holding a nested UBI image with the same EC layout puts valid EC headers on a smaller grid inside its payload. With 128 KiB eraseblocks, data_offset 4096 and full 126976-byte static LEBs, the spacing check and the smaller-grid scan refused such a header as a geometry conflict, though ubiSmallerPebSizeHoldsLebs already rules out every smaller size those LEBs would have to fit. Both scans now run their verdict after the PEBs and volume table copies are read, and set aside a header at a position only ruled-out sizes would begin at. A spacing conflict still takes precedence over later failures, and a header where a smaller size stays possible, as under dynamic LEBs, is still refused. * Address review feedback * Address review feedback * Address review feedback * Address review feedback * fix(ubi-image): carry parser limit facts through reader refusals parseFailure now passes the named parser limit and a typed parser fixedAllowance when it wraps a UBI limit refusal, so the 16 MiB eraseblock size ceiling and the 262,144-eraseblock count ceiling reach CLI and MCP with reported_limits and the fixed-ceiling recovery. * fix(ubi-image): ignore nested EC headers no eraseblock could begin at The second-header scan now skips headers inside the data the first PEB's own VID header declares, so a static LEB holding a nested UBI image no longer measures the eraseblock at the nested header. The spacing check now counts only headers at positions an eligible smaller eraseblock (dividing the measured size, larger than data_offset) would begin at, and after the LEBs are read only the sizes they still admit. A dynamic LEB holding a nested image of small eraseblocks parses the same in PEB 2 as in PEB 5. * fix(ubi-image): read only the first VID header within the eraseblock ceiling The eraseblock search read every byte from offset 0 through the first PEB's declared vid_hdr_offset to find its VID header. A CRC-valid EC header could declare an offset of 1 GiB and make the reader allocate a buffer that size before the eraseblock ceiling refused the image. ubiFirstVidHeaderOffset now admits the VID header only when it lies inside the file and the fixed eraseblock ceiling, and the reader reads just those 64 bytes. A header past the ceiling is never read, so the search reaches its bounded eraseblock-size refusal as before. * fix(ubi-image): skip EC headers whose offset cannot be the eraseblock size A dynamic VID header declares data_size 0, so a first PEB holding a nested UBI image only rules out the nested header at data_offset. The next nested header, 6144 bytes into a 128 KiB eraseblock, was taken as the eraseblock size and the valid 524288-byte image was refused as not a multiple of it. The second-header search now skips headers at offsets that do not divide the file size, since no eraseblock size could put them there. The first header at any offset is still kept for the refusal when no size fits. * fix(ubi-image): reject truncated dumps with misleading PEB headers * Address review feedback * Address review feedback * Address review feedback * Keep undersized UBI candidates provisional on valid VID extents A CRC-valid VID header whose data_pad and data_size do not fit a candidate LEB now records the eraseblock size it needs. A dividing candidate smaller than that stays retryable, with its image kept as the fallback, so a later candidate that holds every LEB in full is accepted. * Address review feedback * Address review feedback * Exercise the UBI PEB count ceiling in memory * fix: reject unrelated UBI header conflicts * fix: verify static UBI payloads before retrying geometry * fix: bound UBI static payload CRC work across PEB size candidates * fix: repair UBI integration after merging main * Address review feedback * fix: let cancellation retire paused UBI volume streams * test: synchronize paused UBI volume cancellation * fix: preserve UBI read failures during cancellation * perf(ubi): count PEB states and extractable volumes in one pass Replace the per-state .filter(...).length scans in assembleUbiImage and summarizeUbiImage with single loops, per docs/development/tool-design.md. * Address review feedback * fix(firmware): close UBI geometry ambiguity and corrupt-PEB tail gaps * fix(firmware): verify erased UBI PEB bodies and validate layout VID headers * fix(firmware): defer and cache UBI erased-body scans and deduplicate stream check helper * fix(firmware): eliminate quadratic UBI erased-range scans and cache dynamic copy CRCs * test(firmware): assert UBI erased-range coalescing, walk steps, and elapsed time * perf(ubi): cache EC header scan across block-size retries * fix(ubi): bound EC header scan cache and stream past cap --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
f78470e361 |
feat(firmware): inspect Qualcomm MBN image headers and hash segments offline (#14649)
* feat(firmware): inspect Qualcomm MBN image headers and hash segments offline Artifact recognition now accepts a legacy Qualcomm MBN header only for versions 3, 5, and 6, and only after every signature-based format, when the image size matches the region sizes, the signature and certificate-chain pointers follow the code, and the code region lies inside the file. Inventory and extraction list the header, code, signature, certificate-chain, and version 5/6 metadata ranges; a range past the end of the file is reported as a limitation with unknown coverage and is left unlisted. An ELF image whose program-header flags mark a Qualcomm hash segment (bits 24-26 equal 2) is inventoried as qualcomm-mbn, with the hash-segment header, hash size, hash count, and the first 64 segment-hash rows, while binary target resolution keeps the ELF classification and extraction still returns those regions for an ELF input. Signatures and certificates are reported by location and size, and hash bytes are left as stored. * Address review feedback * fix(firmware): require MBN image size to equal the region sum * fix(firmware): decode Qualcomm MBN layouts and bound hash segments * fix(firmware): restore 40-byte MBN v3 header and deduplicate QTI warnings * fix(firmware): keep mismatched MBN hash size and count unknown * fix(firmware): stop mapping Qualcomm MBN v3 image_src to boot-device names --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
3e8f6a43a9 |
feat(artifacts): decode Android Verified Boot vbmeta images offline (#13239)
* feat(artifacts): decode Android Verified Boot vbmeta images offline
* fix(artifacts): locate vbmeta tail-length failures at their length fields
* fix(artifacts): make vbmeta admission budgets adjustable per call
* fix(firmware): refuse vbmeta fields too long to hex-encode
With raised descriptor_bytes and auxiliary_block_bytes limits, a valid
KERNEL_CMDLINE longer than half the host string bound passed the byte
limits, and toString("hex") then threw ERR_STRING_TOO_LONG, which
surfaced as an I/O error. Check the field against the host bound before
hex encoding and report a typed capacity failure with its own limit.
* fix(firmware): check vbmeta extents before admission budgets
A header whose declared blocks do not fit the file, or whose descriptor
range does not fit its auxiliary block, now reports truncation or a
malformed range instead of a limit a larger budget cannot repair. The
over-budget fixtures are now fully present so they still prove the limit.
* perf(firmware): count vbmeta descriptor tags in one pass and reuse readers
The summary counts every descriptor tag in a single loop instead of six
filtered arrays, and androidVbmeta reuses one BinaryReader per buffer.
The malformed-header refusal fixtures follow main's unsupported_target
classification for malformed target bytes.
* chore: regenerate advertised schema hash after merging main
* docs(android-vbmeta): name unsupported_target for structural refusals
Malformed vbmeta headers classify as unsupported_target, not
invalid_request, matching analysisErrorClassification and the refusal
fixtures.
* chore: regenerate advertised schema hashes after merging main
* chore: regenerate advertised schema hashes after merging main
* fix: restore Android vbmeta artifact reader after merging main
* test(artifacts): expect partial for the CLI vbmeta descriptor refusal
* feat(artifacts): preserve vbmeta descriptor bytes and partial refusals
Co-authored-by: iamcipherdev <268238676+iamcipherdev@users.noreply.github.com>
* fix(artifacts): use Buffer.equals in vbmeta tests and update advertised schema summaries
---------
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Co-authored-by: iamcipherdev <268238676+iamcipherdev@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
|
||
|
|
3970afecc6 |
feat(artifacts): inventory Nintendo Switch NSO and NRO executables offline (#14655)
* feat(artifacts): inventory Nintendo Switch NSO and NRO executables offline Detection uses the bytes: NSO0 at the start of the file, or NRO0 at offset 0x10. Inventory records the module id, flags, and MOD0 offset, lists the text, rodata, and data segments, and for an NRO adds the ASET icon, NACP, and RomFS when that trailer is present. Compressed NSO segments are raw LZ4 blocks decoded under artifact_limits.expanded_bytes, with the stored size and the decoded size both reserved before allocation, and hash_status is match, mismatch, not-checked, or unavailable. Truncated, over-budget, and invalid-LZ4 entries stay listed while their bytes are refused, and a positional reader can stream those decoded bytes instead of the stored file range. * fix(artifacts): keep valid NRO assets when one ASET range is unsafe * docs: move the Switch executables guide under guides/firmware * Address review feedback * Address review feedback * fix(artifacts): unify Switch NSO budget admission and test deadlines - Remove the duplicate NSO decoded-only budget pre-check in #prepareNso so #admitStoredInput owns all compressed-segment admission and reports an accurate required_value covering both stored and decoded bytes. - Use testWaitDeadline() in SwitchExecutableArtifactReader.boundaries.test.ts instead of a hardcoded 2_000 ms timeout. - Reuse tests/fixtures/lz4LiteralBlock.ts in switchExecutable.fixture.ts. * test(domain): throw typed parse errors in Switch parser tests and fix doc formatting --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
51b3671b08 |
feat(artifacts): inventory Nintendo DS ROM binaries, overlays and file tables offline (#14664)
* feat(artifacts): inventory Nintendo DS ROM binaries, overlays and file tables offline Recognition now claims a Nintendo DS ROM from the cartridge header: stored logo CRC 0xCF56, unit code 0, 2, or 3, an ARM9 offset after the header, and a matching logo-area or header CRC. Inspection records those header facts on the root and lists arm9.bin, arm7.bin, overlays/<cpu>/overlay_<id>.bin, FNT-named data/<path> files, and unnamed fat/<id>.bin files as stored byte ranges. A checksum mismatch, a partial table, or a range past the end of the file leaves coverage unknown. Secure-area encryption, compressed overlays, and NitroARC archives stay undecoded, and the format is registered for inventory, extraction, and the docs. * docs: move the Nintendo DS ROM guide under guides/firmware * Address review feedback * Address review feedback * Address review feedback * fix: Compare NDS entry addresses and overlay facts * fix(artifacts): bound NDS path expansion and enforce expanded_bytes * fix(artifacts): omit NDS format declaration for ordinary filesystem files --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
04cb70c1a3 |
feat(firmware): inspect uClinux bFLT flat executables offline (#14663)
* feat(firmware): inspect uClinux bFLT flat executables offline The reader matches the bFLT magic on any filename, records the 64-byte big-endian header, and extracts text.bin (header included), data.bin, and relocations.bin while listing relocations as stored words. gzip and gzdata bodies inflate under artifact_limits.expanded_bytes; revision 2 is always stored, and its relocation words stay unchecked because their layout depends on a CPU the header never names. A missing magic or a header shorter than 64 bytes is the only refusal, other inconsistencies are limitations beside the remaining facts, files above 128 MiB are rejected, and the follow-up probe opens the text image as a raw binary with a caller-chosen architecture and entry. * Address review feedback * Address review feedback * fix(firmware): cap bFLT in-memory gzip inflation working memory --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
192177f0c9 |
feat(artifacts): inventory and expand Android sparse images offline (#13244)
* feat(artifacts): inventory and expand Android sparse images offline * chore(schemas): update artifact tool schema summaries for the sparse image limit * fix(artifacts): retire undrained sparse image streams on cancellation * fix(artifacts): keep large RAW reads in the sparse stream's owner A large RAW run was streamed through a nested readFileHandleChunks Readable, which could prefetch a descriptor read while the outer iterator was idle, so close or cancellation could retire the stream with that read still running. Read the run directly in the expansion iterator so every read is pending in the owner that cancellation waits on, and add held-read close and cancellation regressions. * fix(firmware): drop unused ANDROID_SPARSE_MAGIC_BYTES export * test(artifacts): release held sparse reads before restoring mocks Release the held RAW read and join the retiring close or cancellation in finally before restoring the read spy, so a failed assertion cannot leave reader.close() waiting on a read nobody will finish. Use awaitAcknowledgement for the held-read start barrier and drop the per-test five-second timeouts in favor of the shared test deadlines. * fix(lint): register sparse-image forwarded fixed ceiling Upstream main added the fixed-ceiling registry check. The sparse-image reader projects the parser's own named ceiling, so register it as forwarding like the boot-image reader. * Address review feedback * test(android-sparse): expect partial code for chunk budget refusal * test(android-sparse): expect partial code in MCP chunk budget refusal * fix(artifacts): keep the chunk_sz offset when a RAW chunk outgrows its header --------- Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Co-authored-by: Matt Van Horn <mvanhorn@MacBook-Pro-10.local> |
||
|
|
50d13f9f08 |
fix(native)!: report details.limit for native reader per-call budgets (#14622)
* fix(native)!: report details.limit for native reader per-call budgets Devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals of caller-selected budgets named their control only in remediation prose. Each now sets details.limit from a domain-owned budget object that also builds the schema (src/domain/parameterBudget.ts), so the reported range is the one the next call accepts. inspect_devicetree's fixed 32 MiB decoded representation allowance becomes the per-call max_decoded_bytes (default 32 MiB, 1 KiB to 256 MiB); its refusal reports boundary max_decoded_bytes instead of decoded_bytes. The pwntools allocation failure declares measuredExhaustion, the firmware inherited RLIMIT_FSIZE refusal declares measuredExhaustion, and the LLDB combined-result ceiling is a registered representation bound. Part of #14234 and #14235. BREAKING CHANGE: inspect_devicetree's decoded-representation refusal reports reported_limits.boundary "max_decoded_bytes" with details.limit, instead of "decoded_bytes". * fix(native): keep FIT decoded-budget boundary, LLDB narrowing and entropy length range exact The FIT reader compared the renamed devicetree limit against decoded_bytes, so a decoded-budget refusal became capacity; it now checks max_decoded_bytes, with a test. The LLDB representation ceiling keeps a short name and carries its recovery as narrowing. The byte-entropy length maximum is the window the selected block_size admits. * fix(cli): describe inspect-devicetree --max-decoded-bytes * refactor(native): let the generated adjustable-budget recovery name the native reader controls With #14625 the refusal owns per-call recovery, so the devicetree, Windows shortcut, kernel build config, firmware staging and byte-entropy refusals drop their authored sentences. inspect_byte_entropy reports the smallest admitting block_size as required_value. |
||
|
|
e896f60540 |
feat(artifacts)!: inventory and extract ISO 9660 disc images offline (#13290)
feat(artifacts)!: inventory and extract ISO 9660 disc images offline Add an offline iso9660 artifact format. inspect-artifact and extract-artifact (and the MCP tools) read the volume descriptors and one directory tree, list each file and directory as an occurrence, and extract stored file bytes without mounting the image or calling a host tool. Traversal limits are exposed via artifact_limits.iso9660. BREAKING CHANGE: artifactReaderLimitsSchema now requires iso9660 (descriptor_count, directory_depth, record_count, directory_bytes, path_bytes), so saved Evidence records containing effective_limits from prior versions without iso9660 fail parseInventoryPage validation and must be re-inspected. |
||
|
|
4b5fcc9eab |
docs(guides): correct host requirements and prune change notes in runtime, web, data guides (#14197)
docs(guides): correct host and runtime claims and prune change notes Correct sigrok, firmware and SQLite host/runtime requirements and a v8 CLI flag, remove consumer-migration and historical asides, and drop duplicated sentences in the JavaScript, web, runtime, data, firmware and signals guides. |
||
|
|
4db10585f0 |
docs(firmware): describe UEFI extraction summaries and owners
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
89fc51ba97 |
docs(firmware): describe UEFI summaries and views
Co-Authored-By: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com> |
||
|
|
5664a6fbd4 | docs: clarify parser coverage and verification ownership | ||
|
|
57d1d7ca5e |
fix(uefi): preserve parser coverage and source evidence (#12539)
* fix(uefi): report malformed volume extension metadata * fix(uefi): preserve parser coverage and source evidence * fix(uefi): bound inventory and tighten parser framing * refactor(uefi): reuse shared byte formatting in diagnostics * fix(uefi): accept extended sections at the compact size marker |
||
|
|
9d0502bc51 |
fix(uefi): share inspection and extraction scan limits (#12538)
* fix(uefi): share inspection and extraction scan limits * test(uefi): prove extraction honors the FFS file limit |
||
|
|
745869e707 | fix(uefi): account for FFS alignment bytes (#12532) | ||
|
|
d380dc2409 |
feat(uefi): add pure-TypeScript UEFI firmware analysis tools (#12342)
* feat(uefi): add pure-TS UEFI firmware volume/FFS parser with inspect/extract tools
Add a dependency-free rea-uefi provider that maps AMI/Aptio flash images:
- inspect_uefi_firmware: aligned _FVH discovery, volume-relative FFS walking,
guided section/compression classification, conservative PSP-directory probing,
embedded-volume rescan and leftover-region classification; incremental SHA-256
and explicit integrity notes.
- extract_uefi_firmware: whole-image/volume/FFS-file/section extraction with
LZMA-custom/LZMAF86 and AMD-zlib decoding, SafeOutputTree staging, derivations
and extraction_gaps.
- UefiArtifactReader + 'uefi' format wiring across inventory/domain/contracts
so parsed volumes and extracted PE32/TE files hand off to deep-provider
analysis (open_binary -> Ghidra).
* feat(uefi): add inspect_uefi_nvram for AMI NVRAM variable stores
Add a pure-TypeScript tool that maps the vendor AMI NVRAM variable stores
(factory-default "StdDefaults" and peers) inside a flash image:
- scan the raw image for NVAR entry chains ("NVAR" + u16 total size +
u32 attribute 0x8[23]FFFFFF + state + NUL-terminated name + data),
- recurse into a container entry whose data is itself an NVAR chain, so the
StdDefaults setup variables surface as depth/parent_offset rows,
- report attributes, state, data range, SHA-256 and trailing padding per entry.
Verified against B550 AORUS Elite V2 FId: one StdDefaults store at 0x37090 with
the 11 expected nested variables (Setup, PlatformLang, AMITSESetup, XhciDID,
GcSensorVarName, PCI_COMMON, SioSetupData, UsbSupport, NetworkStackVar,
SecureBootSetup, Setup). Exposed as MCP tool and inspect-uefi-nvram CLI command.
* fix(uefi): address review on checksums, compression, guided sections, NVRAM bounds
- FFS file checksum: verify the two's-complement invariant (payload sum +
stored byte == 0 mod 256) instead of comparing sums, and encode the correct
complement in the fixture builder.
- Compression sections (type 0x01): use the 9-byte header and classify EFI
standard compression instead of 'none', so extraction reports a gap rather
than publishing compressed bytes as a raw section.
- GUID-defined sections: derive GUID/data-offset/attributes from the parsed
common header size (compact or extended) and reject out-of-range payload
offsets.
- AMI NVRAM: bound recursive chains to the enclosing container's data end and
report partial coverage when a valid nested chain is cut by max_depth.
* fix(uefi): bound decode memory, serialize operations, enforce deadline, mark truncation
- LZMA worker: enforce max_output_bytes while decoding through a bounded output
sink, so an oversized stream is rejected during expansion instead of after a
full decompression plus a second Buffer copy.
- Provider: serialize admitted operations (the promised single decode-worker
lane must not become one worker per overlapping call) and apply one
whole-request deadline that covers every decode stage, not a fresh per-stream
timer. close() drains the queue and the resource scope.
- Scan: track truncated sections of known type and report coverage partial
instead of complete when a section declares more bytes than are present.
* fix(uefi): cancellable queue, timeout surfacing, availability and reader omissions
- Queue: check the caller signal before enqueue and when a job reaches the head,
and race the queued promise against abort so a cancelled wait returns
immediately instead of blocking behind the active request.
- Deadline: track the internal deadline and return AnalysisTimeoutError instead
of the AnalysisCancelledError that runOwnedCommand reports for any external
abort, preserving the real failure reason for CLI/MCP callers.
- CapabilityInventory: treat inspect_uefi_nvram like the other bundled rea-uefi
tools so discovery does not demand Unblob for it.
- UefiArtifactReader: report image truncation through onOmission so inventory
coverage reflects the unread suffix even when no volume was found.
* fix(uefi): limit early cancellation to unstarted jobs and preserve timeout cleanup
- #raceWithAbort only returns early for jobs that have not started; once a
request is running, await it so worker cleanup and completed output are
preserved instead of being discarded by a bare cancellation.
- Reclassify a deadline-induced cancellation as AnalysisTimeoutError while
keeping its cause and cleanup observations, and never override a different
primary failure.
* docs(licenses): record UEFI decoder dependency notices
* fix(uefi): preserve stream provenance and bound firmware analysis
* feat(uefi): decode LZMAF86 guided sections
* fix(uefi): validate publication before commit and order decoder cleanup
* fix(uefi): preserve unsupported volumes and extraction gaps
---------
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
|
||
|
|
7cc7bda6e3 |
fix(android): validate OTA manifest and signature extents before capacity (#12431)
fix(android-ota): admit complete manifest and signature extents before limits |
||
|
|
e91ddc89f9 |
fix(android-ota): require both payload signature fields (#12273)
* fix(android-ota): require both payload signature fields * refactor(android-ota): share validated payload signature range --------- Co-authored-by: ShuaixinHuang <197200901+ShuaixinHuang@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com> |
||
|
|
5c59bdc8a6 |
feat(ghidra)!: verify the bridge on Ghidra 12.2 (#12081)
* feat(ghidra)!: verify the bridge on Ghidra 12.2 Admit 12.x from minor 2 upward, with 12.2 and JDK 25 as the verified pair. The bridge now calls the four-argument storage API added in 12.2, so 12.1.x cannot compile it and is no longer accepted. BREAKING CHANGE: Ghidra 12.1.x is rejected. Use Ghidra 12.2 or another 12.x build at or above minor 2, and a JDK inside that installation's declared range (25 or newer for the verified 12.2 build). * docs(ghidra): point remaining lanes at Ghidra 12.2 The Windows, 6502, and m68k prerequisites still named 12.1.4 and JDK 21, which the verified-build check now rejects. The bridge compile lane names the 12.2 jars it actually compiles against. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(ghidra): admit the JDK the verified install declares The Java home framing probe still reported JDK 21 while the verified installation fixture now declares a minimum of 25, so doctor admission failed before the path framing was checked. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(ghidra): derive admitted install fixtures from the verified release Boundary hosts and assertions still named Ghidra 12.1.4 after admission moved to 12.2, so list_procedures evidence and completed property reads disagreed with the install the provider actually reported. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(ghidra): record the exact 12.2 Clang switch-recovery defect Ghidra 12.2 stays the verified build. Sessions and decompiler results on that exact version name upstream issue 9996 and the 12.2.1 fix commit. Other version strings, including 12.2.1, do not carry the limitation. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(ghidra): check switch-defect facts instead of the warning sentence The policy test keeps the structured defect record and checks that the owning formatter delivers its id, commit, release, and scope fields. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(browser): name the Playwright launch boundary the lifecycle catalog checks Main retitled that case with a platform placeholder. The coverage catalog still required the old literal, so the merged full suite reported a missing title. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(browser): point the lifecycle catalog at main's launch title The merged suite uses main's platform-specific Playwright launch test. The coverage catalog now names that title, and this branch keeps main's test body so the merge stays clean. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(browser): cover the platform launch title on this branch The lifecycle catalog names main's platform launch title. This branch now has that quoted test too, so the check passes before and after the merge. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(ghidra): record the exact 12.2 masked byte-switch defect Ghidra 12.2 leaves an AArch64 and-0xff byte-offset switch unrecovered. Exact 12.2 sessions now cite open upstream issue 10154, and the AArch64 lane expects that jump table to stay unrecovered. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(browser): keep one platform launch environment check The second launch test repeated the selected environment check. The remaining test is the parameterized title, and the launcher forwards SYSTEMROOT on win32 so that assertion holds. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(ghidra): keep the open switch defect on admitted builds The exact-version check cleared ghidra-10154 on every build except 12.2. That defect stays on admitted releases until one is known to fix it. ghidra-9996 still clears after the exact 12.2 build. Co-authored-by: morluto <morluto@users.noreply.github.com> * style(docs): format the Ghidra testing-lane table The AArch64 jump-table row wrapped past the formatter width and failed static checks. Co-authored-by: morluto <morluto@users.noreply.github.com> * test(ghidra): give the masked switch its full byte range The unrecovered oracle now uses 256 readable table bytes, and the same object must still recover its compare-bounded switch. Co-authored-by: morluto <morluto@users.noreply.github.com> * docs(website): point Ghidra setup at 12.2 and JDK 25 The public setup pages still told new users to install Ghidra 12.1.4 and JDK 21, which this release rejects. Changed setup sentences are extracted and left untranslated so those editions use the English page. Co-authored-by: morluto <morluto@users.noreply.github.com> * docs(website): keep catalog edits to the changed setup strings The catalog check compares active message ids, not a full rewrite. Restore the previous catalogs and update only the Ghidra 12.2 setup strings, leaving their translations empty. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(ghidra): apply the closed switch defect from the parsed patch 12.2, 12.2.0, and 12.2.0 with a suffix all precede 12.2.1, so they keep ghidra-9996. The masked-switch table lists all 256 byte entries. Co-authored-by: morluto <morluto@users.noreply.github.com> * fix(ghidra): share the AArch64 switch fixture compiler invocation --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: morluto <morluto@users.noreply.github.com> |
||
|
|
75482a9ef9 | fix(ota): merge partition info without discarding integrity claims (#11836) |