Résumons dans cet article quelques techniques pour réinitialiser les mots de passes.
0x01. WINDOWS
############################################################################### # # # Reboot from any CD/USB key with any *nix where chntpw is installed # # ie. : Backtrack, Pentoo, ... # # # # chntpw # # # ############################################################################### fdisk -l # If sda1 is root dir of system winnt partiton mount /dev/sda1 /mnt cd /mnt/WINDOWS/system32/config/ echo ' *** Instructions : 1 : edit user data [enter] : choose default admin 1 : clear password ! : quit editor q : quit program y : save changes *** ' # Backtrack: /pentest/password/chntpw/chntpw chntpw -i SAM system
0x02. LINUX
############################################################################### # # # Reboot from any Linux with chroot command {Debian/Redhat/Slackware}-like # # when got a valid grub session, then choose single mode or # # edit line to add to the end of boot line: # # # # single # # # ############################################################################### fdisk -l # If sda1 is root dir of system linux partiton mount /dev/sda1 /mnt usr=$(chroot /mnt ls /home/|sed 's/\\/home\\///1') chroot /mnt passwd $usr
0x03. OSX 10.5 & 10.6
############################################################################### # # # To reboot into single mode in any Mac, restart and at black screen # # press keys CMD+S or Apple+S # # # # # # # ############################################################################### launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryService.plist pwd="masterpass" dsexport /tmp/export.out /Local/Default dsRecTypeStandard:Groups usr=$(grep :admin /tmp/export.out|cut -d':' -f6|cut -d',' -f2|tail -n1) rm -f /tmp/export.out echo "User:'$usr' -> Pwd:'$pwd'" dscl . -passwd /Users/$usr $pwd
0x04. OSX 10.7 & 10.8
############################################################################### # # # To reboot into single mode in any Mac, restart and at black screen # # press keys CMD+S or Apple+S # # # # # # # ############################################################################### launchctl load /System/Library/LaunchDaemons/com.apple.opendirectoryd.plist pwd="masterpass" dsexport /tmp/export.out /Local/Default dsRecTypeStandard:Groups usr=$(grep :admin /tmp/export.out|cut -d':' -f6|cut -d',' -f2|tail -n1) rm -f /tmp/export.out echo '*** Resetting password for admin user "'$usr'"' to '"'$pwd'"' dscl . -passwd /Users/$usr $pwd
0x05. *BSD
############################################################################### # # # To reboot into single mode in any *BSD, choose single mode (FreeBSD) # # or at start type: # # # # boot -s # # # ############################################################################### /bin/sh # When in shell: fsck -fy mount -a # Now you can change any password passwd
0x06. SOLARIS
############################################################################### # # # Grub give you ability to choose single mode, or better to edit current # # entry. # # # # # # # ############################################################################### #openindiana is hostname zpool import -f rpool zpool scrub rpool zfs set mountpoint=/recovery rpool/ROOT/openindiana zfs mount rpool/ROOT/openindiana cd /recovery/etc vi shadow
0x07. MYSQL
############################################################################### # # # You must have rights to shutdown and restart mysql daemon (service) # # These commands are written for *nix systems. # # # # In Win*, pkill/killall > taskkill # # # ############################################################################### pass="masterpass" # Stop service pkill -9 mysqld || killall -9 mysqld # Windows: net stop mysqld mysqld_safe --skip-grant-tables & echo "UPDATE user SET password=PASSWORD('$pass') WHERE user='root';" |mysql mysql -u root echo "FLUSH PRIVILEGES;" |mysql mysql -u root /etc/init.d/mysql start # Windows: net start mysqld echo " Login ..: root Password: $pass " mysql -u root -h localhost -p$pass
=> Écrit par : Nicolas, le 27 janvier 2016