Discovery / credits: Malvuln (John Page aka hyp3rlinx) (c) 2024 Original source: https://malvuln.com/advisory/b8e1e5b832e5947f41fd6ae6ef6d09a1.txt Contact: malvuln13@gmail.com Media: twitter.com/malvuln Threat: Backdoor.Win32 Carbanak (Anunak) Vulnerability: Named Pipe Null DACL Family: Carbanak Type: PE32 MD5: b8e1e5b832e5947f41fd6ae6ef6d09a1 Vuln ID: MVID-2024-0667 Dropped files: AlhEXlUJ.exe, AlhEXlUJbVpfX1EMVw.bin Disclosure: 01/09/2024 Description: Carbanak malware creates 8 named pipes used for C2 and interprocess communications and grants RW access to the Everyone user group. Low privileged users can modify the pipes DACLs, removing rights for Everyone denying access to all users. First 6 pipes are created by its parent process and last 2 by the child process. The pipes names are randomly generated each time it is run all except for one JFNfVUYDXmlZQV. Therefore, we can detect Carbanak by that one pipe, as the "JFNfVUYDXmlZQVI" pipe is always created regardless of other randomly named pipes. Listing Carbanaks named pipes they get grouped as they are created at same time with 2 of them listed prior to the JFNfVUYDXmlZQVI pipe. Carbanak creates a directory named "Mozilla" under ProgramData with hidden files, one of which is AlhEXlUJ.exe used by the service it creates which runs as SYSTEM. The malwares service names created seem to use an already existing service name and add "Sys" at the end of its name. Exploitation steps, output all named pipes and look for "JFNfVUYDXmlZQVI" if detected, exploit the DACL on 2 previously listed pipes and 5 pipes listed after. Successfully tested in VM environment. Carbanak IPC Named Pipes: \\.\Pipe\cltjLnYRKKjUESTvgGdmERTb RW Everyone \\.\Pipe\tGYNSgZvVXwumEhdcF RW Everyone \\.\Pipe\JFNfVUYDXmlZQVI <===== ALWAYS CREATED RW Everyone \\.\Pipe\PoUXbOHFRuUZAufnlpMZoqdtIfOX RW Everyone \\.\Pipe\oBcVHguxbnjGbSgkJptifqvNFgD RW Everyone \\.\Pipe\iDToHxpSCbEIEHPBeQ RW Everyone \\.\Pipe\YutsGUYwwUusszByeuXUQK RW Everyone \\.\Pipe\UfnQmAUTVtEkYvMoUWAZekAuWZHe RW Everyone Exploit/PoC: #include "windows.h" #include "stdio.h" #include "accctrl.h" #include "aclapi.h" /* Carbanak: 48d208b87b29d50bb160f336c94b681e232b0f90e8c02175e593d60737369c13 DACL IPC named pipes created and grants RW access for Everyone. We can identify Carbanak as out of the eight pipes it creates with random names the pipe named JFNfVUYDXmlZQVI is always created. Pipes are typically grouped as they are created at same time and typically 2 are previous to pipe JFNfVUYDXmlZQVI and others are created after Output named pipes find JFNfVUYDXmlZQVI and exploit DACL on 2 previous and 5 after. Successfully tested in VM environment. By Malvuln **/ /** DISCLAIMER: Author is NOT responsible for any damages whatsoever by using this software or improper malware handling. By using this code you assume and accept all risk implied or otherwise. **/ #define CARBANAK_PIPE "JFNfVUYDXmlZQVI" #define MAX_TOKENS 1024 #define DELIMITER "\n" int str2Array(char*** argv, char *str); int Exploit(char *carbanak_pipe); int str2Array(char*** argv, char *str){ char* buffer; int argc; buffer = (char *) malloc(strlen(str) * sizeof(char)); strcpy(buffer, str); (*argv) = (char**) malloc(MAX_TOKENS * sizeof(char**)); argc = 0; (*argv)[argc++] = strtok(buffer, DELIMITER); while ((((*argv)[argc] = strtok(NULL, DELIMITER)) != NULL) && (argc < MAX_TOKENS)) ++argc; return argc; } int main(void){ system("dir /b \\\\.\\pipe\\\\ > tmp.sys"); int ch; char tmp[1]; FILE *fp = fopen("tmp.sys", "r"); fseek(fp, 0, SEEK_END); int bytes = ftell(fp) + 256; rewind(fp); char x[bytes]; while((ch = fgetc(fp)) != EOF){ if(feof(fp)){ break; } sprintf(tmp, "%c", ch); strcat(x, tmp); } fclose(fp); char **A; int i, result = str2Array(&A, x); int delay = 300; int rc; BOOL infected=FALSE; for(i=0;i %s\n", MALPIPE_PREFIX); } LocalFree(pNewDACL); LocalFree(pOldDACL); CloseHandle(hPipe); return 0; } Disclaimer: The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise. Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information or exploits by the author or elsewhere. Do not attempt to download Malware samples. The author of this website takes no responsibility for any kind of damages occurring from improper Malware handling or the downloading of ANY Malware mentioned on this website or elsewhere. All content Copyright (c) Malvuln.com (TM).