Thursday, February 7, 2013

Break root password in RHEL 6 and learn how to patch the holes



This tutorial teaches to break the root password on RHEL 6 and how to protect them from intruders.

If you are a novice or if you are thinking of cracking your friends root password then it not a tuff task,there are number of ways but you should know the ultimate technique to break down the system then only you will know how to protect your own computer from others. 



how to drill:-

*press any key as soon as the booting starts to display the GRUB menu.
*On the GRUB menu press 'e' to edit the grub menu and go to the second line which begins with the kernel.
*at the end of the line just type '1' to start the system in single user mode instead of default run level (shown in figure 1).
*press enter to quit the edit mode and press 'b'
*now you system boots in single user mode now you can change the root password. To do that type 'passwd' and change it, If the command doesnot display any output then it is indicating that SElinux is in enforcing mode, so we will type 'setenforce 0'.Then again type 'passwd' and change the root password.
*now you can login as root with the new password and you become the master of the computer.


figure 1


how to patch this hole:-


*login as root in your computer.
*go to /etc/rc1.d/S99single file and write 'exec/sbin/sulogin' before exec init -t1 S
(shown in figure 2).Now if you try the above process to login as single user mode then you have to enter the root password or an error will prompt.

figure 2


So there is any other way or i am secure? the answer is NO.
you are not secure, to break the above mechanism there is slight little twist.

drill again:-

*In our first go we edited the kernel parameters to boot to the single user mode and change the password, this time we wil again play with the kernel parameters and we will add at the last 'init=/bin/bash' to the kernel parameters
 (shown in figure 3).

figure 3

*if you tried to type 'passwd' to change you will prompt as error because the filesystem is mounted as read-only mode.Therefore we will mount the filesystem as read-write mode, just type 'mount -o remount,rw /' then try the 'passwd' to change the root password (shown in figure 4).Then restart the the system to login as root.

figure 4

how to patch this hole:-

*At first we have to create a md5 password for the grub.conf file to do so type 'grub-md5-crypt' and then type your password.
*go /etc/grub.conf and put a line 'password --md5' and put the password 
(shown in figure 5).

No comments:

Post a Comment