slimm609 / checksec

Checksec
https://slimm609.github.io/checksec
Other
2.04k stars 306 forks source link

Use dynamic section if no symbol table #231

Closed ffontaine closed 7 months ago

ffontaine commented 9 months ago

In case of aggressive stripping, symbol table is removed resulting in false negatives: checksec returns that FORTIFY and canary are disabled. To fix this issue, retrieve symbols from dynamic section instead of symbol table if needed.

While at it, fix an indentation issue to align FORTIFY result

petervas commented 4 months ago

In case of aggressive stripping, symbol table is removed resulting in false negatives: checksec returns that FORTIFY and canary are disabled. To fix this issue, retrieve symbols from dynamic section instead of symbol table if needed.

@ffontaine : Do you have a simple example that shows the issue you described? In my tests the regular readelf -s call will always show the dynamic section and (if avaiable) the symbol table.

Actually the only way i can produce the message "Dynamic symbol information is not available" that you check against to add --use-dynamic to the readelf call is if i try to check a file with readelf -s --use-dynamic that has no dynsym section.

ffontaine commented 4 months ago

Sure, run strip --strip-section-headers.

petervas commented 4 months ago

Perfect. Could reproduce it. Thank you.