Gallopsled / pwntools

CTF framework and exploit development library
http://pwntools.com
Other
11.99k stars 1.7k forks source link

Add x86 CET status to checksec output #2293

Closed peace-maker closed 10 months ago

peace-maker commented 11 months ago

Check if the binary was compiled with Control-flow Enforcement Technology (CET) and display if it supports shadowstack (SHSTK) and indirect branch tracking (IBT). Even though IBT hardware is rare (using those endbr instructions) it's useful to be futureproof here.

A binary compiled with -fcf-protection=full will now show both features in the checksec output:

[*] './test'
    Arch:     amd64-64-little
    RELRO:    Full RELRO
    Stack:    No canary found
    NX:       NX enabled
    PIE:      PIE enabled
    SHSTK:    Enabled
    IBT:      Enabled

This requires bumping of the minimum pyelftools version, which shouldn't be a problem and is required anyways as shown in #2280.

Similarly, the target machine's cpuinfo features are checked for "user_shstk" capabilities in ssh.checksec to know if the cpu and kernel support userspace shadowstack as described in the shstk docs.

Closes #2288

Arusekk commented 11 months ago

Nice! Two ideas:

peace-maker commented 11 months ago

I've added ibt checks to ssh.checksec and refactored the property parsing to deduplicate code.

I'll change corefile parsing and cat2 separately.