diff --git a/README.md b/README.md index 72dba53..c08dd05 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Updates - golang: real 0m0.691s - Adds recursive directory support TODO: - - [ ] Fix Partial RELRO + - [X] Fix Partial RELRO - [ ] Add fortify file function results - [ ] Add fortifyProc - [ ] Add ProcLibs diff --git a/pkg/checksec/fortify.go b/pkg/checksec/fortify.go index d9fb714..0278037 100644 --- a/pkg/checksec/fortify.go +++ b/pkg/checksec/fortify.go @@ -37,14 +37,7 @@ func Fortify(name string, binary *elf.File) *fortify { ldd := GetLdd(name) - if ldd == "none" { - res.Output = "N/A" - res.Color = "green" - res.Fortified = "0" - res.Fortifiable = "0" - res.LibcSupport = "N/A" - return &res - } else if ldd == "unk" { + if ldd == "none" || ldd == "unk" { res.Output = "N/A" res.Color = "unset" res.Fortified = "0" diff --git a/pkg/checksec/relro.go b/pkg/checksec/relro.go index c353ab8..3c75ba4 100644 --- a/pkg/checksec/relro.go +++ b/pkg/checksec/relro.go @@ -25,8 +25,14 @@ func RELRO(name string) *relro { } defer file.Close() - bind, _ := file.DynValue(24) - if len(bind) > 0 && bind[0] == 0 { + // check both bind and bind_flag. + // if DT_BIND_NOW == 0, then it is set + // if DT_FLAGS == 8, then DF_BIND_NOW is set + // this is depending on the compiler version used. + bind, _ := file.DynValue(elf.DT_BIND_NOW) + bind_flag, _ := file.DynValue(elf.DT_FLAGS) + + if (len(bind) > 0 && bind[0] == 0) || (len(bind_flag) > 0 && bind_flag[0] == 8) { bindNow = true } diff --git a/pkg/utils/utils.go b/pkg/utils/utils.go index b4e5865..582c8be 100644 --- a/pkg/utils/utils.go +++ b/pkg/utils/utils.go @@ -7,14 +7,12 @@ import ( func PrintLogo() { Red := color.New(color.FgHiRed, color.Bold) asciiLogo := ` -_______ _______ _______ _ _______ _______ _______ -( ____ \|\ /|( ____ \( ____ \| \ /\( ____ \( ____ \( ____ \ -| ( \/| ) ( || ( \/| ( \/| \ / /| ( \/| ( \/| ( \/ -| | | (___) || (__ | | | (_/ / | (_____ | (__ | | -| | | ___ || __) | | | _ ( (_____ )| __) | | -| | | ( ) || ( | | | ( \ \ ) || ( | | -| (____/\| ) ( || (____/\| (____/\| / \ \/\____) || (____/\| (____/\ -(_______/|/ \|(_______/(_______/|_/ \/\_______)(_______/(_______/ + _____ _ _ ______ _____ _ __ _____ ______ _____ + / ____| | | | ____/ ____| |/ // ____| ____/ ____| +| | | |__| | |__ | | | ' /| (___ | |__ | | +| | | __ | __|| | | < \___ \| __|| | +| |____| | | | |___| |____| . \ ____) | |___| |____ + \_____|_| |_|______\_____|_|\_\_____/|______\_____| ` Red.Println(asciiLogo) }