{"id":91276,"date":"2023-01-25T18:16:41","date_gmt":"2023-01-25T12:46:41","guid":{"rendered":"https:\/\/blogs.quickheal.com\/?p=91276"},"modified":"2023-06-16T16:56:06","modified_gmt":"2023-06-16T11:26:06","slug":"asyncrat-analysis-with-chatgpt","status":"publish","type":"post","link":"https:\/\/www.quickheal.com\/blogs\/asyncrat-analysis-with-chatgpt\/","title":{"rendered":"AsyncRAT Analysis with ChatGPT"},"content":{"rendered":"<p>&nbsp;<\/p>\n<p>As cyber threats continue to evolve and become more sophisticated, it&#8217;s crucial for security researchers and professionals to stay ahead of the curve. In this post,<\/p>\n<p>\u2981 We will explore how ChatGPT can assist in the analysis of malware, specifically the <a href=\"https:\/\/blogs.quickheal.com\/technical-analysis-java-rat-remote-access-trojan-malware-2\/\">Remote Access Trojan<\/a> (RAT) known as AsyncRAT and,<br \/>\n\u2981 We will also delve into the capabilities of ChatGPT and talk about how it can assist in identifying indicators of compromise, by analyzing network traffic, and uncovering command and control (C2) infrastructure.<\/p>\n<p>But before moving ahead, a brief introduction to ChatGPT.<\/p>\n<p>Driven by artificial intelligence (AI) <a href=\"https:\/\/chat.openai.com\/chat\">ChatGPT<\/a> was introduced in November 2022 by OpenAI as a prototype programmed to answer long form, complex questions. What is revolutionary about ChatGPT is that it is trained to learn about the meaning behind questing being asked. As a result of which, the responses reported are distinctly human-like. At this point, it remains debatable whether ChatGPT is going to support or pose as a challenge in the fight against cyber-crime, but for now, let us focus on ChatGPT and its malware analyzing capabilities.<\/p>\n<p>So, whether you&#8217;re a seasoned security professional or just getting started in the field, this post will provide valuable insights into the use of advanced language models in malware analysis.<\/p>\n<p>Let\u2019s get started!<\/p>\n<p>In order to understand the power and capabilities of ChatGPT, we began with analyzing AsyncRAT.\u00a0 We were curious to see how this cutting-edge AI technology could aid in uncovering the inner workings of this malware, and potentially assist in identifying indicators of compromise, by analyzing network traffic, and uncovering command and control (C2) infrastructure.<br \/>\nAs a result of our research, we came across the following code snippet which acts as a stage 1 loader for AsyncRAT and contains a lot of obfuscation and a base64 encoded string. The code is written in Python and utilizes the Common Language Runtime (CLR) library to interact with the .NET Framework, loading and running an assembly encoded in base64.<br \/>\nFurther into the research, we discovered that ChatGPT could be incredibly useful in analyzing malware such as AsyncRAT, but also found that it still has limitations in certain areas. Nonetheless, we feel that the use of advanced language models like ChatGPT in malware analysis is a promising development in the fight against cyber threats.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91278\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/1-300x115.png\" alt=\"\" width=\"720\" height=\"276\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/1-300x115.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/1-650x249.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/1-768x295.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/1-789x303.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/1.png 1243w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>Here, we have decided to give this code as an input to ChatGPT and get some insight about the code.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91279\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/2-300x187.png\" alt=\"\" width=\"717\" height=\"447\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/2-300x187.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/2-626x390.png 626w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/2-768x478.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/2-789x491.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/2.png 1166w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91280\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/3-300x217.png\" alt=\"\" width=\"718\" height=\"519\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/3-300x217.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/3-538x390.png 538w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/3.png 995w\" sizes=\"(max-width: 718px) 100vw, 718px\" \/><\/p>\n<p>The code provided, uses a base64 encoded string that ChatGPT was unable to decode due to its string length limit and limitations on the actions it is allowed to perform. However, ChatGPT was still able to provide a simplified and understandable explanation of the code&#8217;s functionality and potential malicious intent. It is important to note that ChatGPT is a powerful language model but it should be used in conjunction with other methods and techniques and is not a silver bullet for all tasks related to malware analysis.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91281\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/4-300x144.png\" alt=\"\" width=\"727\" height=\"349\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/4-300x144.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/4-650x312.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/4-768x368.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/4-789x378.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/4.png 972w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91282\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/5-300x152.png\" alt=\"\" width=\"724\" height=\"367\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/5-300x152.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/5-650x330.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/5-768x390.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/5-789x400.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/5.png 948w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/p>\n<p>That is why we have used Cyberchef to decode the base64 string, which turns out to be stage two loader python script.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91283\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/6-300x159.png\" alt=\"\" width=\"721\" height=\"382\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/6-300x159.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/6-650x345.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/6-768x407.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/6-1536x815.png 1536w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/6-789x419.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/6.png 1540w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91284\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/7-300x257.png\" alt=\"\" width=\"725\" height=\"621\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/7-300x257.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/7-456x390.png 456w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/7-768x657.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/7-789x675.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/7.png 983w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>We gave this code as an input to ChatGPT again to see what it can tell me about it,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91285\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/8-300x153.png\" alt=\"\" width=\"726\" height=\"370\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/8-300x153.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/8-650x330.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/8-768x390.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/8-789x401.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/8.png 1009w\" sizes=\"(max-width: 726px) 100vw, 726px\" \/><\/p>\n<p>Again,we have a long base64 encoded string which we had to decode using Cyberchef.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91286\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/9-300x159.png\" alt=\"\" width=\"721\" height=\"382\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/9-300x159.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/9-650x345.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/9-768x408.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/9-789x419.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/9.png 1535w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><\/p>\n<p>This string turns out to be a PE file. We cannot pass the PE file to ChatGPT so there was no help as such from the PE file analysis perspective. But we decided to go ahead and see what the PE file has in it.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91287\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/10-245x300.png\" alt=\"\" width=\"720\" height=\"882\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/10-245x300.png 245w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/10-318x390.png 318w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/10.png 712w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>We will use Dnspy to decompile this binary.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91288\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/11-300x138.png\" alt=\"\" width=\"724\" height=\"333\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/11-300x138.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/11-650x299.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/11-768x353.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/11-1536x707.png 1536w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/11-789x363.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/11.png 1900w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/p>\n<p>As you can see, the output of the base64 decode function is passed as an input to a Decompress function.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91289\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/12-300x187.png\" alt=\"\" width=\"741\" height=\"462\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/12-300x187.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/12-626x390.png 626w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/12-768x479.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/12-789x492.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/12.png 1032w\" sizes=\"(max-width: 741px) 100vw, 741px\" \/><\/p>\n<p>The above code is a C# function that appears to be decompressing a byte array called &#8220;gzip&#8221;. The function uses the GZipStream class to create a new stream and pass it a MemoryStream object that is constructed with the &#8220;gzip&#8221; byte array. The GZipStream is then used to read the compressed data in 4096 byte chunks and write it to a new MemoryStream object. The function then returns the decompressed data as a byte array using the ToArray method of the MemoryStream object.<\/p>\n<p>In simpler terms, this function takes in a compressed byte array, decompresses it using Gzip algorithm, and returns the decompressed data as a byte array. This function can be used to decompress data that has been previously compressed using Gzip algorithm.<\/p>\n<p>We again decided to use Cyberchef to decode this thing,<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91290\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/13-300x140.png\" alt=\"\" width=\"726\" height=\"339\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/13-300x140.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/13-650x304.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/13-768x360.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/13-1536x719.png 1536w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/13-789x369.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/13.png 1544w\" sizes=\"(max-width: 726px) 100vw, 726px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Which again was a PE file, which when analyzed was a .NET assembly. We used Dnspy to analyze it.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91291\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/14-300x72.png\" alt=\"\" width=\"721\" height=\"173\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/14-300x72.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/14-650x156.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/14-768x184.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/14-789x190.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/14.png 1199w\" sizes=\"(max-width: 721px) 100vw, 721px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>This binary has base64 encoded string, but if you see the last word carefully, you\u2019ll get an idea that the base64 string will turn out to be a powershell script when decoded.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91292\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/15-300x122.png\" alt=\"\" width=\"720\" height=\"293\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/15-300x122.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/15-650x265.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/15-768x313.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/15-789x322.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/15.png 1398w\" sizes=\"(max-width: 720px) 100vw, 720px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>As you can see, the powershell is very much obfuscated, so we decided to check if ChatGPT can decode it for us. Below is the output.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91293\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/16-300x213.png\" alt=\"\" width=\"727\" height=\"516\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/16-300x213.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/16-550x390.png 550w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/16-768x544.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/16-789x559.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/16.png 916w\" sizes=\"(max-width: 727px) 100vw, 727px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91294\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/17-300x222.png\" alt=\"\" width=\"724\" height=\"536\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/17-300x222.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/17-528x390.png 528w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/17-768x568.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/17-789x583.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/17.png 836w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>When asked what could be the functionality of such a script, the output received is as shown below.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91295\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/18-300x193.png\" alt=\"\" width=\"724\" height=\"466\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/18-300x193.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/18-607x390.png 607w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/18-768x493.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/18-789x507.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/18.png 886w\" sizes=\"(max-width: 724px) 100vw, 724px\" \/><\/p>\n<p>There is one more base64 encoded string in the .NET assembly. Which is first passed to a function called cipher with a parameter that is a key to the cipher.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91296\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/19-300x13.png\" alt=\"\" width=\"715\" height=\"31\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/19-300x13.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/19-650x29.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/19-789x35.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/19.png 1023w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91297\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/20-300x34.png\" alt=\"\" width=\"715\" height=\"81\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/20-300x34.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/20.png 387w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>So we decided to take a look at what was the logic of Cipher function.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91298\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/21-300x236.png\" alt=\"\" width=\"725\" height=\"570\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/21-300x236.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/21-495x390.png 495w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/21-768x605.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/21-789x621.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/21.png 1012w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>Now, we decided to give this code as an input to ChatGPT and asked it to identify the cipher.<br \/>\nThis output surprised us.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91299\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/22-300x186.png\" alt=\"\" width=\"711\" height=\"441\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/22-300x186.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/22-630x390.png 630w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/22-768x475.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/22-789x488.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/22.png 929w\" sizes=\"(max-width: 711px) 100vw, 711px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>We implemented the same logic in python, in order to get the next stage.<br \/>\nThis was the output. A final PE file:-<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91300\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/23-300x142.png\" alt=\"\" width=\"710\" height=\"336\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/23-300x142.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/23-650x307.png 650w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/23-768x363.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/23-789x373.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/23.png 1531w\" sizes=\"(max-width: 710px) 100vw, 710px\" \/><\/p>\n<p>This again is a .NET file. When checked in Dnspy, here is what we get.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91301\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/24-300x243.png\" alt=\"\" width=\"709\" height=\"574\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/24-300x243.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/24-481x390.png 481w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/24-768x623.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/24-789x640.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/24.png 912w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91302\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/25-300x252.png\" alt=\"\" width=\"711\" height=\"597\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/25-300x252.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/25-464x390.png 464w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/25-768x646.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/25-789x663.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/25.png 922w\" sizes=\"(max-width: 711px) 100vw, 711px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>By looking at the function we get a fair idea of the functionality of this file, which is its Anti-analysis techniques and registry functions and stuff like that. We were curious to know if ChatGPT would understand the purpose of this code and identify what type of malware it was.<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91303\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/26-300x234.png\" alt=\"\" width=\"715\" height=\"558\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/26-300x234.png 300w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/26-501x390.png 501w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/26-768x598.png 768w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/26-789x615.png 789w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/26.png 1019w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>The key function in the code is the &#8220;Install&#8221; method which appears to be responsible for installing and running the specified file on startup.<br \/>\nThe &#8220;FileInfo&#8221; object is used to specify the file that the code is trying to install and run.<br \/>\nThe &#8220;Process.GetCurrentProcess().MainModule.FileName&#8221; and &#8220;fileInfo.FullName&#8221; are used to check if the currently running process is the same as the specified file.<br \/>\nThe &#8220;Process.GetProcesses()&#8221; method is used to get a list of all running processes and the code iterates through them to stop any processes that has the same file path as the specified file.<br \/>\nThe &#8220;Methods.IsAdmin()&#8221; method is used to check if the user has admin privileges.<br \/>\nThe &#8220;schtasks&#8221; command is used to create a scheduled task to run the specified file on logon (if the user has admin privileges).<br \/>\nThe &#8220;Registry.CurrentUser.OpenSubKey&#8221; method is used to open the HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run key and the &#8220;registryKey.SetValue&#8221; method is used to set the value of the key to the file path of the specified file (if the user does not have admin privileges).<br \/>\nThe &#8220;File.Exists&#8221; method is used to check if the specified file already exists and the &#8220;File.Delete&#8221; method is used to delete it if it does.<br \/>\nThe &#8220;FileStream&#8221; object is used to create a new file at the specified file path and write the contents of the current running process&#8217;s file to it.<br \/>\nThe &#8220;Methods.ClientOnExit()&#8221; method is executed.<br \/>\nThe &#8220;Path.GetTempFileName()&#8221; method is used to create a temporary .bat file and the &#8220;StreamWriter&#8221; object is used to write a series of commands to it.<br \/>\nThe &#8220;Process.Start&#8221; method is used to start the .bat file and the &#8220;Environment.Exit(0)&#8221; method is used to exit the current process.<\/p>\n<p>From this code, it can be inferred that the code is trying to install and run a specific file on startup, and it seems to be designed to make sure that the specified file is running on startup and that it is running with administrative privileges. The code also tries to delete the original file and create a new one with the same name and content, which might indicate that it&#8217;s trying to replace the original file with a malicious version. The use of methods to check if the user has admin privileges, scheduled task creation and registry key modification indicates that it is trying to run the file on startup in any scenario possible. Also, the use of various methods to hide the execution of the file, such as creating a bat file, running it in hidden mode, and deleting the bat file after execution, indicates that the code is hiding its execution from the end user.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-91304\" src=\"https:\/\/blogs.quickheal.com\/wp-content\/uploads\/2023\/01\/Last-269x300.png\" alt=\"\" width=\"717\" height=\"800\" srcset=\"https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/Last-269x300.png 269w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/Last-350x390.png 350w, https:\/\/www.quickheal.com\/blogs\/wp-content\/uploads\/2023\/01\/Last.png 642w\" sizes=\"(max-width: 717px) 100vw, 717px\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>It was able to understand the code is malicious and was correctly able to identify it as a RAT.<\/p>\n<p>By this exercise, we were able to decipher ChatGPT much better and understand how it can assist in malware analysis. While ChatGPT has demonstrated it\u2019s basic capabilities on this front, at this time it is no match for the human intelligence driven malware analysis \u2013 which is much more capable and holistic. We would continue to keep an eye on the ChatGPT and would share further updates as it augments it\u2019s capabilities and powers in times to come.<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp; As cyber threats continue to evolve and become more sophisticated, it&#8217;s crucial for security researchers and professionals to stay ahead of the curve. In this post, \u2981 We will explore how ChatGPT can assist in the analysis of malware, specifically the Remote Access Trojan (RAT) known as AsyncRAT and, \u2981 We will also delve [&hellip;]<\/p>\n","protected":false},"author":103,"featured_media":91277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[1952,1951,1953,1954,1955,1362,534,58,49,50],"class_list":["post-91276","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-asyncrat","tag-chatgpt","tag-malwareattack","tag-quickhealsolutions","tag-securityupdate","tag-cybercrime","tag-cybersecurity","tag-hacking","tag-malware","tag-ransomware"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/91276"}],"collection":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/users\/103"}],"replies":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/comments?post=91276"}],"version-history":[{"count":6,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/91276\/revisions"}],"predecessor-version":[{"id":91366,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/posts\/91276\/revisions\/91366"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media\/91277"}],"wp:attachment":[{"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/media?parent=91276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/categories?post=91276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.quickheal.com\/blogs\/wp-json\/wp\/v2\/tags?post=91276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}