github.com/anchore/syft@v1.4.2-0.20240516191711-1bec1fc5d397/syft/file/executable.go (about) 1 package file 2 3 type ( 4 ExecutableFormat string 5 RelocationReadOnly string 6 ) 7 8 const ( 9 ELF ExecutableFormat = "elf" 10 MachO ExecutableFormat = "macho" 11 PE ExecutableFormat = "pe" 12 13 RelocationReadOnlyNone RelocationReadOnly = "none" 14 RelocationReadOnlyPartial RelocationReadOnly = "partial" 15 RelocationReadOnlyFull RelocationReadOnly = "full" 16 ) 17 18 type Executable struct { 19 // Format denotes either ELF, Mach-O, or PE 20 Format ExecutableFormat `json:"format" yaml:"format" mapstructure:"format"` 21 22 HasExports bool `json:"hasExports" yaml:"hasExports" mapstructure:"hasExports"` 23 HasEntrypoint bool `json:"hasEntrypoint" yaml:"hasEntrypoint" mapstructure:"hasEntrypoint"` 24 ImportedLibraries []string `json:"importedLibraries" yaml:"importedLibraries" mapstructure:"importedLibraries"` 25 ELFSecurityFeatures *ELFSecurityFeatures `json:"elfSecurityFeatures,omitempty" yaml:"elfSecurityFeatures" mapstructure:"elfSecurityFeatures"` 26 } 27 28 type ELFSecurityFeatures struct { 29 SymbolTableStripped bool `json:"symbolTableStripped" yaml:"symbolTableStripped" mapstructure:"symbolTableStripped"` 30 31 // classic protections 32 33 StackCanary *bool `json:"stackCanary,omitempty" yaml:"stackCanary" mapstructure:"stackCanary"` 34 NoExecutable bool `json:"nx" yaml:"nx" mapstructure:"nx"` 35 RelocationReadOnly RelocationReadOnly `json:"relRO" yaml:"relRO" mapstructure:"relRO"` 36 PositionIndependentExecutable bool `json:"pie" yaml:"pie" mapstructure:"pie"` 37 DynamicSharedObject bool `json:"dso" yaml:"dso" mapstructure:"dso"` 38 39 // LlvmSafeStack represents a compiler-based security mechanism that separates the stack into a safe stack for storing return addresses and other critical data, and an unsafe stack for everything else, to mitigate stack-based memory corruption errors 40 // see https://clang.llvm.org/docs/SafeStack.html 41 LlvmSafeStack *bool `json:"safeStack,omitempty" yaml:"safeStack" mapstructure:"safeStack"` 42 43 // ControlFlowIntegrity represents runtime checks to ensure a program's control flow adheres to the legal paths determined at compile time, thus protecting against various types of control-flow hijacking attacks 44 // see https://clang.llvm.org/docs/ControlFlowIntegrity.html 45 LlvmControlFlowIntegrity *bool `json:"cfi,omitempty" yaml:"cfi" mapstructure:"cfi"` 46 47 // ClangFortifySource is a broad suite of extensions to libc aimed at catching misuses of common library functions 48 // see https://android.googlesource.com/platform//bionic/+/d192dbecf0b2a371eb127c0871f77a9caf81c4d2/docs/clang_fortify_anatomy.md 49 ClangFortifySource *bool `json:"fortify,omitempty" yaml:"fortify" mapstructure:"fortify"` 50 51 //// Selfrando provides function order shuffling to defend against ROP and other types of code reuse 52 //// see https://github.com/runsafesecurity/selfrando 53 // Selfrando *bool `json:"selfrando,omitempty" yaml:"selfrando" mapstructure:"selfrando"` 54 }