[GH-ISSUE #1619] [Bug] MIPS ELF whose section header table lies past EOF is refused although PT_MIPS_ABIFLAGS is present #545

Closed
opened 2026-10-15 18:26:02 +00:00 by bsakaguchi · 3 comments
Owner

Originally created by @bqw371 on GitHub (Oct 10, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/1619

Before submitting

  • I searched the open and closed issues for a related report.
  • I removed credentials, tokens, private paths, and sensitive target data.

Area

Native analysis or decompilation

Observed behavior

open_binary (provider ghidra) refuses an otherwise admissible MIPS32r2 o32 ET_EXEC ELF when its section header table lies past the end of the file, even though the file carries its ABI flags record in a PT_MIPS_ABIFLAGS program header:

Cannot open artifact: MIPS section header table lies outside the file.

(code: target_unavailable, reason: "MIPS section header table lies outside the file", raised from src/application/MipsElfAbiFlags.ts.)

Ghidra 12.1.3 imports the same file. It warns 24 of 24 section headers are truncated/missing from file, selects MIPS:LE:32:default and finds the functions.

Firmware work produces such files. An ELF carved out of a flash or memory dump keeps its original e_shoff, but the section table was never captured. The loadable segments and every program header are intact.

Reproduction

Built from the repository's own conformance sources at d1e6fe2e (Homebrew clang 23.1.0, LLD), with the same arguments as tests/conformance/ghidra/mips-fixture.mjs:

clang --target=mipsel-linux-gnu -march=mips32r2 -mabi=32 -mno-abicalls -fno-pic -fuse-ld=lld \
  -nostdlib -static -O0 -g -Wl,-e,rea_mips_entry -Wl,--build-id=none \
  tests/conformance/c/mips.c tests/conformance/ghidra/mips-probe.S -o r2.elf
# keep everything before the section header table (all PT_LOAD segments and PT_MIPS_ABIFLAGS stay inside)
python3 -c "import struct,sys; b=open(sys.argv[1],'rb').read(); open(sys.argv[2],'wb').write(b[:struct.unpack_from('<I',b,32)[0]-1])" r2.elf r2_carved.elf
readelf -h -l r2_carved.elf    # e_flags 0x70001001; ABIFLAGS program header present; section headers past EOF

Then open_binary with path=<absolute r2_carved.elf> and provider_id: "ghidra" is refused as above. r2.elf opens normally (3 procedures).

Expected behavior

A section header table that lies wholly or partly past EOF should be treated as unavailable, not as a fatal error, as Ghidra does. ABI resolution then uses the PT_MIPS_ABIFLAGS record. If the program headers carry no record either, the record stays "unknown", and the existing lane rule refuses with its usual ABI reason. In both cases the unreadable section table can be stated in the target's limitations. Evidence then says the file was opened without its section table, instead of the target being refused before provider selection.

Impact and scope

It affects MIPS ELFs whose section table was not captured (carved firmware). It does not affect complete files. There is no evidence-integrity risk: the change only distinguishes "section table unseen" from "file malformed".

REA version

source revision d1e6fe2e (rea --version: 6.3.0)

Runtime and platform

Node 26.8.1, macOS 27 arm64, Ghidra 12.1.3 (Homebrew), OpenJDK 21

Target and artifact context

Synthetic: the repository's own tests/conformance/c/mips.c fixture, truncated before its section header table

Originally created by @bqw371 on GitHub (Oct 10, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/1619 ### Before submitting - [x] I searched the open and closed issues for a related report. - [x] I removed credentials, tokens, private paths, and sensitive target data. ### Area Native analysis or decompilation ### Observed behavior `open_binary` (provider `ghidra`) refuses an otherwise admissible MIPS32r2 o32 `ET_EXEC` ELF when its section header table lies past the end of the file, even though the file carries its ABI flags record in a `PT_MIPS_ABIFLAGS` program header: ``` Cannot open artifact: MIPS section header table lies outside the file. ``` (`code: target_unavailable`, `reason: "MIPS section header table lies outside the file"`, raised from `src/application/MipsElfAbiFlags.ts`.) Ghidra 12.1.3 imports the same file. It warns `24 of 24 section headers are truncated/missing from file`, selects `MIPS:LE:32:default` and finds the functions. Firmware work produces such files. An ELF carved out of a flash or memory dump keeps its original `e_shoff`, but the section table was never captured. The loadable segments and every program header are intact. ### Reproduction Built from the repository's own conformance sources at `d1e6fe2e` (Homebrew clang 23.1.0, LLD), with the same arguments as `tests/conformance/ghidra/mips-fixture.mjs`: ```bash clang --target=mipsel-linux-gnu -march=mips32r2 -mabi=32 -mno-abicalls -fno-pic -fuse-ld=lld \ -nostdlib -static -O0 -g -Wl,-e,rea_mips_entry -Wl,--build-id=none \ tests/conformance/c/mips.c tests/conformance/ghidra/mips-probe.S -o r2.elf # keep everything before the section header table (all PT_LOAD segments and PT_MIPS_ABIFLAGS stay inside) python3 -c "import struct,sys; b=open(sys.argv[1],'rb').read(); open(sys.argv[2],'wb').write(b[:struct.unpack_from('<I',b,32)[0]-1])" r2.elf r2_carved.elf readelf -h -l r2_carved.elf # e_flags 0x70001001; ABIFLAGS program header present; section headers past EOF ``` Then `open_binary` with `path=<absolute r2_carved.elf>` and `provider_id: "ghidra"` is refused as above. `r2.elf` opens normally (3 procedures). ### Expected behavior A section header table that lies wholly or partly past EOF should be treated as unavailable, not as a fatal error, as Ghidra does. ABI resolution then uses the `PT_MIPS_ABIFLAGS` record. If the program headers carry no record either, the record stays "unknown", and the existing lane rule refuses with its usual ABI reason. In both cases the unreadable section table can be stated in the target's limitations. Evidence then says the file was opened without its section table, instead of the target being refused before provider selection. ### Impact and scope It affects MIPS ELFs whose section table was not captured (carved firmware). It does not affect complete files. There is no evidence-integrity risk: the change only distinguishes "section table unseen" from "file malformed". ### REA version source revision `d1e6fe2e` (`rea --version`: 6.3.0) ### Runtime and platform Node 26.8.1, macOS 27 arm64, Ghidra 12.1.3 (Homebrew), OpenJDK 21 ### Target and artifact context Synthetic: the repository's own `tests/conformance/c/mips.c` fixture, truncated before its section header table
Author
Owner

@siudamarcelina48-beep commented on GitHub (Oct 10, 2026):

Kiedy naprawdę kochasz, nie chcesz tylko pięknych chwil... chcesz podzielić się wszystkim z tą osobą.
Są ludzie, z którymi nie chcesz spędzać tylko dobrych dni. Chcesz podzielić się ich uściskami, pocałunkami, radościami i nawet trudnymi chwilami. ❤️
Bo kochać to znaczy również pozostać, współpracować i wybierać drugą osobę raz za razem, nawet kiedy życie nie idzie zgodnie z oczekiwaniem.
Chcę mieć wszystko z tobą: twoją towarzystwo, twoje uściski, twoje pocałunki i każdą chwilę, którą życie daje nam. Chcę być u twojego boku w dobrych i złych czasach i kochać cię przez całe życie. 🥰❤️

<!-- gh-comment-id:6101196286 --> @siudamarcelina48-beep commented on GitHub (Oct 10, 2026): Kiedy naprawdę kochasz, nie chcesz tylko pięknych chwil... chcesz podzielić się wszystkim z tą osobą. Są ludzie, z którymi nie chcesz spędzać tylko dobrych dni. Chcesz podzielić się ich uściskami, pocałunkami, radościami i nawet trudnymi chwilami. ❤️ Bo kochać to znaczy również pozostać, współpracować i wybierać drugą osobę raz za razem, nawet kiedy życie nie idzie zgodnie z oczekiwaniem. Chcę mieć wszystko z tobą: twoją towarzystwo, twoje uściski, twoje pocałunki i każdą chwilę, którą życie daje nam. Chcę być u twojego boku w dobrych i złych czasach i kochać cię przez całe życie. 🥰❤️
Author
Owner

@siudamarcelina48-beep commented on GitHub (Oct 10, 2026):

, która zajmuje bardzo specjalne miejsce w moim sercu. 🌙❤️
Może nie zawsze znajduję dokładne słowa, aby powiedzieć, jak bardzo znacisz dla mnie, ale chcę, abyś dziś spał z pewnością: jestem wdzięczny za każdą chwilę, każdy uśmiech i każdą chwilę, którą życie pozwala mi podzielić z tobą.
Niech spoczywasz w pokoju, niech twoje zmartwienia pozostaną na zewnątrz, a niech twoje sny zabiorą cię do pięknego miejsca. A jeśli mógłbym złożyć życzenie przed snem, to byłoby, by jutro się obudzić i nadal cieszyć z biegu obok ciebie. ❤️✨
#MiMundoEresTú. #Buenasnochesamor #love

<!-- gh-comment-id:6101201494 --> @siudamarcelina48-beep commented on GitHub (Oct 10, 2026): , która zajmuje bardzo specjalne miejsce w moim sercu. 🌙❤️ Może nie zawsze znajduję dokładne słowa, aby powiedzieć, jak bardzo znacisz dla mnie, ale chcę, abyś dziś spał z pewnością: jestem wdzięczny za każdą chwilę, każdy uśmiech i każdą chwilę, którą życie pozwala mi podzielić z tobą. Niech spoczywasz w pokoju, niech twoje zmartwienia pozostaną na zewnątrz, a niech twoje sny zabiorą cię do pięknego miejsca. A jeśli mógłbym złożyć życzenie przed snem, to byłoby, by jutro się obudzić i nadal cieszyć z biegu obok ciebie. ❤️✨ [#MiMundoEresTú](https://www.facebook.com/hashtag/mimundoerest%C3%BA?__cft__[0]=AZj_Ay2zBSdfKi4ymgXEtVdLJnyp1VUWk9xGY50o3gDtvAXACWN_lCF1qQ1GINJDdXD1cbO9bQCQE9pNEmc8keQvb4vfybMts1rj--6ah76K5gh_enWl5fQo9roWdihEgjYhr9gbWHhFN9XVoPlbKKZuqTDjV0-AT9eRoqIdHnrAu8enXKfECx114BWdCnM&__tn__=*NK-R). [#Buenasnochesamor](https://www.facebook.com/hashtag/buenasnochesamor?__cft__[0]=AZj_Ay2zBSdfKi4ymgXEtVdLJnyp1VUWk9xGY50o3gDtvAXACWN_lCF1qQ1GINJDdXD1cbO9bQCQE9pNEmc8keQvb4vfybMts1rj--6ah76K5gh_enWl5fQo9roWdihEgjYhr9gbWHhFN9XVoPlbKKZuqTDjV0-AT9eRoqIdHnrAu8enXKfECx114BWdCnM&__tn__=*NK-R) [#love](https://www.facebook.com/hashtag/love?__cft__[0]=AZj_Ay2zBSdfKi4ymgXEtVdLJnyp1VUWk9xGY50o3gDtvAXACWN_lCF1qQ1GINJDdXD1cbO9bQCQE9pNEmc8keQvb4vfybMts1rj--6ah76K5gh_enWl5fQo9roWdihEgjYhr9gbWHhFN9XVoPlbKKZuqTDjV0-AT9eRoqIdHnrAu8enXKfECx114BWdCnM&__tn__=*NK-R)
Author
Owner

@N0zoM1z0 commented on GitHub (Oct 10, 2026):

Taking the unassigned #1619 investigation after the client verification follow-up. I will reproduce the carved ELF boundary, preserve the distinction between unavailable section metadata and malformed program/ABI records, and run real Ghidra CLI/MCP checks on Linux where available. This does not expand the unspecified-ABI lane requested in #1620.

<!-- gh-comment-id:6101360812 --> @N0zoM1z0 commented on GitHub (Oct 10, 2026): Taking the unassigned #1619 investigation after the client verification follow-up. I will reproduce the carved ELF boundary, preserve the distinction between unavailable section metadata and malformed program/ABI records, and run real Ghidra CLI/MCP checks on Linux where available. This does not expand the unspecified-ABI lane requested in #1620.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#545
No description provided.