{"id":1168,"date":"2022-01-10T18:07:26","date_gmt":"2022-01-10T17:07:26","guid":{"rendered":"https:\/\/lab52.io\/blog\/?p=1168"},"modified":"2022-01-25T11:39:14","modified_gmt":"2022-01-25T10:39:14","slug":"tokyox-dll-side-loading-an-unknown-artifact","status":"publish","type":"post","link":"https:\/\/lab52.io\/blog\/tokyox-dll-side-loading-an-unknown-artifact\/","title":{"rendered":"TokyoX: DLL side-loading an unknown artifact"},"content":{"rendered":"\n<p>During Christmas holidays, Lab52 has been analyzing a sample which loads an artifact that we have decided to refer to as \u201cTokyoX\u201d since no similarities have been found as to any known malware, which we usually detect in open sources. However, we cannot confirm so far that it is indeed a new family of malware.<\/p>\n\n\n\n<p>The first thing we identified was a DLL <br>(382b3d3bb1be4f14dbc1e82a34946a52795288867ed86c6c43e4f981729be4fc) which had the following timestamps in VirusTotal at the time of the current analysis, and was uploaded from Russia via web site:<\/p>\n\n\n\n<p class=\"has-text-align-center\">Creation Time 2021-12-09 02:46:43<br>First Submission 2021-12-09 08:48:20<br>Last Submission 2021-12-09 08:48:20<br>Last Analysis 2021-12-23 23:38:08<\/p>\n\n\n\n<p>Some antivirus engines tagged the sample as PlugX, but it seems that the attribution might be due to the final payload\u2019s loading mechanism: DLL sideloading with an encrypted payload in the same directory. After analyzing the final payload we could not find any similarities with other known samples from PlugX other than the loading TTPs.<\/p>\n\n\n\n<p>This DLL had a related .zip file with the name \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435.zip (translated to as planning.zip). When unzipping, the following files are observed:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"228\" height=\"81\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/00.png\" alt=\"\" class=\"wp-image-1169\"\/><\/figure><\/div>\n\n\n\n<p>The legitimate file Creative.exe, an encrypted Data file and the version.dll DLL, which implements the loader function for the Data file, and therefore responsible of mapping the \u201cTokyoX\u201d.<\/p>\n\n\n\n<p>If we execute it from a path which is not final or the expected by the malware, it replicates to another path and executes from there, which is something it does have in common with some PlugX dll loaders:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"953\" height=\"232\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/01.png\" alt=\"\" class=\"wp-image-1170\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/01.png 953w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/01-300x73.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/01-768x187.png 768w\" sizes=\"(max-width: 953px) 100vw, 953px\" \/><\/figure><\/div>\n\n\n\n<p>Once executed, we observe how the netsh.exe process tries to establish connections with port 443 of the IP address 31.192.107[.]187.<\/p>\n\n\n\n<p>In this analysis we will focus on different aspects about the process; from double-clicking the binary 123.exe process (which is a copy of Creative.exe but in another path) to the execution of \u201cTokyoX\u201d already decrypted in memory.<\/p>\n\n\n\n<p>The first thing we observe within the process is how the version.dll library prepares the decryption and the final payload\u2019s loading in the remote process:<\/p>\n\n\n\n<p>In fact, we can see how the content of the Data file is read in the code section of version.dll:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"387\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/02-1024x387.png\" alt=\"\" class=\"wp-image-1171\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/02-1024x387.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/02-300x113.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/02-768x290.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/02.png 1299w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>If we edit the Data file with a hexadecimal editor we will see their values, which will help us to identify it in memory later (beginning with E3 84):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"649\" height=\"311\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/03.png\" alt=\"\" class=\"wp-image-1172\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/03.png 649w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/03-300x144.png 300w\" sizes=\"(max-width: 649px) 100vw, 649px\" \/><\/figure><\/div>\n\n\n\n<p>After reading the file from disk, a child process netsh.exe is created. This just-created child process is where several new memory segments will be located (a total of 5, including the final decrypted payload) to decrypt the final \u201cTokyoX\u201d payload. The APIs which were observed for the creation and writing of the remote process are the native APIs NtAllocateVirtualmemory and NtwriteVirtualmemory.<\/p>\n\n\n\n<p>First, it creates two segments: 100Kb where the encrypted payload is located and which comes from the disc, and another one of 4Kb. In the 4Kb segment we observe how the following string is set (which will be the string used for the decrypting process):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"292\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/04-1024x292.png\" alt=\"\" class=\"wp-image-1173\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/04-1024x292.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/04-300x85.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/04-768x219.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/04.png 1151w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>The other memory segment of 100Kb contains the following (encrypted content, as we see how it matches the content from Data file on Disk):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"784\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/05-1024x784.png\" alt=\"\" class=\"wp-image-1174\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/05-1024x784.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/05-300x230.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/05-768x588.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/05.png 1139w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>After the creation of these two segments, a third segment is allocated, where it is loaded the absolute memory addresses from several win32 APIs (VirtualAlloc, LoadLibrary, GetProcAddress, the home address of the coded payload, etc.) for its later use by the loader:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"592\" height=\"354\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/06.png\" alt=\"\" class=\"wp-image-1175\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/06.png 592w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/06-300x179.png 300w\" sizes=\"(max-width: 592px) 100vw, 592px\" \/><\/figure><\/div>\n\n\n\n<p>We can notice how the segment will have the memory addresses (starting from 123.exe they are located in netsh.exe segment through the version.dll code):<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"131\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/07-1024x131.png\" alt=\"\" class=\"wp-image-1176\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/07-1024x131.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/07-300x38.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/07-768x98.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/07-1536x196.png 1536w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/07.png 1690w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>Then, another segment of 4Kb is created where it loads the code that will decrypt and load the final payload.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1014\" height=\"832\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/08.png\" alt=\"\" class=\"wp-image-1177\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/08.png 1014w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/08-300x246.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/08-768x630.png 768w\" sizes=\"(max-width: 1014px) 100vw, 1014px\" \/><\/figure><\/div>\n\n\n\n<p>Finally, the \u201cTokyoX\u201d loader runs from the DLL (version.dll) in netsh.exe through the API NtcreateThreadEx and we see the start of the last page created in the stack:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"476\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/09-1024x476.png\" alt=\"\" class=\"wp-image-1178\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/09-1024x476.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/09-300x140.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/09-768x357.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/09.png 1301w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>After the execution of NtCreateThreadEx, as indicated, the loader is initiated in netsh.exe in the segment:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"316\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/10.png\" alt=\"\" class=\"wp-image-1179\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/10.png 600w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/10-300x158.png 300w\" sizes=\"(max-width: 600px) 100vw, 600px\" \/><\/figure><\/div>\n\n\n\n<p>Once the execution is moved to the netsh.exe process, it takes the string located in the initial 4Kb segment, copies it into the stack and replicates it (0x100, 256 bytes) to match the specific block size of 256bytes. In the following screenshots we can observe how the block ends with the string \u201c!Up?\u201d when it reaches the value 0x100 in hexadecimal.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"384\" height=\"212\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/11.png\" alt=\"\" class=\"wp-image-1180\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/11.png 384w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/11-300x166.png 300w\" sizes=\"(max-width: 384px) 100vw, 384px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"277\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/12.png\" alt=\"\" class=\"wp-image-1181\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/12.png 576w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/12-300x144.png 300w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/figure><\/div>\n\n\n\n<p>After the block is created with the replicated string, the values from 00 to FF are found and used for the decrypting process.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"650\" height=\"675\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/13.png\" alt=\"\" class=\"wp-image-1182\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/13.png 650w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/13-289x300.png 289w\" sizes=\"(max-width: 650px) 100vw, 650px\" \/><\/figure><\/div>\n\n\n\n<p>At this point, the loader transforms the 00-FF block with a series of additions combining the replicated string\u2019s block with the 00-FF block, as we can see:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"648\" height=\"384\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/14.png\" alt=\"\" class=\"wp-image-1183\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/14.png 648w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/14-300x178.png 300w\" sizes=\"(max-width: 648px) 100vw, 648px\" \/><\/figure><\/div>\n\n\n\n<p>The combination of the blue block (in following image) and the 00-FF block (pointed in red in previous image) results in the following block in memory, marked in red in the image:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"857\" height=\"753\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/15.png\" alt=\"\" class=\"wp-image-1184\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/15.png 857w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/15-300x264.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/15-768x675.png 768w\" sizes=\"(max-width: 857px) 100vw, 857px\" \/><\/figure><\/div>\n\n\n\n<p>On the next step, the loader reads the initial argument, arg0, whose value is 0x900000 and points at the 4Kb block, which stores the absolute addresses to different API from Win32:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"512\" height=\"130\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/16.png\" alt=\"\" class=\"wp-image-1185\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/16.png 512w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/16-300x76.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\" \/><\/figure><\/div>\n\n\n\n<p>After this, the decrypting process for the final payload begins. The decrypting process gets two values from the second block, exchanges and adds them, and the result serves as a final index to recover the element from the second block with which the xor will be achieved through the coded block.<\/p>\n\n\n\n<p>This description of the decryption algorythm has been identified as the <strong>RC4 algorythm<\/strong>.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"777\" height=\"773\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/17.png\" alt=\"\" class=\"wp-image-1186\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/17.png 777w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/17-300x298.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/17-768x764.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/17-75x75.png 75w\" sizes=\"(max-width: 777px) 100vw, 777px\" \/><\/figure><\/div>\n\n\n\n<p>After the decryption process, we find a PE binary, as seen in the following image. In this case, the payload does not start with the traditional MZ header but the string \u201ctokyo\u201d:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"622\" height=\"782\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/18.png\" alt=\"\" class=\"wp-image-1188\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/18.png 622w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/18-239x300.png 239w\" sizes=\"(max-width: 622px) 100vw, 622px\" \/><\/figure><\/div>\n\n\n\n<p>Then, we see how it loads the VirtualAlloc absolute address (0x77211856) from the segment previously created:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"307\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/Screenshot-from-2022-01-10-16-37-59-1024x307.png\" alt=\"\" class=\"wp-image-1192\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/Screenshot-from-2022-01-10-16-37-59-1024x307.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/Screenshot-from-2022-01-10-16-37-59-300x90.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/Screenshot-from-2022-01-10-16-37-59-768x230.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/Screenshot-from-2022-01-10-16-37-59.png 1319w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>This creates another memory segment in the process netsh.exe with RWX licenses (that of 116Kb) which will be used to load the PE:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"89\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/20-1024x89.png\" alt=\"\" class=\"wp-image-1193\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/20-1024x89.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/20-300x26.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/20-768x66.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/20.png 1052w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>In this new segment, it maps the binary using the virtual addresses as the regular Windows PE loader would do.<\/p>\n\n\n\n<p>Then, it calls the API LoadLibraryA (it has the address since the DLL saved it in the memory segment) of the strings located in the mapped block:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"363\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/21-3-1024x363.png\" alt=\"\" class=\"wp-image-1198\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/21-3-1024x363.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/21-3-300x106.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/21-3-768x272.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/21-3.png 1108w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<p>Then it calls GetProcAddress() to get the addresses of certain functions:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"441\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/22-1024x441.png\" alt=\"\" class=\"wp-image-1197\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/22-1024x441.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/22-300x129.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/22-768x331.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/22.png 1149w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"456\" height=\"231\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/23.png\" alt=\"\" class=\"wp-image-1199\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/23.png 456w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/23-300x152.png 300w\" sizes=\"(max-width: 456px) 100vw, 456px\" \/><\/figure><\/div>\n\n\n\n<p>Next, the libraries and functions block may be appreciated:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"874\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/24.png\" alt=\"\" class=\"wp-image-1200\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/24.png 544w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/24-187x300.png 187w\" sizes=\"(max-width: 544px) 100vw, 544px\" \/><\/figure><\/div>\n\n\n\n<p>After the correct mapping and having loaded the necessary libraries for its proper functioning, it calls EAX to run the decrypted and mapped payload:<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"452\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/25-1024x452.png\" alt=\"\" class=\"wp-image-1201\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/25-1024x452.png 1024w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/25-300x133.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/25-768x339.png 768w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/25.png 1256w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"688\" height=\"210\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/26.png\" alt=\"\" class=\"wp-image-1202\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/26.png 688w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/26-300x92.png 300w\" sizes=\"(max-width: 688px) 100vw, 688px\" \/><\/figure><\/div>\n\n\n\n<p>To summarize, this article goes through the process followed in memory after executing the Creative Cloud application until deploying TokyoX in memory. This DLL sideloading style is often linked to APT groups whose attribution is also linked to China, however being a known technique as it is, we are not able to consider any feasible attribution at the moment.<\/p>\n\n\n\n<p>As reviewed at the beginning of the article, what we have named as \u201cTokyoX\u201d has not been identified as a known malware so far (at least, with the sources that we have).<\/p>\n\n\n\n<p>Additionally, at some point of the analysis we identified a tool used by this group for the creation of version.dll, which pretends to be a Windows DLL located in SysWOW\/System32. The string \u201cAheadLib\u201d found among the code of the malicious version.dll drew our attention, and we quickly found two chinese (casually or not) GitHub repositories with the source code of some tool called AheadLib.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"709\" height=\"290\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/27.png\" alt=\"\" class=\"wp-image-1203\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/27.png 709w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/27-300x123.png 300w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"592\" height=\"222\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/28.png\" alt=\"\" class=\"wp-image-1204\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/28.png 592w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/28-300x113.png 300w\" sizes=\"(max-width: 592px) 100vw, 592px\" \/><\/figure><\/div>\n\n\n\n<p>Basically, this tool will allow you to create a C++ source code file, implementing a DLL with the same exported functions as a given DLL. For the purpose of the current analysis we generated a source code file using this tool and giving the legitimate version.dll as input.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"939\" height=\"441\" src=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/29.png\" alt=\"\" class=\"wp-image-1205\" srcset=\"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/29.png 939w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/29-300x141.png 300w, https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/29-768x361.png 768w\" sizes=\"(max-width: 939px) 100vw, 939px\" \/><\/figure><\/div>\n\n\n\n<p>In the shown screenshot we can see on the left side the pseudocode generated by IDA Pro while analyzing the malicious version.dll sample. On the right side, we can observe the source code automatically generated by AheadLib using the legitimate version.dll as input. Even though the exported functions are not shown in the previous image, we can appreciate how there is a perfect match between both snippets.<\/p>\n\n\n\n<p>Read the second part of the analysis of the final \u201cTokyoX\u201d RAT and its capacities <a href=\"https:\/\/lab52.io\/blog\/tokyox-dll-side-loading-an-unknown-artifact-part-2\/\" data-type=\"URL\" data-id=\"https:\/\/lab52.io\/blog\/tokyox-dll-side-loading-an-unknown-artifact-part-2\/\">here<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>IOCs<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>382b3d3bb1be4f14dbc1e82a34946a52795288867ed86c6c43e4f981729be4fc<\/li><li>31.192.107[.]187:443<\/li><\/ul>\n\n\n\n<p>Customers with Lab52&#8217;s APT intelligence private feed service already have more tools and means of detection for this campaign.<br>In case of having threat hunting service or being client of S2Grupo CERT, this intelligence has already been applied.<\/p>\n\n\n\n<p>If you need more information about Lab52&#8217;s private APT intelligence feed service, you can contact us through the<a href=\"https:\/\/lab52.io\/contact\"> following link<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>During Christmas holidays, Lab52 has been analyzing a sample which loads an artifact that we have decided to refer to as \u201cTokyoX\u201d since no similarities have been found as to any known malware, which we usually detect in open sources. However, we cannot confirm so far that it is indeed a new family of malware. [&hellip;]<\/p>\n","protected":false},"author":14,"featured_media":1214,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[1],"tags":[],"class_list":{"0":"post-1168","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-uncategorised","8":"entry"},"featured_image_src":"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/Captura-de-pantalla-de-2022-01-10-18-09-44.png","featured_image_src_square":"https:\/\/lab52.io\/blog\/wp-content\/uploads\/2022\/01\/Captura-de-pantalla-de-2022-01-10-18-09-44.png","author_info":{"display_name":"ml10","author_link":"https:\/\/lab52.io\/blog\/author\/ml10\/"},"_links":{"self":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/1168"}],"collection":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/users\/14"}],"replies":[{"embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/comments?post=1168"}],"version-history":[{"count":7,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/1168\/revisions"}],"predecessor-version":[{"id":1317,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/posts\/1168\/revisions\/1317"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/media\/1214"}],"wp:attachment":[{"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/media?parent=1168"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/categories?post=1168"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lab52.io\/blog\/wp-json\/wp\/v2\/tags?post=1168"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}