[−][src]Trait checksec::elf::ElfProperties
checksec Trait implementation for goblin::elf::Elf
Example
use checksec::elf::ElfProperties; use goblin::elf::Elf; use std::fs; pub fn print_results(binary: &String) { if let Ok(fp) = fs::File::open(&binary) { if let Ok(buf) = fs::read(fp) { if let Ok(elf) = Elf::parse(&buf) { println!("Canary: {}", elf.has_canary()); } } } }
Required methods
fn has_canary(&self) -> bool
check for __stack_chk_fail
or __intel_security_cookie
in dynstrtab
fn has_clang_cfi(&self) -> bool
check for symbols containing .cfi
in dynstrtab
fn has_clang_safestack(&self) -> bool
check for __safestack_init
in dynstrtab
fn has_fortify(&self) -> bool
check for symbols ending in _chk
from dynstrtab
fn has_fortified(&self) -> u32
counts symbols ending in _chk
from dynstrtab
fn has_nx(&self) -> bool
check p_flags
of the PT_GNU_STACK
ELF header
fn has_pie(&self) -> PIE
check d_val
of DT_FLAGS
/DT_FLAGS_1
of the PT_DYN ELF
header
fn has_relro(&self) -> Relro
check d_val
is DF_BIND_NOW
for DT_FLAGS
/DT_FLAGS_1
of the
PT_GNU_RELRO ELF
program header
fn has_rpath(&self) -> VecRpath
check the.dynamic
section for DT_RUNPATH
and return results in a
VecRpath
fn has_runpath(&self) -> VecRpath
check the .dynamic
section for DT_RPATH
and return results in a
VecRpath
fn get_dynstr_by_tag(&self, tag: u64) -> Option<String>
return the corresponding string from dynstrtab for a given d_tag