KOROMOON

착한 사마리아인이 되고 싶습니다.

7/24/2018

[CVE-2018-1000207] MODX Revolution < 2.6.4 원격실행코드 취약점


( 1 ) 취약점 정보


[CVE-2018-1000207] MODX Revolution < 2.6.4 원격실행코드 취약점은 phpthumb 클래스로 전달하기 전에 사용자 매개변수 필터링에서 잘못된 액세스 제어 취약점이 발생하여 악의적인 코드 실행이 가능함.
여기서 MODX Revolution 은 PHP 언어로 짜여진 오픈소스 CMS 프로그램임.
홈페이지 : http://modx.com


2018년 07월 18일에 관련 POC가 공개되어 스캔 시도되고 있음.
공개된 POC 링크 :
https://www.exploit-db.com/exploits/45055/



( 2 ) 취약점 분석


phpthumb 클래스에는 public 과 private 이렇게 두 가지 유형의 매개 변수가 있음.
public 매개 변수는 미리보기 생성에 사용되며 높이, 너비, 품지, 자르기, 워터 마크 등 임.
private 매개 변수는 하드 코드로 되어 있고 구성 파일에 정의되며 디버그 모드, 캐시 디렉토리 설정 등 임.


그러나 modxphpthumb.class.php 요청을 보내는 데 사용되는 파일 phpthumb.class.php 은 public 매개 변수와 private 매개 변수의 차이가 없으며 모든 것을 전송할 수 없음.
문제는 모든 사용자 요청이 $this->config 로 진행되고 있으며 setParameter() 함수를 통해 phpthumb 에 들어감.
phpthumb 매개 변수를 모두 사용하면 모든 PHP 파일을 업로드할 수 있음.



( 3 ) 취약점 방어 및 탐지

MODX Revolution 2.6.5 버전으로 패치시킴.

Snort 룰은 아래와 같이 적용시켜 탐지할 것!!!
해당 룰은 URL 정보 /connectors/system/phpthumb.php 와 HTTP Body 정보 ctx=web&cache_filename=../ 입력 시 탐지됨.
KOROMOON_MODX_Revolution_RCE_Exploit
alert tcp any any -> any any (msg:"KOROMOON_MODX_Revolution_RCE_Exploit"; uricontent:"/connectors/system/phpthumb.php"; content:"ctx=web&cache_filename=../";)



참고 사이트 :
http://blog.nsfocus.net/cve-2018-1000207/
https://forums.modx.com/thread/104040/revolution-2-6-4-and-prior-two-cricital-vulnerabilities-upgrade-mandatory-patch#dis-post-559515
https://rudnkh.me/posts/critical-vulnerability-in-modx-revolution-2-6-4



============================================================
본 게시물은 KOROMOON 님께서 작성하였으며 CCL (Creative Commons License) 에서 "저작자표시-비영리-동일조건변경허락" 이용조건으로 자료를 이용하셔야 합니다.

댓글 없음:

댓글 쓰기