본문 바로가기

Linux/보안

사용자 보안 - 패스워드 크랙


패스워드 크랙 - john the ripper

-------------------------------------------------------------------

http://www.openwall.com/john/

john-1.7.0.2.tar.gz : (
다운로드)

-------------------------------------------------------------------



1. 압축 해제

 
[root@server3 ~]# cd Desktop
[root@server3 Desktop]# ls
john-1.7.0.2.tar.gz 
[root@server3 Desktop]# tar xvfz john-1.7.0.2.tar.gz
john-1.7.0.2/
john-1.7.0.2/src/
john-1.7.0.2/src/AFS_fmt.c
john-1.7.0.2/src/BF_fmt.c
john-1.7.0.2/src/BF_std.c

- 중략

john-1.7.0.2/doc/CREDITS
john-1.7.0.2/doc/FAQ
john-1.7.0.2/doc/LICENSE
john-1.7.0.2/doc/CONTACT
john-1.7.0.2/README
[root@server3 Desktop]# ls
john-1.7.0.2.tar.gz  john-1.7.0.2




2. 컴파일

 
[root@server3 Desktop]# cd john-1.7.0.2
[root@server3 john-1.7.0.2]# cd src
[root@server3 src]# pwd
/root/Desktop/john-1.7.0.2/src
[root@server3 src]# ls
AFS_fmt.c   Makefile.dep  config.h    john.asm  misc.h       recovery.h  symlink.c
BF_fmt.c    alpha.S       cracker.c   john.c    nonstd.c     rpp.c       times.h
BF_std.c    alpha.h       cracker.h   john.com  options.c    rpp.h       tty.c
BF_std.h    batch.c       crc32.c     list.c    options.h    rules.c     tty.h
BSDI_fmt.c  batch.h       crc32.h     list.h    pa-risc.h    rules.h     unafs.c
DES_bs.c    bench.c       detect.c    loader.c  params.c     sboxes.c    unique.c
DES_bs.h    bench.h       external.c  loader.h  params.h     signals.c   unshadow.c
DES_bs_b.c  best.c        external.h  logger.c  path.c       signals.h   vax.h
DES_fmt.c   best.sh       formats.c   logger.h  path.h       single.c    wordlist.c
DES_std.c   charset.c     formats.h   math.c    ppc-alti.c   single.h    wordlist.h
DES_std.h   charset.h     getopt.c    math.h    ppc-alti.pl  sparc.S     x86-64.h
LM_fmt.c    common.c      getopt.h    memory.c  ppc32.h      sparc.sh    x86-any.h
MD5_fmt.c   common.h      idle.c      memory.h  ppc32alt.h   sparc32.h   x86-mmx.S
MD5_std.c   compiler.c    idle.h      mips32.h  ppc64.h      sparc64.h   x86-mmx.h
MD5_std.h   compiler.h    inc.c       mips64.h  ppc64alt.h   status.c    x86.S
Makefile    config.c      inc.h       misc.c    recovery.c   status.h

[root@server3 src]# make
To build John the Ripper, type:
        make clean SYSTEM
where SYSTEM can be one of the following:
linux-x86-mmx            Linux, x86 with MMX (best)
linux-x86-any            Linux, x86
linux-x86-any-a.out      Linux, x86, a.out binaries (obsolete)
linux-x86-64             Linux, AMD x86-64, 64-bit native
linux-x86-64-mmx         Linux, AMD x86-64, 32-bit with MMX

- 중략

generic                  Any other Unix-like system with gcc

[root@server3 src]# make linux-x86-any

- 중략

rm -f ../run/unshadow
ln -s john ../run/unshadow
rm -f ../run/unafs
ln -s john ../run/unafs
rm -f ../run/unique
ln -s john ../run/unique
make[1]: Leaving directory `/root/Desktop/john-1.7.0.2/src'
[root@server3 src]#




3. 테스트

 
[root@server3 run]# pwd
/root/Desktop/john-1.7.0.2/run
[root@server3 run]# ls
all.chr    alpha.chr   john       lanman.chr  password.lst  unique
alnum.chr  digits.chr  john.conf  mailer      unafs         unshadow

[root@server3 run]# useradd test2 - 테스트를 위해 사용자를 생성해준다.
[root@server3 run]# passwd test2 - 크랙 확인차 테스트 하기 위해 만들어 준다. 패스워드는 test2
Changing password for user test2.
New UNIX password:
BAD PASSWORD: it is too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.

[root@server3 run]# ./unshadow /etc/passwd /etc/shadow > passwd.txt
[root@server3 run]# cat passwd.txt

- 중략

jane:!!:610:610::/home/woman/jane:/bin/bash

suny:!!:620:620::/home/woman/suny:/bin/csh
eric:!!:630:630::/home/man/eric:/bin/ksh
kim:$1$g7n1q0db$.uJQCz2ccck98hStLyqe3/:670:15::/home2/kim:/bin/bash
lee:!!:690:500::/home2/lee:/bin/csh
park:$1$UASWnbMn$D6PDU2PxruPlm2uUVoClm0:700:15::/home2/park:/bin/bash
test2:$1$Ze.iwDRz$0wu2UzkCIr5KwvXRooJXE.:701:701::/home/test2:/bin/bash

[root@server3 run]# ./john passwd.txt - 크래킹하는 패스워드가 저장되는 파일이다.
Loaded 4 password hashes with 4 different salts (FreeBSD MD5 [32/32])
test2            (test2)
- 참고로 쉬운 패스워드를 쓰는 사용자만 나타나게 된다. 중지는 ctrl+c


guesses: 1  time: 0:00:00:42 76% (2)  c/s: 7627  trying: Best0
Session aborted

[root@server3 run]# cat john.pot - 크래킹된 패스워드가 저장되는 파일이다. (계속 축적된다.)
$1$Ze.iwDRz$0wu2UzkCIr5KwvXRooJXE.:test2