AFLplusplus / AFLplusplus/LibAFL

elf.entry_point() for no-aslr binary

Abierto
#3,745 0 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
2.6k
Forks
481
Merge medio
2 d 30 min
PR fusionados (30 d)
16

Descripción

## Problem
I'm new to LibAFL and I'm trying to work on a no-aslr binary, it's elf header type is EXEC, not DYN. And here is part of my code
```rust
fn get_elf_entry_point(qemu: Qemu) -> Result {
let mut elf_buffer = Vec::new();
let elf = EasyElf::from_file(qemu.binary_path(), &mut elf_buffer)?;
let load_addr = qemu.load_addr();
eprintln!("[Harness] ELF Load addr: {load_addr:#x}");
let start_pc = elf
.entry_point(qemu.load_addr())
.expect("Target elf's entry_point should not be None!") as u64;

// 使用 println! 确保能看到输出
eprintln!("[Harness] ELF Entry point calculated: {start_pc:#x}");
Ok(start_pc)
```
The problem is qemu.load_addr() will return 0x400000 and elf.entry_point(qemu.load_addr()) will return 0x802500(expected to be 0x402500).

The definition of elf.entry_point() is
```rust
#[must_use]
pub fn entry_point(&self, load_addr: GuestAddr) -> Option {
if self.elf.entry == 0 {
None
} else {
Some(load_addr + self.elf.entry as GuestAddr)
}
}
```
I wonder if this func need to add `if self.if_pic()` check liker other functions (eg. elf.resolve_symbol, elf.get_section) or just I misuse this function.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.