Unix Commands

A collection of mostly security-related Unix commands I find useful. Many more one-liners can be found at:

Find all world writeable SUID/SGUID files and directories, sending stderr to /dev/null.

find / -perm /6000 -and -perm -2 ! -type l -ls 2>/dev/null

Detect presence of stack smashing with objdump and grep.

% objdump -d ff | grep __stack_chk_fail
0000000000400468 <__stack_chk_fail@plt>:
  4005c4:       e8 9f fe ff ff          callq  400468 <__stack_chk_fail@plt>
% cc -fno-stack-protector -o ff ff.c # Disable stack protector.
% ./ff xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Segmentation fault
% objdump -d ff | grep __stack_chk_fail
% # No output if stack protector is disabled.