User Tools

Site Tools


user:nbrimme1:portfolio:break-into-linux

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
user:nbrimme1:portfolio:break-into-linux [2019/02/12 22:35]
nbrimme1 [Entire Partition]
user:nbrimme1:portfolio:break-into-linux [2019/02/21 19:44] (current)
nbrimme1 [Method 2: boot to single-user mode]
Line 11: Line 11:
 =====Procedure===== =====Procedure=====
 ====Method 1: Using /sbin/init to execute a shell==== ====Method 1: Using /sbin/init to execute a shell====
 +[[https://​en.wikipedia.org/​wiki/​Init|Init]] is a process started during bootup that initializes a system. It starts, stops and monitors essential service processes during bootup and shutdown. I will use it to execute a root shell after booting the target system.
   - Power on/reboot the target machine   - Power on/reboot the target machine
     - Through a graphical login screen: for a clean reboot just use the shutdown/​reboot options in the system menu.     - Through a graphical login screen: for a clean reboot just use the shutdown/​reboot options in the system menu.
Line 20: Line 21:
   - Continue booting.   - Continue booting.
  
-DONE! THAT'S ALL FOLKS!+DONE! THAT'S ALL FOLKS!\\
 After the target machine finishes booting, the kernel will detect the hardware and immediately drop you into a root shell. Since the system initialization script '/​etc/​rc.d/​rc.sysinit'​ was bypassed and **NOT** executed, ​ After the target machine finishes booting, the kernel will detect the hardware and immediately drop you into a root shell. Since the system initialization script '/​etc/​rc.d/​rc.sysinit'​ was bypassed and **NOT** executed, ​
-we need to remount the root file system ​and make some changes ​to make the system more usable.+you need to remount the root file system to make the system more usable: 
-  - Mount the /proc file system: <​code:​bash>​mount /​proc</​code>​ You will see an error message complaining that it was already mounted. Ignore it.+  - Mount the /proc file system: <​code:​bash>​mount /​proc</​code>​ You will see an error message complaining that it was already mounted. Ignore it.
   - Remount the root file system in read-write mode: <​code:​bash>​mount -o remount,rw /</​code>​   - Remount the root file system in read-write mode: <​code:​bash>​mount -o remount,rw /</​code>​
-  - Depending on how the target'​s file system is laid out, you may need to mount some other file systems. Lets view the file system table: <​code:​bash>​cat /​etc/​fstab</​code>​ Mount any other needed file systems (Like '/​home',​ '/​usr',​ etc.).+  - Depending on how the target'​s file system is laid out, you may need to mount some other file systems. Lets view the file system table: <​code:​bash>​cat /​etc/​fstab</​code>​ Mount any other needed file systems (Like '/​home',​ '/​usr',​ etc.).
   - Do whatever nefarious things you want:   - Do whatever nefarious things you want:
     - **Change the root account password:** <​code:​bash>​passwd root</​code>​     - **Change the root account password:** <​code:​bash>​passwd root</​code>​
-    - **PROTIP:** I don't recommend doing this as the next time the real user logs into the system they will notice that their root password has been changed. We need to be super sneaky, secretive, and surreptitious so here's something a little less noticeable:+    - **PROTIP:** I don't recommend doing this. The next time the real user logs into the system they will notice that the root password has been changed ​and it's **GAME OVER**. We need to be super sneaky, secretive, and surreptitious so here's something a little less noticeable:
       - Simply add another user without modifying the original root password: <​code:​bash>​adduser -D -u 1000 bad-user       - Simply add another user without modifying the original root password: <​code:​bash>​adduser -D -u 1000 bad-user
 passwd bad-user</​code>​ passwd bad-user</​code>​
-      - Also add the newly created user to the sudoers file. This is also not as noticable as changing the actual root password: <​code:​bash>​vi /​etc/​sudoers+      - Now add the newly created user to the sudoers file. This is also not as noticable as changing the actual root password: <​code:​bash>​vi /​etc/​sudoers
 bad-user ALL=(ALL) ALL</​code>​ bad-user ALL=(ALL) ALL</​code>​
-  - Reboot the target machine to make the changes ​persistent. First run '​sync'​ a few times to tell the kernel to flush any disk I/O out to the hardware ​and then '​umount'​ the mounted file systems in reverse order. +  - Reboot the target machine to make any changes to the file system persistent. 
-  - Once the file systems are all unmounted, you can reboot ​with either <​Ctrl><​Alt><​Del>​ or the power switch.+    - Flush any disk I/O to the hardware: <​code:​bash>​sync</​code>​ 
 +    - Unmount any mounted file systems in reverse order: <​code:​bash>​umount</​code>​ 
 +  - Reboot ​with either <​Ctrl><​Alt><​Del>​ or the power switch.
 ====Method 2: boot to single-user mode==== ====Method 2: boot to single-user mode====
 +[[https://​en.wikipedia.org/​wiki/​Single_user_mode|Single user mode]] is a start-up mode that boots a multi-user operating system into single superuser. It is often used for diagnoses and triage of a broken or malware-infected system. After booting into single-user mode, a root shell is provided to the user.
   - Power on/reboot the target machine   - Power on/reboot the target machine
     - Through a graphical login screen: for a clean reboot just use the shutdown/​reboot options in the system menu.     - Through a graphical login screen: for a clean reboot just use the shutdown/​reboot options in the system menu.
user/nbrimme1/portfolio/break-into-linux.1550028904.txt.gz · Last modified: 2019/02/12 22:35 by nbrimme1