{"id":10058,"date":"2021-06-15T16:12:13","date_gmt":"2021-06-15T14:12:13","guid":{"rendered":"https:\/\/www.nextron-systems.com\/?p=10058"},"modified":"2022-03-25T14:15:39","modified_gmt":"2022-03-25T13:15:39","slug":"use-yara-math-module-extension-in-thor-techpreview-and-thor-lite","status":"publish","type":"post","link":"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/","title":{"rendered":"Use YARA math Module Extension in THOR TechPreview and THOR Lite"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_row column_structure=&#8221;2_5,3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>Not long ago, we&#8217;ve created a <a href=\"https:\/\/github.com\/VirusTotal\/yara\/pull\/1483\">pull request<\/a> for the official YARA repository on Github, that would introduce new functions in the `math` module to improve the flexibility in cases in which a sample is heavily scrambled or obfuscated. These cases require further statistical evaluations that go beyond the currently available &#8220;entropy&#8221;, &#8220;mean&#8221; or &#8220;deviation&#8221; functions.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-15-at-15.47.54.png&#8221; title_text=&#8221;Screenshot 2021-06-15 at 15.47.54&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>The example on the right shows a heavily obfuscated PHP web shell, as used by a Chinese actor.\u00a0<\/p>\n<p>You immediately notice the high amount of &#8220;%&#8221; characters, but since each of them is preceded and followed by different characters, it&#8217;s difficult to find atoms that are long enough to maintain an acceptable performance \/ stability of that rule.\u00a0<\/p>\n<p>&nbsp;<\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-15-at-15.40.23.png&#8221; title_text=&#8221;Screenshot 2021-06-15 at 15.40.23&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>If you could, you would formulate a rule like this: &#8220;Detect files smaller 400 bytes, that begin with &#8216;&lt;?&#8217; and consist of at least 25 percent &#8216;%&#8217; characters&#8221;.\u00a0<\/p>\n<p>Well, the new module extension allows you to do exactly that.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-15-at-17.50.54.png&#8221; title_text=&#8221;Screenshot 2021-06-15 at 17.50.54&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221; hover_enabled=&#8221;0&#8243; sticky_enabled=&#8221;0&#8243;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>Read <a href=\"https:\/\/www.nextron-systems.com\/2020\/08\/31\/introduction-thor-techpreview\/\">the documentation<\/a> provided with the pull request for details on all three new functions:<\/p>\n<ul>\n<li>count(byte\/string, offset, size)<\/li>\n<li>percentage(byte, offset, size)<\/li>\n<li>mode(offset, size)<\/li>\n<\/ul>\n<p>While the first two functions are self-explanatory, the &#8220;<a href=\"https:\/\/en.wikipedia.org\/wiki\/Mode_(statistics)\">mode<\/a>&#8221; function isn&#8217;t. It is is a term used in statistics for the most common value.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-15-at-16.03.36.png&#8221; title_text=&#8221;Screenshot 2021-06-15 at 16.03.36&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][et_pb_row column_structure=&#8221;2_5,3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_column type=&#8221;2_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_text _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;]<\/p>\n<p>For your convenience, we&#8217;ve already patched our versions of <a href=\"https:\/\/www.nextron-systems.com\/2020\/08\/31\/introduction-thor-techpreview\/\">THOR TechPreview<\/a> and <a href=\"https:\/\/www.nextron-systems.com\/thor-lite\/\">THOR Lite<\/a> to support these extensions of the &#8220;math&#8221; module. You need at least v10.6.6 to use the new function in your rules.\u00a0<\/p>\n<p>We wish you good hunting.\u00a0<\/p>\n<p>[\/et_pb_text][\/et_pb_column][et_pb_column type=&#8221;3_5&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][et_pb_image src=&#8221;https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2021\/06\/Screenshot-2021-06-15-at-15.59.43.png&#8221; title_text=&#8221;Screenshot 2021-06-15 at 15.59.43&#8243; _builder_version=&#8221;4.9.7&#8243; _module_preset=&#8221;default&#8221;][\/et_pb_image][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Not long ago, we&#8217;ve created a pull request for the official YARA repository on Github, that would introduce new functions in the `math` module to improve the flexibility in cases in which a sample is heavily scrambled or obfuscated. These cases require further statistical evaluations that go beyond the currently available &#8220;entropy&#8221;, &#8220;mean&#8221; or &#8220;deviation&#8221; functions.The example on the right shows a heavily obfuscated PHP web shell, as used by a Chinese actor.\u00a0 You immediately notice the high amount of &#8220;%&#8221; characters, but since each of them is preceded and followed by different characters, it&#8217;s difficult to find atoms that are long enough to maintain an acceptable performance \/ stability of that rule.\u00a0 &nbsp;If you could, you would formulate a rule like this: &#8220;Detect files smaller 400 bytes, that begin with &#8216;&lt;?&#8217; and consist of at least 25 percent &#8216;%&#8217; characters&#8221;.\u00a0 Well, the new module extension allows you to do exactly that.Read the documentation provided with the pull request for details on all three new functions: count(byte\/string, offset, size) percentage(byte, offset, size) mode(offset, size) While the first two functions are self-explanatory, the &#8220;mode&#8221; function isn&#8217;t. It is is a term used in statistics for the most common value.For your convenience, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[32,248],"tags":[627,628,626,62,7,5,48],"class_list":["post-10058","post","type-post","status-publish","format-standard","hentry","category-thor","category-thor-lite","tag-math","tag-module","tag-obfuscation","tag-rules","tag-scanner","tag-thor","tag-yara"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v24.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Use YARA math Module Extension in THOR TechPreview and THOR Lite - Nextron Systems<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/\"},\"author\":{\"name\":\"Florian Roth\",\"@id\":\"https:\/\/www.nextron-systems.com\/#\/schema\/person\/4fd503007d60aabaf1ae747502f36919\"},\"headline\":\"Use YARA math Module Extension in THOR TechPreview and THOR Lite\",\"datePublished\":\"2021-06-15T14:12:13+00:00\",\"dateModified\":\"2022-03-25T13:15:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/\"},\"wordCount\":657,\"publisher\":{\"@id\":\"https:\/\/www.nextron-systems.com\/#organization\"},\"keywords\":[\"math\",\"module\",\"obfuscation\",\"Rules\",\"scanner\",\"thor\",\"YARA\"],\"articleSection\":[\"THOR\",\"THOR Lite\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/\",\"url\":\"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/\",\"name\":\"Use YARA math Module Extension in THOR TechPreview and THOR Lite - Nextron Systems\",\"isPartOf\":{\"@id\":\"https:\/\/www.nextron-systems.com\/#website\"},\"datePublished\":\"2021-06-15T14:12:13+00:00\",\"dateModified\":\"2022-03-25T13:15:39+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/\"]}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.nextron-systems.com\/#website\",\"url\":\"https:\/\/www.nextron-systems.com\/\",\"name\":\"Nextron Systems\",\"description\":\"We Detect Hackers\",\"publisher\":{\"@id\":\"https:\/\/www.nextron-systems.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.nextron-systems.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.nextron-systems.com\/#organization\",\"name\":\"Nextron Systems GmbH\",\"url\":\"https:\/\/www.nextron-systems.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.nextron-systems.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2017\/11\/Nextron_0.2s_inv_symbol_only.png\",\"contentUrl\":\"https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2017\/11\/Nextron_0.2s_inv_symbol_only.png\",\"width\":260,\"height\":260,\"caption\":\"Nextron Systems GmbH\"},\"image\":{\"@id\":\"https:\/\/www.nextron-systems.com\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.nextron-systems.com\/#\/schema\/person\/4fd503007d60aabaf1ae747502f36919\",\"name\":\"Florian Roth\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.nextron-systems.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0dfaa838ce5d82e2e7bfa75ed3f43ae5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0dfaa838ce5d82e2e7bfa75ed3f43ae5?s=96&d=mm&r=g\",\"caption\":\"Florian Roth\"},\"description\":\"Florian Roth serves as the Head of Research and Development at Nextron Systems. With a background in IT security since 2000, he has delved deep into nation-state cyber attacks since 2012. Florian has developed the THOR Scanner and actively engages with the community via his Twitter handle @cyb3rops. He has contributed to open-source projects, including 'Sigma', a generic SIEM rule format, and 'LOKI', an open-source scanner. Additionally, he has shared valuable resources like a mapping of APT groups and operations and an Antivirus Event Analysis Cheat Sheet.\",\"url\":\"https:\/\/www.nextron-systems.com\/author\/florian\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Use YARA math Module Extension in THOR TechPreview and THOR Lite - Nextron Systems","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:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/#article","isPartOf":{"@id":"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/"},"author":{"name":"Florian Roth","@id":"https:\/\/www.nextron-systems.com\/#\/schema\/person\/4fd503007d60aabaf1ae747502f36919"},"headline":"Use YARA math Module Extension in THOR TechPreview and THOR Lite","datePublished":"2021-06-15T14:12:13+00:00","dateModified":"2022-03-25T13:15:39+00:00","mainEntityOfPage":{"@id":"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/"},"wordCount":657,"publisher":{"@id":"https:\/\/www.nextron-systems.com\/#organization"},"keywords":["math","module","obfuscation","Rules","scanner","thor","YARA"],"articleSection":["THOR","THOR Lite"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/","url":"https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/","name":"Use YARA math Module Extension in THOR TechPreview and THOR Lite - Nextron Systems","isPartOf":{"@id":"https:\/\/www.nextron-systems.com\/#website"},"datePublished":"2021-06-15T14:12:13+00:00","dateModified":"2022-03-25T13:15:39+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.nextron-systems.com\/2021\/06\/15\/use-yara-math-module-extension-in-thor-techpreview-and-thor-lite\/"]}]},{"@type":"WebSite","@id":"https:\/\/www.nextron-systems.com\/#website","url":"https:\/\/www.nextron-systems.com\/","name":"Nextron Systems","description":"We Detect Hackers","publisher":{"@id":"https:\/\/www.nextron-systems.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.nextron-systems.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.nextron-systems.com\/#organization","name":"Nextron Systems GmbH","url":"https:\/\/www.nextron-systems.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.nextron-systems.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2017\/11\/Nextron_0.2s_inv_symbol_only.png","contentUrl":"https:\/\/www.nextron-systems.com\/wp-content\/uploads\/2017\/11\/Nextron_0.2s_inv_symbol_only.png","width":260,"height":260,"caption":"Nextron Systems GmbH"},"image":{"@id":"https:\/\/www.nextron-systems.com\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.nextron-systems.com\/#\/schema\/person\/4fd503007d60aabaf1ae747502f36919","name":"Florian Roth","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.nextron-systems.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0dfaa838ce5d82e2e7bfa75ed3f43ae5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0dfaa838ce5d82e2e7bfa75ed3f43ae5?s=96&d=mm&r=g","caption":"Florian Roth"},"description":"Florian Roth serves as the Head of Research and Development at Nextron Systems. With a background in IT security since 2000, he has delved deep into nation-state cyber attacks since 2012. Florian has developed the THOR Scanner and actively engages with the community via his Twitter handle @cyb3rops. He has contributed to open-source projects, including 'Sigma', a generic SIEM rule format, and 'LOKI', an open-source scanner. Additionally, he has shared valuable resources like a mapping of APT groups and operations and an Antivirus Event Analysis Cheat Sheet.","url":"https:\/\/www.nextron-systems.com\/author\/florian\/"}]}},"_links":{"self":[{"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/posts\/10058","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/comments?post=10058"}],"version-history":[{"count":11,"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/posts\/10058\/revisions"}],"predecessor-version":[{"id":10082,"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/posts\/10058\/revisions\/10082"}],"wp:attachment":[{"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/media?parent=10058"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/categories?post=10058"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nextron-systems.com\/wp-json\/wp\/v2\/tags?post=10058"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}