Properties

Trait Properties 

Source
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§

Source

fn has_canary(&self) -> bool

check for __stack_chk_fail or __intel_security_cookie in dynstrtab

Source

fn has_clang_cfi(&self) -> bool

check for symbols containing .cfi in dynstrtab

Source

fn has_clang_safestack(&self) -> bool

check for __safestack_init in dynstrtab

Source

fn has_fortify(&self) -> bool

check for symbols ending in _chk from dynstrtab

Source

fn has_fortified(&self) -> u32

counts symbols ending in _chk from dynstrtab

Source

fn has_nx(&self) -> bool

check p_flags of the PT_GNU_STACK ELF header

Source

fn has_pie(&self) -> PIE

check d_val of DT_FLAGS/DT_FLAGS_1 of the PT_DYN ELF header

Source

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

Source

fn has_rpath(&self) -> VecRpath

check the.dynamic section for DT_RUNPATH and return results in a VecRpath

Source

fn has_runpath(&self) -> VecRpath

check the .dynamic section for DT_RPATH and return results in a VecRpath

Source

fn get_dynstr_by_tag(&self, tag: u64) -> Option<String>

return the corresponding string from dynstrtab for a given d_tag

Implementations on Foreign Types§

Source§

impl Properties for Elf<'_>

Implementors§