{"id":6976,"date":"2024-02-12T09:13:59","date_gmt":"2024-02-12T09:13:59","guid":{"rendered":"\/cybersecurity-blog\/?p=6976"},"modified":"2024-02-12T09:37:45","modified_gmt":"2024-02-12T09:37:45","slug":"net-malware-obfuscators-analysis-part-one","status":"publish","type":"post","link":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/","title":{"rendered":"A deep dive into .NET malware obfuscators: <br> Part 1"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">As a preface&nbsp;<\/h2>\n\n\n\n<p>In the modern world, it is rare to encounter purely clean malware during analysis. Malware code is commonly modified to hinder researchers from analyzing and decompiling it.&nbsp;<\/p>\n\n\n\n<p>Software that alters code to hinder analysis is known as <strong>obfuscators<\/strong>. Some are designed to mutate machine code, targeting malware primarily developed using C\/Asm\/Rust, while others modify IL (Intermediate Language) code generated by .NET compilers.&nbsp;<\/p>\n\n\n\n<p>This series of articles will delve into modern techniques employed by obfuscators like <strong>.NET Reactor <\/strong>and <strong>SmartAssembly<\/strong>, which are widely favored by malware creators. We will acquaint ourselves with deobfuscation methods and attempt to either develop our own deobfuscators or adapt existing ones. We will also explore tools designed to counter them if any.&nbsp;<\/p>\n\n\n\n<p>Our goal is to make the content as accessible as possible, ensuring that even beginners with a basic understanding of .NET can grasp the concepts. However, a foundational knowledge of malware analysis tools and concepts is expected. Prior experience in analyzing obfuscated code will be an added advantage.&nbsp;<\/p>\n\n\n\n<p>Are you ready to embark on this journey? Let\u2019s begin.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Introduction&nbsp;<\/h2>\n\n\n\n<p>To truly understand obfuscators, we should think like the people who make them. It&#8217;s a bit like the red\/blue-team in cybersecurity: to defend well, you must understand the offense. So, let\u2019s try our hand at building a <em>simple obfuscator<\/em>.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Simple obfuscator&nbsp;<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">What should it look like?&nbsp;<\/h3>\n\n\n\n<p>First of all, let&#8217;s look at the <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/blob\/main\/NetObfuscatorExample\/Example1\/Program.cs\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">program<\/a> we will be experimenting with:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1800\" height=\"881\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-1024x501.jpg\" alt=\"\" class=\"wp-image-6977\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-1024x501.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-300x147.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-768x376.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-1536x752.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-370x181.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-270x132.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1-740x362.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/1.jpg 1800w\" sizes=\"(max-width: 1800px) 100vw, 1800px\" \/><figcaption class=\"wp-element-caption\"><strong>Source code of the \u201cExample1\u201d<\/strong>&nbsp;<\/figcaption><\/figure><\/div>\n\n\n<p>Yep, there are a few lines of code, one variable and it has the only function \u201cProtectMe\u201d which prints \u201cNo_On3_Can_Find_My_S3cr37_Pass\u201d. So simple, isn\u2019t it?&nbsp;<\/p>\n\n\n\n<p>Take a look at the decompiled code in the .NET debugger \u201c<a href=\"https:\/\/github.com\/dnSpyEx\/dnSpy\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">DnSpy<\/a>\u201d:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"596\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-1024x596.jpg\" alt=\"\" class=\"wp-image-6978\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-1024x596.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-300x175.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-768x447.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-1536x893.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-370x215.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-270x157.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2-740x430.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/2.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Decompiled code of the \u201cExample1\u201d in DnSpy&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>It&#8217;s clear that anyone can easily find the password by opening the compiled program in the appropriate tool, without much effort. So, <em>how to protect our password<\/em>?&nbsp;<\/p>\n\n\n\n<p>Here are some strategies we will use to enhance protection of our secret:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>proxy functions:<\/strong> put each static string in its own function with crazy name;&nbsp;<\/li>\n\n\n\n<li><strong>character breakdown<\/strong>: divide strings into individual characters;&nbsp;<\/li>\n\n\n\n<li><strong>numeric conversion<\/strong>: replace characters with their numeric values;&nbsp;<\/li>\n\n\n\n<li><strong>heavy math<\/strong>: use many math operations with large numbers;&nbsp;<\/li>\n\n\n\n<li><strong>CFG obfuscation<\/strong>: make the control flow complex and hard to follow.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>Let&#8217;s see if these methods can really keep our secret safe and make it tough for anyone trying to crack it.<\/p>\n\n\n\n<!-- Regular Banner START -->\n<div class=\"regular-banner\">\n<!-- Text Content -->\n<p class=\"regular-banner__text\">\nAnalyze <span class=\"highlight\">obfuscated malware<\/span> with ANY.RUN&#8217;s advanced features&nbsp;\n<\/p>\n<!-- CTA Link -->\n<a class=\"regular-banner__link\" id=\"article-banner-regular\" href=\"https:\/\/any.run\/demo\/\" rel=\"noopener\" target=\"_blank\">\nGet trial\n<\/a>\n<\/div>\n<!-- Regular Banner END -->\n<!-- Regular Banner Styles START -->\n\n<style>\n.regular-banner {\ndisplay: flex;\ntext-align: center;\nflex-direction: column;\nalign-items: center;\ngap: 1.5rem;\nwidth: 100%;\npadding: 2rem;\nmargin: 1.5rem 0;\nborder-radius: 0.5rem;\nfont-family: 'Catamaran Bold';\nmargin-inline: auto;\nbackground: rgba(32, 168, 241, 0.1);\nborder: 1px solid rgba(75, 174, 227, 0.32);\n}\n\n.regular-banner__text {\nfont-size: 1.5rem;\nmargin: 0;\n}\n\n.highlight {\ncolor: #ea2526;\n}\n\n.regular-banner__link {\npadding: 0.5rem 1.5rem;\nfont-weight: 500;\ntext-decoration: none;\nborder-radius: 0.5rem;\ncolor: #FFFFFF;\nbackground-color: #1491D4;\ntext-align: center;\ntransition: all 0.2s ease-in;\n}\n\n.regular-banner__link:hover {\nbackground-color: #68CBFF;\ncolor: white;\n}\n<\/style>\n<!-- Regular Banner Styles END -->\n\n\n\n<h2 class=\"wp-block-heading\">Proxy Functions&nbsp;<\/h2>\n\n\n\n<p>Following our strategy, we&#8217;ll move all string assignments into separate functions (proxy). This step gives us <em>better control<\/em> over these individual functions and forces researchers to search elsewhere for the definition of each string.&nbsp;<\/p>\n\n\n\n<p>The desired outcome of our approach is showcased in the <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/blob\/main\/NetObfuscatorExample\/Example2\/Program.cs\" target=\"_blank\" rel=\"noreferrer noopener\">Example2<\/a> decompiled listing:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"501\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-1024x501.jpg\" alt=\"\" class=\"wp-image-6979\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-1024x501.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-300x147.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-768x376.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-1536x752.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-370x181.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-270x132.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3-740x362.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/3.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>String assigment in the separate function&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>To achieve this, we\u2019ll need to modify the IL code. We can see how it should be changed in the following picture (change view to \u201cIL with C#\u201d in DnSpy):<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-1024x519.jpg\" alt=\"\" class=\"wp-image-6980\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-1024x519.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-300x152.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-768x389.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-1536x778.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-370x187.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-270x137.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4-740x375.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/4.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>IL code modifications at the first iteration<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>We use \u201c<a href=\"https:\/\/github.com\/0xd4d\/dnlib\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Dnlib<\/a>\u201d library to make changes to the compiled \u201cExample1\u201d. This process needs to be done in several steps:&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"1\">\n<li>Locate function \u201cProtectMe\u201d.&nbsp;<\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Go through all the instructions and find each instance of \u201cldstr\u201d (load string).&nbsp;<\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"3\">\n<li>Create a new class and a new function with a random name.&nbsp;<\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"4\">\n<li>Add \u201cldstr\u201d and \u201cret\u201d instructions to the body of the created function.&nbsp;<\/li>\n<\/ol>\n\n\n\n<ol class=\"wp-block-list\" start=\"5\">\n<li>Replace original \u201cldstr\u201d with a call to the new function.&nbsp;<\/li>\n<\/ol>\n\n\n\n<p>All the steps mentioned above have been implemented in <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example3\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example3<\/a>. We won\u2019t go into a detailed analysis of the source code here, because it is a bit boring and you can do that on your own. However, we will point out two interesting aspects.&nbsp;<\/p>\n\n\n\n<p>First, take a look at how simply and elegantly we can create the body of a new method using \u2018dnlib\u2019:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"488\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-1024x488.jpg\" alt=\"\" class=\"wp-image-6981\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-1024x488.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-300x143.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-768x366.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-1536x731.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-370x176.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-270x129.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5-740x352.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/5.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>IL code modifications at the first iteration&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>Second, consider how random function names should appear. Do they need to consist solely of printable characters? Absolutely not. To really make the researcher\u2019s job challenging, we <em>switch to using UTF-32<\/em> encoding!&nbsp;<\/p>\n\n\n\n<p>Well, let&#8217;s see what we\u2019ve got:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"723\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-1024x723.jpg\" alt=\"\" class=\"wp-image-6982\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-1024x723.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-300x212.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-768x542.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-1536x1085.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-370x261.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-270x191.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6-740x523.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/6.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>The result of the 1<sup>st<\/sup> obfuscation step&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>It looks pretty scary, right? We can see that the original string is now hidden behind a call to a really annoying method. Now, it\u2019s time to move on to the next part.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Character breakdown&nbsp;<\/h3>\n\n\n\n<p>Even though we\u2019ve hidden the original string, it\u2019s still pretty easy to find and read it. To fix this, we need to change the secret itself. So, we split the secret into individual characters which allows us to shuffle their order later and present the code in a form that\u2019s much harder to read.&nbsp;<\/p>\n\n\n\n<p>First, check out decompiled code of the <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example4\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example4<\/a>, where you can see what we\u2019re aiming for:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"593\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-1024x593.jpg\" alt=\"\" class=\"wp-image-6983\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-1024x593.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-300x174.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-768x445.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-1536x890.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-370x214.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-270x156.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7-740x429.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/7.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>IL code of the splitted string&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>The screenshot above demonstrates that the string is pushed onto the stack byte by byte, unlike in the previous examples where the entire string was pushed at once.&nbsp;<\/p>\n\n\n\n<p>Second, take a look at <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example5\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example5<\/a>, where we\u2019ve made a small change to our obfuscator by adding the function \u201cSplitStringByCharToInstr.\u201d This function splits string and generates corresponding IL code. The result of the improvement outlined in the next screenshot:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"489\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-1024x489.jpg\" alt=\"\" class=\"wp-image-6984\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-1024x489.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-300x143.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-768x367.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-1536x734.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-370x177.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-270x129.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8-740x354.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/8.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Constructing string by bytes&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>It appears that DnSpy is powerful enough to parse IL code and present splitted string in a human-readable form. We\u2019ll delve into this in the next chapters. For now, we examine this improvement from another perspective.&nbsp;<\/p>\n\n\n\n<p>Let&#8217;s compare the output of the \u201cstring\u201d command before and after obfuscation:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"155\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-1024x155.jpg\" alt=\"\" class=\"wp-image-6985\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-1024x155.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-300x45.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-768x116.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-1536x232.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-370x56.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-270x41.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9-740x112.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/9.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>The entire string is missing from the file<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>Here we are! The string has vanished from the file. It might be a good example of how obfuscators can help <em>bypass signature detection<\/em>.&nbsp;<\/p>\n\n\n\n<p>Now, let&#8217;s move on and tackle the almighty DnSpy.&nbsp;<\/p>\n\n\n\n<!-- Regular Banner START -->\n<div class=\"regular-banner\">\n<!-- Text Content -->\n<p class=\"regular-banner__text\">\nGet a personal demo of <span class=\"highlight\">ANY.RUN<\/span> from our team&nbsp;\n<\/p>\n<!-- CTA Link -->\n<a class=\"regular-banner__link\" id=\"article-banner-regular\" href=\"https:\/\/calendly.com\/d\/3nd-rzd-xvx\/any-run-demo-blog\/\" rel=\"noopener\" target=\"_blank\">\nGet demo\n<\/a>\n<\/div>\n<!-- Regular Banner END -->\n<!-- Regular Banner Styles START -->\n\n<style>\n.regular-banner {\ndisplay: flex;\ntext-align: center;\nflex-direction: column;\nalign-items: center;\ngap: 1.5rem;\nwidth: 100%;\npadding: 2rem;\nmargin: 1.5rem 0;\nborder-radius: 0.5rem;\nfont-family: 'Catamaran Bold';\nmargin-inline: auto;\nbackground: rgba(32, 168, 241, 0.1);\nborder: 1px solid rgba(75, 174, 227, 0.32);\n}\n\n.regular-banner__text {\nfont-size: 1.5rem;\nmargin: 0;\n}\n\n.highlight {\ncolor: #ea2526;\n}\n\n.regular-banner__link {\npadding: 0.5rem 1.5rem;\nfont-weight: 500;\ntext-decoration: none;\nborder-radius: 0.5rem;\ncolor: #FFFFFF;\nbackground-color: #1491D4;\ntext-align: center;\ntransition: all 0.2s ease-in;\n}\n\n.regular-banner__link:hover {\nbackground-color: #68CBFF;\ncolor: white;\n}\n<\/style>\n<!-- Regular Banner Styles END -->\n\n\n\n<h3 class=\"wp-block-heading\">Numeric conversion&nbsp;<\/h3>\n\n\n\n<p>So far, our attempts to hide the password haven\u2019t really paid off. But what if we replace the symbols with their numerical representations? Let\u2019s take a look at <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example6\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example6<\/a> to see this approach in action:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"622\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-1024x622.jpg\" alt=\"\" class=\"wp-image-6986\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-1024x622.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-300x182.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-768x467.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-1536x934.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-370x225.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-270x164.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10-740x450.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/10.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Numeric conversion in action<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>The source and decompiled code above shows that there are no characters visible, showcasing the effectiveness of this method. In this approach, <em>each character is represented by a number<\/em>, which the &#8220;Conv.U2&#8221; instruction converts to an unsigned int. Subsequently, we convert this number back to a string and append it to the final result.&nbsp;<\/p>\n\n\n\n<p>To utilize this technique, we need to tweak our obfuscator slightly. The result of modification is showcased in the <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example7\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example 7<\/a>, where we\u2019ve integrated the function \u201cMaskCharsWithNumVal\u201d to perform this conversion. The next picture shows the result:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"353\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-1024x353.jpg\" alt=\"\" class=\"wp-image-6987\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-1024x353.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-300x104.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-768x265.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-1536x530.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-370x128.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-270x93.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11-740x255.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/11.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Numeric conversion defeated DnSpy, but failed with IlSpy<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>The image we\u2019re looking at shows that trying to read the code decompiled by DnSpy can be a bit of a headache. It turns everything into numbers, and you&#8217;d have to use the ASCII table to make sense of it \u2013 definitely a bit of a hassle if you\u2019re doing it manually.&nbsp;<\/p>\n\n\n\n<p>On the other hand, IlSpy, which is another great tool for breaking down IL code, does a pretty neat job. It seems to catch onto our trick and changes those numbers back into characters, making them easy to read. Also, if you peek at the file\u2019s binary view, you&#8217;ll find that our secret is still in there, just a bit more scattered around:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"374\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-1024x374.jpg\" alt=\"\" class=\"wp-image-6988\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-1024x374.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-300x110.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-768x280.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-1536x561.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-370x135.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-270x99.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12-740x270.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/12.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Find a password in the binary view<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>Now, let\u2019s move on to the next chapter where we completely wipe out any traces of the characters.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Heavy math&nbsp;<\/h3>\n\n\n\n<p>To begin with, take a look at the following math expressions:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"199\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-1024x199.jpg\" alt=\"\" class=\"wp-image-6989\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-1024x199.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-300x58.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-768x149.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-1536x299.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-370x72.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-270x53.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13-740x144.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/13.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Transform characters to the math expressions&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>Both expressions of the above shows the numeric representation of the \u2018A\u2019 character. Furthermore, it demonstrates that any number can be written as a mathematical expression. Even better, there are countless ways to express any number this way. So, why not get creative and represent our characters using randomly generated mathematical expressions?&nbsp;<\/p>\n\n\n\n<p>Just like we did earlier, let\u2019s now take a look at <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example8\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example8<\/a> to see the expected outcome:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"564\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-1024x564.jpg\" alt=\"\" class=\"wp-image-6990\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-1024x564.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-300x165.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-768x423.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-1536x847.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-370x204.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-270x149.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14-740x408.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/14.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Example of the IL code of the mathematical expressions<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>Decompiled code looks ugly, isn\u2019t it? This is exactly what we need!&nbsp;<\/p>\n\n\n\n<p>So, we should develop a function that requires two arguments:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>the <em>target number<\/em> we want to achieve;&nbsp;<\/li>\n\n\n\n<li>the <em>intensity <\/em>\u2013 the maximum number of <a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.reflection.emit.opcodes.add?view=net-8.0\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">ADD<\/a>\/<a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.reflection.emit.opcodes.sub?view=net-8.0\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">SUB<\/a>\/<a href=\"https:\/\/learn.microsoft.com\/en-us\/dotnet\/api\/system.reflection.emit.opcodes.xor?view=net-8.0\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">XOR<\/a> operations we can use to reach the target number.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>The function will iterate through all the method\u2019s instructions and modify those that involve an \u2018int32\u2019 number, replacing them with a new set of obfuscated instructions. Additionally, all numbers as well as mathematical operations should be generated randomly.&nbsp;<\/p>\n\n\n\n<p>The modified version of the obfuscator, tailored to meet the above requirements, is displayed in <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example9\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example9<\/a>. Let&#8217;s also check out the results of its execution:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"669\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-1024x669.jpg\" alt=\"\" class=\"wp-image-6991\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-1024x669.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-300x196.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-768x502.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-1536x1004.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-370x242.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-270x176.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15-740x483.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/15.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>The result of the heavy math obfuscation pass<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>Here we are! Can you decipher the content in the screenshot above? Let\u2019s share a few thoughts about the tweaks we made to the obfuscator.&nbsp;<\/p>\n\n\n\n<p>First up, keen readers might notice that we didn\u2019t mix XOR with ADD\/SUB operations. This is due to the more complex logic needed because of their expression priority. We actually randomly pick which operation to use for each number.&nbsp;<\/p>\n\n\n\n<p>Next, we employed a neat <em>trick with a temporary variable to outsmart IlSpy<\/em>. We first stored the initial random value in this temp variable before calculating the math expression. This step is crucial because IlSpy has a slick math synthesizer that instantly computes the result of mathematical operations between constant values. So, without this trick, the decompiled code would have directly revealed the character we were trying to hide.&nbsp;<\/p>\n\n\n\n<p>Lastly, we added a bit of a twist by randomly converting from \u2018int\u2019 to \u2018uint\u2019. This small change is just enough to make curious researchers even more angry.&nbsp;<\/p>\n\n\n\n<p>Despite the password now being harder to decipher, our decompiled code remains linear and could still be read with some effort. So, let\u2019s step it up and add another layer of obfuscation.&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">CFG obfuscation&nbsp;<\/h3>\n\n\n\n<p>In simple terms, all Control Flow Graph (CFG) obfuscation boils down to:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>splitting the code into <em>basic blocks;<\/em>&nbsp;<\/li>\n\n\n\n<li><em>shuffling <\/em>them randomly;&nbsp;<\/li>\n\n\n\n<li><em>connecting <\/em>these blocks so that the result of executing the code remains the same.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>To grasp the idea of breaking code into basic blocks, let\u2019s revisit <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example4\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example4<\/a>. We\u2019ll break the code down into basic blocks, shuffle them around, and then take a look at what happens in the image that follows:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"517\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-1024x517.jpg\" alt=\"\" class=\"wp-image-6992\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-1024x517.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-300x151.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-768x387.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-1536x775.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-370x187.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-270x136.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16-740x373.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/16.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Example of splitting and mixing basic blocks<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>The previous image illustrates how shuffling the code makes it much tougher to spot the secret code. However, there\u2019s a clear catch: if we try running this new, shuffled code, we\u2019ll end up with the wrong secret, since the instructions are now in an incorrect order. So, how can we run them in the right way?&nbsp;<\/p>\n\n\n\n<p>To execute shuffled code in the correct order, we need a way to guide its execution. This involves reconstructing the original control flow by adding <em>control structures or markers<\/em>. Take a look at the next image, where we\u2019ve analyzed <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example10\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example10<\/a>:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"776\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-1024x776.jpg\" alt=\"\" class=\"wp-image-6993\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-1024x776.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-300x227.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-768x582.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-1536x1164.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-370x280.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-270x205.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-740x561.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17-80x60.jpg 80w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/17.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Example of control structure and markers to guide control flow&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>The example above demonstrates a method for directing the execution of shuffled code. It features:&nbsp;&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>an endless \u2018while\u2019 loop, which continuously moves us to the \u2018switch\u2019;&nbsp;<\/li>\n\n\n\n<li>a \u2018switch\u2019 statement that directly chooses the subsequent code block;&nbsp;<\/li>\n\n\n\n<li>the \u2018num\u2019 variable, acting as a marker, holds the choice for the start and the next block;&nbsp;<\/li>\n\n\n\n<li>a default case in the \u2018switch\u2019 statement, which serves to exit the endless loop.&nbsp;<\/li>\n<\/ul>\n\n\n\n<p>It looks like we\u2019ve successfully split the code into basic blocks and shuffled them. We\u2019ve also learned how to direct the execution using a switch statement and a marker. But we need to remember that we\u2019re working with IL, not the source code. Now, the question arises: <em>how do we split the IL code into basic blocks<\/em>?&nbsp;<\/p>\n\n\n\n<p>As far as we know the IL virtual machine uses <em>evaluation stack<\/em> to operate. This means that before performing an operation, we first need to push the necessary values onto the stack. For instance, to execute a XOR operation, we push two values onto the stack, carry out the XOR, and then push the result back to the top of the stack.&nbsp;<\/p>\n\n\n\n<p>Taking the above into account, we can broadly state that the initial state of the stack is empty, meaning the stack pointer is null. During an operation, the stack pointer changes from this initial state, becoming non-null. Once the operation is completed and the result is saved, the stack reverts to its initial null state. Therefore, it seems we can <em>split IL code into basic blocks based on the initial stack value<\/em>, specifically at points where the stack pointer is null.&nbsp;<\/p>\n\n\n\n<p>Let\u2019s examine the IL code from our latest obfuscated example. Here, we\u2019ve divided the instructions based on the stack value:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"546\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-1024x546.jpg\" alt=\"\" class=\"wp-image-6994\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-1024x546.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-300x160.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-768x409.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-1536x818.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-370x197.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-270x144.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18-740x394.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/18.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Example of splitting IL instructions into the basic blocks based on the stack value&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>It\u2019s important to note that the blocks doesn\u2019t necessarily corresponds neatly into lines. It\u2019s entirely possible for a single line of decompiled code to contain several basic blocks like in the next example:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"104\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-1024x104.jpg\" alt=\"\" class=\"wp-image-6995\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-1024x104.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-300x30.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-768x78.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-1536x155.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-370x37.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-270x27.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19-740x75.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/19.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Two lines of the decompiled code corresponds to the three basic blocks (see previous picture)<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>With everything we\u2019ve discussed so far, we\u2019re now prepared to develop a CF obfuscator. This has been accomplished in <a href=\"https:\/\/github.com\/anyrun\/blog-scripts\/tree\/main\/NetObfuscatorExample\/Example11\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Example11<\/a>. The outcome of its execution can be seen in the following picture:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"592\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-1024x592.jpg\" alt=\"\" class=\"wp-image-6996\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-1024x592.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-300x173.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-768x444.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-1536x887.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-370x214.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-270x156.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20-740x428.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/20.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>The result of the control flow obfuscation<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>We\u2019ll leave the detailed code analysis of the Example11 to you as a home exercise. However, let\u2019s highlight a key caution to consider.&nbsp;<\/p>\n\n\n\n<p>The CF obfuscation we&#8217;ve presented is quite basic. It doesn\u2019t account for exception blocks, prefixes, or conditional expressions. In fact, it overlooks many aspects. The aim was solely to demonstrate how it works in a straightforward manner. Consequently, it\u2019s highly probable that this approach won\u2019t function effectively with complex methods and would require more sophisticated development.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Attacking the simple obfuscator&nbsp;<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Breakpoint&nbsp;<\/h3>\n\n\n\n<p>We\u2019ve put in a lot of effort to conceal our secret from analysis and intimidate researchers with convoluted code. We even managed to some extent, creating a method laden with complex math and obfuscated control flow.&nbsp;<\/p>\n\n\n\n<p>Yet, all our endeavors to establish \u2018strong\u2019 protection falter in the face of real-time execution. To bypass our safeguards, one simply needs to set a breakpoint at the return or after the function of interest and read its result, as shown in the following picture:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"426\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-1024x426.jpg\" alt=\"\" class=\"wp-image-6997\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-1024x426.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-300x125.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-768x320.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-1536x639.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-370x154.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-270x112.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21-740x308.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/21.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>The epic fall of the obfuscator with a single breakpoint&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">Memory dump&nbsp;<\/h3>\n\n\n\n<p>Memory dumps are among the most effective methods for uncovering hidden strings, as .NET compilers often leave numerous traces of the strings they decrypt. This is evidenced by the results of a memory scan using ProcessHacker, which revealed 24 results:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"990\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-1024x990.jpg\" alt=\"\" class=\"wp-image-6998\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-1024x990.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-300x290.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-768x742.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-1536x1485.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-370x358.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-270x261.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22-740x715.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/22.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Memory dump shows our secret&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<h3 class=\"wp-block-heading\">The De4dot&nbsp;<\/h3>\n\n\n\n<p>Our old friend \u2018De4dot\u2019 can still <a href=\"https:\/\/app.any.run\/tasks\/59366ae7-659a-4f4e-b587-2144dc7425a3\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">come in <\/a><a href=\"https:\/\/app.any.run\/tasks\/59366ae7-659a-4f4e-b587-2144dc7425a3\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=netobfuscatorspart1&amp;utm_content=linktoservice&amp;utm_term=120224\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">handy<\/a>. With just a \u2018one click\u2019, it managed to completely remove the CFG and math obfuscation:\u00a0<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"412\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-1024x412.jpg\" alt=\"\" class=\"wp-image-6999\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-1024x412.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-300x121.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-768x309.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-1536x619.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-370x149.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-270x109.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23-740x298.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/23.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Old De4dot successfully deobfuscated the code&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<p>Besides that, it also offers another powerful feature which directly executes the obfuscated method and replaces proxy call with a string literal:&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt; de4dot.exe Example1_obf.exe --strtyp emulate --strtok 0x06000004 <\/code><\/pre>\n\n\n\n<p>The result, unfortunately for our obfuscator, is amazing:&nbsp;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"463\" src=\"\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-1024x463.jpg\" alt=\"\" class=\"wp-image-7000\" srcset=\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-1024x463.jpg 1024w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-300x136.jpg 300w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-768x347.jpg 768w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-1536x694.jpg 1536w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-370x167.jpg 370w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-270x122.jpg 270w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24-740x334.jpg 740w, https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2024\/02\/24.jpg 1800w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>De4dot replaced a proxy call with a string literal&nbsp;<\/strong><\/figcaption><\/figure><\/div>\n\n\n<h2 class=\"wp-block-heading\">Final thoughts&nbsp;<\/h2>\n\n\n\n<p>In this part of our article series, we developed our own simple obfuscator and then completely dismantled its concept using various attack techniques. Does this mean a simple obfuscator is inherently weak? To some extent, yes. But does this imply the techniques we used are obsolete and should be discarded? Absolutely not. These methods are still employed in modern obfuscators, albeit in more sophisticated forms. Does this mean we now have a better understanding of the most common obfuscation techniques and are prepared to dissect modern obfuscators to their core? That\u2019s absolutely true. We\u2019re now equipped and ready to delve into the world of obfuscators.&nbsp;<\/p>\n\n\n\n<p>In the upcoming Part 2, we\u2019ll explore more ways to protect code. We\u2019ll investigate how obfuscators counter breakpoints, De4dot, and memory dumps. We\u2019ll also examine how to penetrate their defenses to understand the code and many other intriguing aspects.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Stay tuned for the next part!&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>About ANY.RUN<\/strong>&nbsp;<\/h2>\n\n\n\n<p><a href=\"https:\/\/any.run\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=netobfuscatorspart1&amp;utm_content=linktolanding&amp;utm_term=120224\" target=\"_blank\" rel=\"noreferrer noopener\">ANY.RUN<\/a> is a provider of a cloud-based sandbox for advanced malware analysis. The service is used by a community of over 300,000 SOC and DFIR professionals around the globe. The sandbox receives over 10,000 daily submissions of files and links, analyzing them and generating threat information reports.&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<p>Request a demo today and enjoy 14 days of free access to ANY.RUN&#8217;s top plan.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/any.run\/demo\/?utm_source=blog&amp;utm_medium=article&amp;utm_campaign=netobfuscatorspart1&amp;utm_content=linktodemo&amp;utm_term=120224\" target=\"_blank\" rel=\"noreferrer noopener\">Request demo \u2192<\/a>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As a preface&nbsp; In the modern world, it is rare to encounter purely clean malware during analysis. Malware code is commonly modified to hinder researchers from analyzing and decompiling it.&nbsp; Software that alters code to hinder analysis is known as obfuscators. Some are designed to mutate machine code, targeting malware primarily developed using C\/Asm\/Rust, while [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":7004,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[57,10,15,34,40],"class_list":["post-6976","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-malware-analysis","tag-anyrun","tag-cybersecurity","tag-malware","tag-malware-analysis","tag-malware-behavior"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.10 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>A deep dive into .NET malware obfuscators:  Part 1 - ANY.RUN&#039;s Cybersecurity Blog<\/title>\n<meta name=\"description\" content=\"Learn about by obfuscators like .NET Reactor and SmartAssembly favored by malware creators and discover deobfuscation methods.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Electron\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"17 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/\"},\"author\":{\"name\":\"Electron\",\"@id\":\"https:\/\/any.run\/\"},\"headline\":\"A deep dive into .NET malware obfuscators: Part 1\",\"datePublished\":\"2024-02-12T09:13:59+00:00\",\"dateModified\":\"2024-02-12T09:37:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/\"},\"wordCount\":2942,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/any.run\/\"},\"keywords\":[\"ANYRUN\",\"cybersecurity\",\"malware\",\"malware analysis\",\"malware behavior\"],\"articleSection\":[\"Malware Analysis\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/\",\"url\":\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/\",\"name\":\"A deep dive into .NET malware obfuscators: Part 1 - ANY.RUN&#039;s Cybersecurity Blog\",\"isPartOf\":{\"@id\":\"https:\/\/any.run\/\"},\"datePublished\":\"2024-02-12T09:13:59+00:00\",\"dateModified\":\"2024-02-12T09:37:45+00:00\",\"description\":\"Learn about by obfuscators like .NET Reactor and SmartAssembly favored by malware creators and discover deobfuscation methods.\",\"breadcrumb\":{\"@id\":\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/any.run\/cybersecurity-blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Malware Analysis\",\"item\":\"https:\/\/any.run\/cybersecurity-blog\/category\/malware-analysis\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"A deep dive into .NET malware obfuscators: Part 1\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/any.run\/\",\"url\":\"https:\/\/any.run\/\",\"name\":\"ANY.RUN&#039;s Cybersecurity Blog\",\"description\":\"Cybersecurity Blog covers topics for experienced professionals as well as for those new to it.\",\"publisher\":{\"@id\":\"https:\/\/any.run\/\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/any.run\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/any.run\/\",\"name\":\"ANY.RUN\",\"url\":\"https:\/\/any.run\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/any.run\/\",\"url\":\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2020\/08\/ANYRUN-Icon.svg\",\"contentUrl\":\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2020\/08\/ANYRUN-Icon.svg\",\"width\":1,\"height\":1,\"caption\":\"ANY.RUN\"},\"image\":{\"@id\":\"https:\/\/any.run\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/www.any.run\/\",\"https:\/\/twitter.com\/anyrun_app\",\"https:\/\/www.linkedin.com\/company\/30692044\",\"https:\/\/www.youtube.com\/channel\/UCOgCPho7lzmH7m6fPNlukrQ\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/any.run\/\",\"name\":\"Electron\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/any.run\/\",\"url\":\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2023\/05\/6394744.png\",\"contentUrl\":\"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2023\/05\/6394744.png\",\"caption\":\"Electron\"},\"description\":\"I'm a malware analyst. I love CTF, reversing, and pwn. Off-screen, I enjoy the simplicity of biking, walking, and hiking.\",\"sameAs\":[\"https:\/\/any.run\/\"],\"url\":\"#molongui-disabled-link\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"A deep dive into .NET malware obfuscators:  Part 1 - ANY.RUN&#039;s Cybersecurity Blog","description":"Learn about by obfuscators like .NET Reactor and SmartAssembly favored by malware creators and discover deobfuscation methods.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/","twitter_misc":{"Written by":"Electron","Est. reading time":"17 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#article","isPartOf":{"@id":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/"},"author":{"name":"Electron","@id":"https:\/\/any.run\/"},"headline":"A deep dive into .NET malware obfuscators: Part 1","datePublished":"2024-02-12T09:13:59+00:00","dateModified":"2024-02-12T09:37:45+00:00","mainEntityOfPage":{"@id":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/"},"wordCount":2942,"commentCount":0,"publisher":{"@id":"https:\/\/any.run\/"},"keywords":["ANYRUN","cybersecurity","malware","malware analysis","malware behavior"],"articleSection":["Malware Analysis"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/","url":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/","name":"A deep dive into .NET malware obfuscators: Part 1 - ANY.RUN&#039;s Cybersecurity Blog","isPartOf":{"@id":"https:\/\/any.run\/"},"datePublished":"2024-02-12T09:13:59+00:00","dateModified":"2024-02-12T09:37:45+00:00","description":"Learn about by obfuscators like .NET Reactor and SmartAssembly favored by malware creators and discover deobfuscation methods.","breadcrumb":{"@id":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/any.run\/cybersecurity-blog\/net-malware-obfuscators-analysis-part-one\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/any.run\/cybersecurity-blog\/"},{"@type":"ListItem","position":2,"name":"Malware Analysis","item":"https:\/\/any.run\/cybersecurity-blog\/category\/malware-analysis\/"},{"@type":"ListItem","position":3,"name":"A deep dive into .NET malware obfuscators: Part 1"}]},{"@type":"WebSite","@id":"https:\/\/any.run\/","url":"https:\/\/any.run\/","name":"ANY.RUN&#039;s Cybersecurity Blog","description":"Cybersecurity Blog covers topics for experienced professionals as well as for those new to it.","publisher":{"@id":"https:\/\/any.run\/"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/any.run\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/any.run\/","name":"ANY.RUN","url":"https:\/\/any.run\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/any.run\/","url":"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2020\/08\/ANYRUN-Icon.svg","contentUrl":"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2020\/08\/ANYRUN-Icon.svg","width":1,"height":1,"caption":"ANY.RUN"},"image":{"@id":"https:\/\/any.run\/"},"sameAs":["https:\/\/www.facebook.com\/www.any.run\/","https:\/\/twitter.com\/anyrun_app","https:\/\/www.linkedin.com\/company\/30692044","https:\/\/www.youtube.com\/channel\/UCOgCPho7lzmH7m6fPNlukrQ"]},{"@type":"Person","@id":"https:\/\/any.run\/","name":"Electron","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/any.run\/","url":"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2023\/05\/6394744.png","contentUrl":"https:\/\/any.run\/cybersecurity-blog\/wp-content\/uploads\/2023\/05\/6394744.png","caption":"Electron"},"description":"I'm a malware analyst. I love CTF, reversing, and pwn. Off-screen, I enjoy the simplicity of biking, walking, and hiking.","sameAs":["https:\/\/any.run\/"],"url":"#molongui-disabled-link"}]}},"_links":{"self":[{"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/posts\/6976"}],"collection":[{"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/comments?post=6976"}],"version-history":[{"count":10,"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/posts\/6976\/revisions"}],"predecessor-version":[{"id":7014,"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/posts\/6976\/revisions\/7014"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/media\/7004"}],"wp:attachment":[{"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/media?parent=6976"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/categories?post=6976"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/any.run\/cybersecurity-blog\/wp-json\/wp\/v2\/tags?post=6976"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}