{"id":7043,"date":"2023-09-19T07:27:06","date_gmt":"2023-09-19T07:27:06","guid":{"rendered":"https:\/\/fortgale.com\/blog\/?p=7043"},"modified":"2023-09-19T07:38:14","modified_gmt":"2023-09-19T07:38:14","slug":"agent-tesla-reverse-engineering","status":"publish","type":"post","link":"https:\/\/fortgale.com\/blog\/malware-analysis\/agent-tesla-reverse-engineering\/","title":{"rendered":"Agent Tesla Reverse Engineering"},"content":{"rendered":"\n<p>On January 24, 2023, Fortgale identified an <strong>Agent Tesla malware<\/strong> campaign being delivered via email to compromise the systems of Italian companies.<\/p>\n\n\n\n<p><br>In this technical article, we will analyze the behavior of the malware and how it compromised its victims through the analysis of code characteristics and collected data.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" src=\"https:\/\/pbs.twimg.com\/media\/FnOkMI5WAAIusQv?format=jpg&amp;name=large\" alt=\"Image\" title=\"email maleovla\" \/><figcaption class=\"wp-element-caption\"><em>Contenuto dell&#8217;E-Mail<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p>It has now become common practice to insert the email addresses of victims in the Bcc (blind carbon copy) field. The email text refers to a purchase order, and attached is a compressed archive in <strong>LZH<\/strong> format containing the executable file named <strong>ORDINE DI ACQUISTO N. BCM190282.exe<\/strong>.<\/p>\n\n\n\n<p>The executable has been identified as the Malware Agent Tesla, which, before compromising the system, initiates a series of checks and then proceeds to carry out data exfiltration activities on the victim&#8217;s system, collecting information about the system and browser passwords.<\/p>\n\n\n\n<p>If you need any further assistance or have additional text to translate, please let me know.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-malware-analysis\">Malware Analysis<\/h2>\n\n\n\n<p>To extract information and indicators useful for malware identification, the file <strong>ORDINE DI ACQUISTO N. BCM190282.exe <\/strong>has been analyzed.<\/p>\n\n\n\n<p>The executable is an EXE file based on the <strong>.NET<\/strong> framework containing encrypted and obfuscated modules in the form of resources that are loaded during execution.<\/p>\n\n\n\n<p>Through dedicated software, it was possible to decompile and subsequently deobfuscate the executable and the additional modules loaded at <em>runtime.<\/em><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Stage 1<\/h3>\n\n\n\n<p>In this first stage (the initialization of the legitimate software), the malware Agent Tesla is decrypted from the resources and loaded into memory. <\/p>\n\n\n\n<p>The malware relies on code from legitimate software to initiate its malicious functionality during the initialization of legitimate components.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Stage 2<\/h3>\n\n\n\n<p>Based on the configuration present in the sample, it&#8217;s possible that some functionalities are not utilized. For example, in the case of this sample, there is no check for the presence of the malware on the machine using <em>mutex<\/em> checks, the Sleep function is not called to extend the malware&#8217;s execution times and evade potential time-based sandbox detection methods, and no additional files are downloaded and executed.<\/p>\n\n\n\n<p><br>In the second stage, techniques for persistence, defense evasion, anti-debugging, and anti-sandbox are applied.<\/p>\n\n\n\n<p>After attempting to create an exclusion rule for the file in Microsoft Defender, the malware halts its execution if checks for the presence of a virtual machine (VMware, VirtualBox, QEMU), a specific user (machine name or username matching Sandbox, Virus, Malware, &#8230;), or a characteristic filename are successful.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"682\" height=\"101\" src=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image.png\" alt=\"\" class=\"wp-image-5894\" srcset=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image.png 682w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-300x44.png 300w\" sizes=\"(max-width: 682px) 100vw, 682px\" loading=\"lazy\" \/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"525\" src=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-1-1024x525.png\" alt=\"\" class=\"wp-image-5895\" srcset=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-1-1024x525.png 1024w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-1-300x154.png 300w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-1-768x393.png 768w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-1.png 1351w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" loading=\"lazy\" \/><\/figure>\n<\/div>\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-2-1024x166.png\" alt=\"\" class=\"wp-image-5896\" style=\"width:840px;height:136px\" width=\"840\" height=\"136\" srcset=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-2-1024x166.png 1024w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-2-300x49.png 300w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-2-768x125.png 768w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-2.png 1061w\" sizes=\"(max-width: 840px) 100vw, 840px\" loading=\"lazy\" \/><\/figure>\n<\/div>\n\n\n<p>Continuing with its activity, the malware creates a scheduled task to achieve persistence on the system.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"384\" src=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3-1024x384.png\" alt=\"\" class=\"wp-image-5897\" srcset=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3-1024x384.png 1024w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3-300x112.png 300w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3-768x288.png 768w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-3.png 1123w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" loading=\"lazy\" \/><\/figure>\n<\/div>\n\n\n<p>The last action executed involves extracting the final payload from the executable&#8217;s resources and executing it using Process Hollowing.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"779\" height=\"626\" src=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-4.png\" alt=\"\" class=\"wp-image-5898\" srcset=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-4.png 779w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-4-300x241.png 300w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-4-768x617.png 768w\" sizes=\"(max-width: 779px) 100vw, 779px\" loading=\"lazy\" \/><\/figure>\n<\/div>\n\n\n<p>Below is the main function where the malware&#8217;s configuration is evaluated, followed by the execution of the expected sequence of operations.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"999\" height=\"1024\" src=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-5-999x1024.png\" alt=\"\" class=\"wp-image-5899\" srcset=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-5-999x1024.png 999w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-5-293x300.png 293w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-5-768x787.png 768w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-5.png 1004w\" sizes=\"(max-width: 999px) 100vw, 999px\" loading=\"lazy\" \/><\/figure>\n<\/div>\n\n\n<h3 class=\"wp-block-heading\">Stage 3<\/h3>\n\n\n\n<p>In the third and final stage, the malware performs checks for the presence of potentially interesting files, such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Browser cookies and password storage files (Opera, Firefox, Chrome)<\/li>\n\n\n\n<li>Software files containing credentials related to cloud services (Apple, Microsoft)<\/li>\n\n\n\n<li>Microsoft Credentials files<\/li>\n\n\n\n<li>FTP client credentials<\/li>\n\n\n\n<li>Email client credentials<\/li>\n<\/ul>\n\n\n\n<p>Once collected, the data is sent to a Telegram bot in the form of an HTML message.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"644\" height=\"800\" src=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-6.png\" alt=\"\" class=\"wp-image-5900\" srcset=\"https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-6.png 644w, https:\/\/fortgale.com\/blog\/wp-content\/uploads\/sites\/2\/2023\/05\/image-6-242x300.png 242w\" sizes=\"(max-width: 644px) 100vw, 644px\" loading=\"lazy\" \/><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Indicators of Compromise (IOCs)<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">File<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ORDINE DI ACQUISTO N. BCM190282.lzh\n<ul class=\"wp-block-list\">\n<li>SHA-256: c829fe437caee2845da6f1d6ba7096dc5b73b0656c1e6e5dce556df87d0d97f4<\/li>\n\n\n\n<li>MD5: 626d4f6c378fdd36644260a5a369fa90<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>ORDINE DI ACQUISTO N. BCM19\n<ul class=\"wp-block-list\">\n<li>SHA-256: 6a38cb877dc57efa24fe27df01e1a11c4006ff7f9faa20a68aebbf6f3984ffcd<\/li>\n\n\n\n<li>MD5: a15d62e5cbcc04eb260aeeecbfb07cc4<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">URL<\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>hxxps:\/\/api[.]telegram[.]org\/bot5698972394:AAELt5lfu8M6VszYWCv7l1dRLRsOgjCKrLI\/sendDocument<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>On January 24, 2023, Fortgale identified an Agent Tesla malware campaign being delivered via email to compromise the systems of Italian companies. In this technical article, we will analyze the behavior of the malware and how it compromised its victims through the analysis of code characteristics and collected data. It has now become common practice [&hellip;]<\/p>\n","protected":false},"author":12,"featured_media":5918,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2483],"tags":[],"class_list":["post-7043","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-malware-analysis"],"_links":{"self":[{"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/posts\/7043","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/comments?post=7043"}],"version-history":[{"count":4,"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/posts\/7043\/revisions"}],"predecessor-version":[{"id":7050,"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/posts\/7043\/revisions\/7050"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/media\/5918"}],"wp:attachment":[{"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/media?parent=7043"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/categories?post=7043"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fortgale.com\/blog\/wp-json\/wp\/v2\/tags?post=7043"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}