(Fedora:
Lesson 4)
{ Using a Live CD to
crack a password protected grub.conf file }
Section 0. Background
Information |
- Background Information
- In
Lesson 3 you learned how to password protect the grub menu.
- This lesson teaches you how to circumvent a
password protected grub menu using a Fedora Live CD. Actually, you
can use just about any Linux Live CD (e.g., Hiren's, BackTrack, etc).
- Pre-requisites
-
Fedora: Lesson 1: Installing Fedora 14
-
Fedora: Lesson 3: Hardening the Boat Loader, /boot/grub/grub.conf
-
Lab
Notes
- In this lab we will do the following:
- We will circumvent password protected
Grub with a Fedora 14 Live CD.
- We will mount the boot partition
- We will removed the password directive
that protects the grub.conf file.
- We will test our handy work.
- Legal Disclaimer
- As a
condition of your use of this Web site, you warrant to
computersecuritystudent.com that you will not use this Web site for any
purpose that is unlawful or that is prohibited
by these terms, conditions, and notices.
- In accordance with UCC § 2-316, this
product is provided with "no warranties, either express or implied." The
information contained is provided "as-is", with "no guarantee of
merchantability."
- In addition, this is a teaching website
that does not condone malicious behavior of
any kind.
- Your are on notice, that continuing
and/or using this lab outside your "own" test environment
is considered malicious and is against the law.
- © 2013 No content replication of any
kind is allowed without express written permission.
Section 1: Configure
Fedora14 Virtual Machine Settings |
- Open Your VMware Player
- Instructions:
- On Your Host Computer, Go To
- Start --> All Program -->
VMWare --> VMWare Player
- Edit Fedora 14 Virtual Machine Settings
- Instructions:
- Highlight Fedora14
- Click Edit virtual machine
settings
- Set Machine to Boot From CD/DVD
- Instructions:
- Select CD/DVD (IDE)
- Device status: Check the
Connect at power on checkbox.
- Select the "Use ISO image file"
radio button.
- Click the Browse Button.
- Navigate to the location of
your Fedora14.iso or other Live CD
- Edit Network Adapter
- Instructions:
- Highlight Network Adapter
- Select Bridged
- Click the OK Button
Section 2: Play
Virtual Machine |
- Start the Fedora14 VM
- Instructions:
- Click on the Fedora14 VM
- Click on Play virtual machine
- Obtain Boot Menu
- Instructions
- Once you see the below vmware screen,
(1) Left Click in the screen and (2) press the "<Esc>"
key
- Note(FYI):
- This might take you a few times so be
patient!!!
- Boot Menu Options
- Instructions:
- Arrow Down to CD-ROM Drive
- Press <Enter>
- Boot Notification
- Instructions:
- Press the
<Tab>
key
- Live Desktop
- Instructions:
- Arrow Down to
Boot
- Press the
<Tab>
key
- Boot into Single User Mode
- Instructions:
- Type the word
single
and the end of the line.
- Press the
<Enter>
key
- Note(FYI):
- By adding "single" or "1" to the end of
the line, you are telling the CD to boot into single user mode
instead of the Graphical User Interface (init 5).
Section 3: Editing
the grub.conf from single user mode. |
- Working in Single User Mode
- Note(FYI):
- In my case, you will notice the drive [sda]
- When booting off a CD into single user
mode, you will automatically be the root user
- View Partition Table
- Instructions:
- fdisk -l
- Where "-l"
is the lower case letter
L.
- Note(FYI):
- The fdisk command will allow you to see
the partition table for one or many disk(s).
- Determine the Boot Partition
- Note(FYI):
- Under the "Boot" Column there is a "*",
which indicates to you that this is the
boot slice of disk /dev/sda, which in this case it is
/dev/sda1
- Mount the boot device
- Instructions:
- mount -t ext4 /dev/sda1 /mnt
- Note(FYI):
- The ext4 or fourth extended filesystem
is a journaling file system for Linux, developed as the successor to
ext3.
- ext4 is backward compatible with ext3
and ext2, making it possible to mount ext3 and ext2 as ext4.
- Backup and open the grub.conf file
- Instructions:
- cd /mnt/grub/
- cp grub.conf grub.conf.bkp2
- vi grub.conf
- Note(FYI):
- Remember, /mnt is really /boot now, since /dev/sda1 is the partition in
which the /boot filesystem is normally mounted on.
- This is the second grub.conf backup
file.
- Delete the line that contains password.
- Instructions:
- Arrow down until your cursor is on the
password string.
- Type "dd", to the delete one line.
- Press the <ESC> key
- Type ":wq!"
- Present the <Enter> key.
- Power Off Operating System
- Instructions:
- cd /
- umount /mnt
- poweroff
- Power Off Virtual Machine
- Instructions:
- Click Power Off (See Picture)
Section 4:
Configure Virtual
Settings |
- Edit Fedora 14 Virtual Machine Settings
- Instructions:
- Highlight Fedora14
- Click Edit virtual machine settings
- Auto Detect Hard Drive
- Instructions:
- Click on CD/DVD(IDE)
- Click the Use physical drive: radio
button
- Make sure Auto detect is selected
- Edit Network Adapter
- Instructions:
- Highlight Network Adapter
- Select Bridged
- Click the OK Button
Section 5:
Configure the
grub.conf to provide a root prompt at single user
mode |
- Start the Fedora14 VM
- Instructions:
- Click on the Fedora14 VM
- Click on Play virtual machine
-
- Obtain Boot Menu
- Instructions
- Once you see the below vmware screen,
(1) Left Click in the screen and (2) press the "e"
key
- Note(FYI):
- This might take you a few times so be
patient!!!
- Enter the Grub Menu
- Instructions
- Press "e"
key
- Access the Kernel
- Instructions:
- Arrow down to the line that contains
the kernel.
- Press the "e"
key to edit the kernel.
- Note(FYI): What is
the kernel?
- The kernel is the part of the operating
system that allocates machine resources, including memory, disk
space, and CPU cycles, to all other programs that run on a
computer. The kernel includes the low-level hardware interfaces (a.k.a
drivers) and manages processes, the means by which Linux executes
programs.
- Prepare Operating System to Boot into Single
User Mode
- Instructions:
- Type a "1"
after the word quiet (See Below)
- Press Enter.
- Note(FYI):
- This is how we will put the system into
single user mode.
- Boot the System
- Instructions:
- Type "b" to boot.
- Note(FYI):
- The below screen is the result of
pressing enter in step 4.
Section 6: Resetting
root's password in Single User Mode |
- Single User Mode
- Note(FYI):
- You are in single user mode
- You are the root user
- Create a new root password
- Instructions:
- passwd root
- New password: <Provide whatever
password you like>
- Retype new password: <Provide same
password>
-
-
Boot machine into the Graphical
Multiuser Interface
- Instructions:
- init 5
- Note(FYI):
Below are all the run levels.
- init 0 - Halt
- init 1 - Single User, File
Systems are Mounted, Network Down.
- init 2 - Multi User, No NFS,
File Systems Mounted, Network Up.
- init 3 - Multi User, File
Systems are Mounted, Network Up.
- init 4 - User defined.
- init 5 - Graphical
Multiuser, File Systems Mounted, Network Up.
- init 6 - Reboot.
Section 7: Login to
Fedora 14 |
- Login to Fedora14
- Instructions:
- Login: student
- Password: <Provide Your Password>
- Click the Log In Button
- Start a Terminal Console
- Instructions:
- Applications --> Terminal
- Switch user to root
- Instructions:
- su - root
- <Whatever you set the root password to>
- Proof of Lab
- Instructions:
- cd /boot/grub/
- ls -l grub.conf*
- grep password grub.conf*
- date
- echo "Your Name"
- Put in your actual name in place of
"Your Name"
- e.g., echo "John Gray"
-
Proof of Lab
Instructions
- Press the <Ctrl> and <Alt> key at the
same time.
- Press the <PrtScn> key.
- Paste into a word document
- Upload to Moodle
|
 
|