본문 바로가기
CVE

Elastix 2.2.0 - 'graph.php' Local File Inclusion 분석 :: With Hack The Box[Beep]

by Ate1es 2021. 10. 12.

Hack The Box 라는 사이트는 IP하나만 주어지는 워게임이다. 실제 침투테스트를 하는 것 같이 느껴져서 실습이 더욱 재밌고, 기억에 남는 것 같다 [ 물론 더많은 삽질을 요구한다 ㅎ..]

 

https://www.hackthebox.eu/ 

 

Hacking Training For The Best

From beginners to experts, this is where hackers level up! Join today and learn how to hack.

www.hackthebox.eu

해당 사이트의 Common application Track 들을 웹 모의 침투 테스트처럼 풀어보려한다. 

 

https://attack.mitre.org/

 

MITRE ATT&CK®

MITRE ATT&CK® is a globally-accessible knowledge base of adversary tactics and techniques based on real-world observations. The ATT&CK knowledge base is used as a foundation for the development of specific threat models and methodologies in the private se

attack.mitre.org

mitre 사의 Att&ck Framwork 를 참고하여, 침투를 진행하겠다.

 

해당 Framwork는 침투 시 단계별로 사용되는 기술이나 공격방법들을 Matrix 형태로 표현해준다. 해당 단계에 맞춰 진행해보겠다.

 

1. Reconnaissance

 

NMAP 을 통해 진행했으며, 정찰 결과 

 

다음과 같았다. 가장무난한 80번 포트를 통해 접속하자, 443(https)접속으로 redirect 되었다.

 

나오는 페이지는 elasitx의 Login Page였다. [ 찾아보니 회사에서 쓰는 전화 관련 소프트웨어인듯 싶었다 ]

SQLMAP 점검 결과 sql injection은 먹히지 않았고, 그럼 두 번째

 

2. Resource Development -> Obtain Capabilities -> Vulnerabilities

 

Mitre Att&CK Framwork 에 따라

방향을 틀어, elastix 자체 취약점을 찾는 데 돌입했다. 그 결과

https://www.exploit-db.com/exploits/37637

 

Elastix 2.2.0 - 'graph.php' Local File Inclusion

Elastix 2.2.0 - 'graph.php' Local File Inclusion EDB-ID: 37637 CVE: N/A Date: 2012-08-17

www.exploit-db.com

LFI 취약점이 존재하는 버전이 있었다. 해당 exploit 코드를 살펴보면,

 

해당 취약한 서버 - > https://IP/vtigercrm/graph.php 라는 파일에서 사용자의 입력값을 적절히 검증하지 않아 발생하는 취약점으로 보인다.

 

해당 Exploit Code 에 있는 값을 그대로 서버에 던져보겠다.

PAYLOAD :

https://10.10.10.7/vtigercrm/graph.php?current_language=../../../../../../../..//etc/passwd%00&module=Accounts&action

LFI 취약점이 터졌다.

 

PAYLOAD :

https://10.10.10.7/vtigercrm/graph.php?current_language=../../../../../../../..//etc/amportal.conf%00&module=Accounts&action

 

여기서 불러오는 파일인 amportal.conf 는 FreePBX의 파일이다. [ 해당 설정 파일엔 USER_PASSWORD같은 값이 설정된다. ]

해당 설정 파일에는  ARI_ADMIN_PASSWORD="""""""""인 ADMIN의 패스워드 값으로 보이는 것이 존재했다.

해당 비밀번호를 가지고 ssh로 접속을 시도했다.

해당 비밀번호는 root 계정의 ssh 접속 비밀번호와 동일했고, 곧 바로 root 권한의 쉘이 열렸다.