Common Exploits and Technical Details for CentOS Systems
Dirty Cow is a race condition vulnerability in the Linux kernel’s Copy-on-Write (CoW) mechanism, allowing unprivileged users to bypass read-only memory restrictions and escalate privileges to root. The flaw exists in how the kernel handles memory pages during CoW operations, enabling attackers to modify sensitive system files.
Typical Exploitation Steps:
dirtycow.c from GitHub).gcc -pthread dirtycow.c -o dirtycow -lcrypt.Pkexec is a setuid utility designed to allow ordinary users to execute commands as root. Multiple vulnerabilities in pkexec stem from improper argument handling—for example, CVE-2017-1000367 occurs when pkexec fails to validate the number of arguments, treating environment variables as executable commands.
Typical Exploitation Steps:
pkexec_exp.c).gcc pkexec_exp.c -o pkexec_exp.The Set User ID (SUID) bit allows users to execute files with the permissions of the file owner (typically root). Misconfigured SUID binaries (e.g., find, vim, bash) can be abused to gain root access.
Common Methods:
find / -perm -u=s -type f 2>/dev/null to locate SUID files. If /usr/bin/find has the SUID bit set, run find / -exec /bin/bash \; to spawn a root shell./usr/bin/vim with SUID, use vim -c '!bash' to start a root shell./bin/bash has SUID, run bash -p to switch to root.find commands) is critical to mitigating this risk.The sudo utility permits privileged command execution for authorized users. Misconfigurations (e.g., allowing execution of dangerous commands like awk, less, or vim) can be exploited to bypass authentication and modify system files (e.g., adding a root user to /etc/passwd).
Typical Exploitation Steps:
sudoers file (via visudo) to grant unsafe permissions (e.g., user1 ALL=(ALL) NOPASSWD: /usr/bin/awk).sudo awk 'BEGIN {system("/bin/bash")}') to spawn a root shell.CVE-2024-1086 is a high-severity use-after-free vulnerability in the netfilter subsystem’s nf_tables component. It occurs when the kernel fails to properly handle freed memory, allowing local attackers to execute arbitrary code with root privileges.
Typical Exploitation Steps:
cve-2024-1086_exp.c).gcc cve-2024-1086_exp.c -o cve-2024-1086_exp.yum update kernel for CentOS 7/8).find / -perm -4000 2>/dev/null to identify and remove unnecessary SUID/SGID files.sudoers to limit commands to least privilege (e.g., avoid NOPASSWD for dangerous tools).