John the Ripper 의 솔트된 해시 처리 관찰하기
이 단계에서는 인기 있는 비밀번호 크랙 도구인 John the Ripper 를 사용하여 솔트된 해시와 솔트되지 않은 해시를 어떻게 처리하는지 관찰합니다. 이를 통해 솔팅의 실제적인 영향을 보여줄 것입니다.
먼저 간단한 단어 목록 (wordlist) 을 사용하여 salted_passwords.txt의 비밀번호를 크랙해 보겠습니다. 이 시연을 위해 작고 사용자 정의된 단어 목록을 사용할 것입니다.
~/project 디렉토리에 wordlist.txt라는 단어 목록 파일을 만들고 몇 가지 일반적인 비밀번호를 추가합니다.
echo "password" > ~/project/wordlist.txt
echo "user1password" >> ~/project/wordlist.txt
echo "anotherpassword" >> ~/project/wordlist.txt
echo "shortpass" >> ~/project/wordlist.txt
echo "123456" >> ~/project/wordlist.txt
이제 이 단어 목록을 사용하여 salted_passwords.txt 파일에 대해 John the Ripper 를 실행합니다.
john --wordlist=~/project/wordlist.txt ~/project/salted_passwords.txt
John the Ripper 가 해시를 분석합니다. 비밀번호를 크랙하려고 시도함을 나타내는 출력을 볼 수 있습니다. 솔트되지 않은 MD5 해시이고 단어 목록에 "password"가 있기 때문에 user2의 비밀번호를 빠르게 찾을 가능성이 높습니다. 해당 평문 (plaintext) 이 단어 목록에 있다면 솔트된 비밀번호도 찾을 것입니다.
예상 출력은 다음과 같습니다.
Using default input encoding: UTF-8
Loaded 4 password hashes with no different salts to crack (crypt, generic crypt(3) [MD5/Blowfish/SHA1/SHA256/SHA512/XSHAa/XSHAab/bcrypt/scrypt])
Will run 4 OpenMP threads
Press 'q' or Ctrl-C to abort, almost any other key for status
password (user2)
user1password (user1)
anotherpassword (user3)
shortpass (user4)
4g 0:00:00:00 DONE (2023-10-27 10:30) ...
Session completed.
John 이 완료된 후에는 --show 옵션을 사용하여 크랙된 비밀번호를 볼 수 있습니다.
john --show ~/project/salted_passwords.txt
이 명령은 John 이 성공적으로 크랙한 모든 비밀번호를 표시합니다.
user2:password (user2)
user1:user1password (user1)
user3:anotherpassword (user3)
user4:shortpass (user4)
4 password hashes cracked, 0 left
John the Ripper 는 내장된 솔트를 포함하여 다양한 해시 형식을 처리하도록 설계되었습니다. 크랙 프로세스 중에 솔트를 자동으로 추출하여 사용합니다. 그러나 각 비밀번호에 고유한 솔트가 존재하면, 특히 대규모 공격에서 크랙에 필요한 계산 노력이 크게 증가합니다.