Malware Hunting with Swiss Army Knife, YARA

In a rapidly changing threat landscape one threat vector always appears to stay ahead in the game. This one is Malware. From SWIFT hacks to its cousin targeting individual users (Ransomware), Malware has continued to evolve and beat security defenses that many organizations have put in place.

It is no secret that traditional signature based detection is ineffective against this new breed of malware. Do we need a new weapon against this one? How do we detect it and prevent it when we don’t know how it looks like?

Some of the above questions are partially answered by understanding characteristics of the malware and understanding behavior of malware.

All malware is not created equal; AV signatures are ineffective against polymorphic code and self-replicating malware. But wait, malware is always designed to ‘behave’ in a certain manner, it needs to remain undetected, needs to target flash, adobe and IE zero days, it is often designed to ‘phone home’ and ‘receive commands’.

There are many solutions that can aid detection of malicious code based on behavior. Most of these work by building a ‘baseline’ of what is normal and identifying anomalous behavior such as unintended network connections, DLL hooks and strange memory processes amongst other things.

It must be noted that most antivirus offer of what is widely known as ‘heuristics’ detection. This setting can sometimes be changed to define how aggressive heuristics detection is needed. More aggressive setting stands more chance of detecting unknown malware but also detects a lot of non-malicious false-positives.

Another interesting technology that allows learning more about malware by ‘detonating’ it in a carefully controlled and observed environment is called sandboxing. Malware authors responded by creating ‘sandbox-aware’ malware that will NOT execute when it detects that it is being run inside a sandbox. Although this poses a limitation, sandboxing still provides a lot of interesting characteristics for most malware samples.


How does one go after such malware, are there tools available that can enable one to assure that the network or a selected set of hosts are immune of such threats?

Thanks to a great utility that anyone can download and use without breaking the bank. YARA is an open source tool to create simple rules based on strings, hashes, REGEX, filesize, filetype amongst other things. The binary and source is available so as to compile it on any platform of your choice. YARA can be downloaded at https://virustotal.github.io/yara/

A simple YARA rule syntax is discussed below.

rule RuleName 
{
              Strings:
              $test_string1= ”TestRuleStr”
              $test_string2= {A1 B2}

              Conditions:
              $test_string1 or $test_string2
}

The rule above can be explained section-wise

  • The first line defines RuleName, this rule name will be shown against a matching file when a YARA scan is run.
  • The Strings section defines strings, patterns, signatures, hashes, regex etc. The string supports wildcards, Hex inputs. The second string {A1 B2} is an example of hex inputs.
  • The conditions section evaluates Boolean expressions. In this case the rule will be triggered when either string is found inside of a file.
  • The conditions can be supplemented by defining filetype, filesize to avoid cycling through large or irrelevant files.



This excellent tool can be used with open source AV solution ClamAV and the YARA binaries can be used to scan systems with one rule or a combination of rules.

Many rules are published by various authors and security companies for a lot of rootkits, backdoors, CVE specific rules, exploit kits, malicious documents, shells, packers, malware etc.

Head over to https://github.com/Yara-Rules/rules to see many YARA rules and build your own. FireEye provides an excellent and free security tool to build indicators of compromise (IOC-Editor)

Attackers are building targeted malware that is delivered through spear phishing campaigns. This means that you may exclusively have a malware coming your way. Tools such as YARA can be a very effective tool to build your own IOC and run ‘Threat Hunting’ exercises within your organization to counter this threat. It is important to note that there is no ‘silver bullet’ to securing an organization and YARA is no exception. It is certainly a must have tool in your arsenal.

★
★
★
★
★
Votes: 0
E-mail me when people leave their comments –

You need to be a member of CISO Platform to add comments!

Join CISO Platform

Join The Community Discussion

CISO Platform

A global community of 6K+ Senior IT Security executives and 40K+ subscribers with the vision of meaningful collaboration, knowledge, and intelligence sharing to fight the growing cyber security threats.

Join CISO Community Share Your Knowledge (Post A Blog)
 

 

 

Turbo Talks: Safe AI Agents — Guardrails, Scope Enforcement and Governance

  • Description:

    Turbo Talks is a free 20-minute live session series on agentic AI pentesting and AI safety for security leaders, hosted by CISO Platform. Technology partner: FireCompass.

    Speaker: Bikash Barai, Founder & CEO, FireCompass

    As offensive AI agents get more capable, control becomes the harder problem. Practical guardrails and governance for deploying them safely.

    Time: 11:30 AM ET / 7:30 PM GST / 9:00 PM IST ·…

  • Created by: Priyanka Aash
  • Tags: turbo talks, agentic ai, ai safety

CISOPlatform Breakfast Mumbai: Offensive Security for CISOs

  • Description:

    Theme: Offensive Security for CISOs — Validating Exposure at Attacker Speed

    A closed-door breakfast for CISOs and heads of security. Peer discussion under the Chatham House rule, not a product presentation.

    What the table will work through

    1. Exploit windows in days, not months. Edge devices, CI/CD and AI gateways were all exploited within weeks of disclosure this autumn (GitLab CVE-2026-97229, Cisco ASA/FTD…
  • Created by: Priyanka Aash
  • Tags: ciso breakfast, mumbai, offensive security, pentesting

CISOPlatform Dinner Delhi: Red Team Stories and 2027 Priorities

  • Description:

    Theme: Red Team Stories and Offensive Security Priorities for 2027

    An invite-only dinner for CISOs and security leaders in Delhi. Informal peer conversation under the Chatham House rule.

    Conversation starters

    • What did attackers (or your red team) find first in your environment, and what did you change after?
    • AI agents on both sides: attackers automating exploitation, and defenders using agents to pentest.
    • Your top…
  • Created by: Priyanka Aash
  • Tags: ciso dinner, delhi, offensive security, red teaming

CISOPlatform Dinner Delhi: Red Team Stories and 2027 Priorities

  • Description:

    Theme: Red Team Stories and Offensive Security Priorities for 2027

    An invite-only dinner for CISOs and security leaders in Delhi. Informal peer conversation under the Chatham House rule.

    Conversation starters

    • What did attackers (or your red team) find first in your environment, and what did you change after?
    • AI agents on both sides: attackers automating exploitation, and defenders using agents to pentest.
    • Your top…
  • Created by: Priyanka Aash
  • Tags: ciso dinner, delhi, offensive security, red teaming