SSH brute force(무차별 공격) 란 사전적 계정이름과 단순한 패스워드를 노리는 대입공격 입니다.
혹시나 해킹에 성공한다면 사용자 계정을 획득하여 또 다른 해킹을 시도할 것입니다.
본인의 서버에 SSH brute force 공격이 있었는지를 확인해 봅니다.
SSH brute force prevent
1. 패스워드를 누구도 상상할 수 없는 엄청난 조합으로 만드는 것입니다. ^^
2. prevent 같은 방어 툴을 사용합니다.
3. iptables 로 수시로 접속을 시도하는 패킷에 대해 차단합니다.
4. ssh 포트를 변경하고, iptables 로 포트 스캔도 막습니다. (포트 변경 만으로도 방어가 가능한 것 같습니다.)
ssh port 변경
1. ssh 설정 파일 수정
2. iptables 수정
3. iptables 적용 / ssh 재시작
혹시나 해킹에 성공한다면 사용자 계정을 획득하여 또 다른 해킹을 시도할 것입니다.
본인의 서버에 SSH brute force 공격이 있었는지를 확인해 봅니다.
# vi /var/log/secure
Nov 30 10:46:57 localhost sshd[32438]: Address 210.21.225.202 maps to sym.gdsz.cncnet.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Nov 30 10:46:57 localhost sshd[32438]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=210.21.225.202 user=root
Nov 30 10:46:59 localhost sshd[32438]: Failed password for root from 210.21.225.202 port 63852 ssh2
Nov 30 10:46:59 localhost sshd[32439]: Received disconnect from 210.21.225.202: 11: Bye Bye
Nov 30 10:47:02 localhost sshd[32440]: Address 210.21.225.202 maps to sym.gdsz.cncnet.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Nov 30 10:47:02 localhost sshd[32440]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=210.21.225.202 user=root
Nov 30 10:47:04 localhost sshd[32440]: Failed password for root from 210.21.225.202 port 64468 ssh2
Nov 30 10:47:05 localhost sshd[32441]: Received disconnect from 210.21.225.202: 11: Bye Bye
Nov 30 10:47:08 localhost sshd[32444]: Address 210.21.225.202 maps to sym.gdsz.cncnet.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Nov 30 10:47:08 localhost sshd[32444]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=210.21.225.202 user=root
Nov 30 10:47:10 localhost sshd[32444]: Failed password for root from 210.21.225.202 port 65319 ssh2
Nov 30 10:47:10 localhost sshd[32445]: Received disconnect from 210.21.225.202: 11: Bye Bye
이것이 바로 SSH brute force 공격입니다.Nov 30 10:46:57 localhost sshd[32438]: Address 210.21.225.202 maps to sym.gdsz.cncnet.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Nov 30 10:46:57 localhost sshd[32438]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=210.21.225.202 user=root
Nov 30 10:46:59 localhost sshd[32438]: Failed password for root from 210.21.225.202 port 63852 ssh2
Nov 30 10:46:59 localhost sshd[32439]: Received disconnect from 210.21.225.202: 11: Bye Bye
Nov 30 10:47:02 localhost sshd[32440]: Address 210.21.225.202 maps to sym.gdsz.cncnet.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Nov 30 10:47:02 localhost sshd[32440]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=210.21.225.202 user=root
Nov 30 10:47:04 localhost sshd[32440]: Failed password for root from 210.21.225.202 port 64468 ssh2
Nov 30 10:47:05 localhost sshd[32441]: Received disconnect from 210.21.225.202: 11: Bye Bye
Nov 30 10:47:08 localhost sshd[32444]: Address 210.21.225.202 maps to sym.gdsz.cncnet.net, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!
Nov 30 10:47:08 localhost sshd[32444]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=210.21.225.202 user=root
Nov 30 10:47:10 localhost sshd[32444]: Failed password for root from 210.21.225.202 port 65319 ssh2
Nov 30 10:47:10 localhost sshd[32445]: Received disconnect from 210.21.225.202: 11: Bye Bye
SSH brute force prevent
1. 패스워드를 누구도 상상할 수 없는 엄청난 조합으로 만드는 것입니다. ^^
2. prevent 같은 방어 툴을 사용합니다.
3. iptables 로 수시로 접속을 시도하는 패킷에 대해 차단합니다.
4. ssh 포트를 변경하고, iptables 로 포트 스캔도 막습니다. (포트 변경 만으로도 방어가 가능한 것 같습니다.)
ssh port 변경
1. ssh 설정 파일 수정
# vi /etc/ssh/sshd_config
Port 32
PermitRootLogin no
Port 32
PermitRootLogin no
2. iptables 수정
# dport 32 accept
/sbin/iptables -A INPUT -p tcp --sport 1024: --dport 32 -m state --state NEW -j ACCEPT
/sbin/iptables -A INPUT -p tcp --sport 1024: --dport 32 -m state --state NEW -j ACCEPT
3. iptables 적용 / ssh 재시작
# /etc/init.d/iptables save && /etc/init.d/sshd restart
WRITTEN BY
- 손가락귀신
정신 못차리면, 벌 받는다.
,