[Bug] Reject non-executable sections in unified analysis commands

Aperta
#9 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
cpp

Direzione di ricerca

Start with the section lookup in src/main.cpp (around lines 123-133) and the ELF validation at lines 430-435, then compare with the SHF_EXECINSTR check in src/disasm/disasm.cpp (lines 184-187). Reproduce with caraxes disasm ./sample --section .rodata. Done means that command and the other code-analysis commands exit nonzero with a clear error for non-executable sections, executable custom sections still work, and a CLI regression test covers a valid ELF with .rodata and .text.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug good first issue

Summary

The unified caraxes CLI accepts an explicitly requested non-executable section for disassembly and analysis, unlike the standalone disassembler. It then interprets data bytes as x86 instructions.

Evidence

src/main.cpp:123-133 returns the requested section without checking SHF_EXECINSTR, and src/main.cpp:430-435 only validates ELF class and machine before calling the disassembler/analysis pipeline. By contrast, src/disasm/disasm.cpp:184-187 explicitly rejects a non-executable section.

Reproducer:

caraxes disasm ./sample --section .rodata

On an ordinary ELF binary this succeeds and starts decoding string/data bytes, for example:

0x2000  01 00  add dword ptr [rax], eax

Impact

functions, cfg, callgraph, xrefs, report, and decompile can all analyze non-code bytes when --section is supplied. Results look valid but contain fabricated instructions, functions, and references.

Expected behavior

All code-analysis commands should reject sections without SHF_EXECINSTR with a clear error, matching disassemble_section. If raw byte decoding of data is intentional, it should be exposed as a separate explicitly named operation rather than sharing the code-analysis path.

Acceptance criteria

  • caraxes disasm sample --section .rodata exits nonzero with an explanatory error.
  • The same validation applies to functions, CFG, callgraph, xrefs, report, and decompile.
  • Executable custom sections continue to work.
  • Add a CLI regression test for a valid ELF containing .rodata and .text.
Lingua principale
C++
Stelle
0
Fork
0
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di TiElixir/caraxes

Tutte le issue di TiElixir/caraxes

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.