pub trait Properties {
// Required methods
fn has_canary(&self) -> bool;
fn has_clang_cfi(&self) -> bool;
fn has_clang_safestack(&self) -> bool;
fn has_fortify(&self) -> bool;
fn has_fortified(&self) -> u32;
fn has_nx(&self) -> bool;
fn has_pie(&self) -> PIE;
fn has_relro(&self) -> Relro;
fn has_rpath(&self) -> VecRpath;
fn has_runpath(&self) -> VecRpath;
fn get_dynstr_by_tag(&self, tag: u64) -> Option<String>;
}Expand description
checksec Trait implementation for
goblin::elf::Elf
Example
use checksec::elf::Properties;
use goblin::elf::Elf;
use std::fs;
pub fn print_results(binary: &String) {
if let Ok(buf) = fs::read(binary) {
if let Ok(elf) = Elf::parse(&buf) {
println!("Canary: {}", elf.has_canary());
}
}
}Required Methods§
Sourcefn has_canary(&self) -> bool
fn has_canary(&self) -> bool
check for __stack_chk_fail or __intel_security_cookie in dynstrtab
Sourcefn has_clang_cfi(&self) -> bool
fn has_clang_cfi(&self) -> bool
check for symbols containing .cfi in dynstrtab
Sourcefn has_clang_safestack(&self) -> bool
fn has_clang_safestack(&self) -> bool
check for __safestack_init in dynstrtab
Sourcefn has_fortify(&self) -> bool
fn has_fortify(&self) -> bool
check for symbols ending in _chk from dynstrtab
Sourcefn has_fortified(&self) -> u32
fn has_fortified(&self) -> u32
counts symbols ending in _chk from dynstrtab
Sourcefn has_relro(&self) -> Relro
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
Sourcefn has_rpath(&self) -> VecRpath
fn has_rpath(&self) -> VecRpath
check the.dynamic section for DT_RUNPATH and return results in a
VecRpath
Sourcefn has_runpath(&self) -> VecRpath
fn has_runpath(&self) -> VecRpath
check the .dynamic section for DT_RPATH and return results in a
VecRpath
Sourcefn get_dynstr_by_tag(&self, tag: u64) -> Option<String>
fn get_dynstr_by_tag(&self, tag: u64) -> Option<String>
return the corresponding string from dynstrtab for a given d_tag
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".