Skip to content

How to write good Yara Rules

0xffccdd edited this page Mar 3, 2022 · 2 revisions

image

One of the most important aspects of malware analysis is the ability to read and write yara rules. Yara rules are a way to describe malware using text strings. They can be used to identify malware samples, or to generate alerts when malware is encountered.

You can get a playbook on how to respond to security incidents in Cloud and Container environments here.

There are a few things to keep in mind when writing yara rules:

  1. Be specific. When writing a yara rule, be specific about the strings you are looking for. Don’t try to match everything at once. This will make your rule more accurate, and will help to reduce the number of false positives.

  2. Use comments. Use comments to help explain what your rule is doing. This will make it easier for others to understand your rule, and will help when you need to make changes to it.

  3. Use wildcards sparingly. Wildcards can be useful, but they should be used sparingly. If you use too many wildcards, your rule will be less accurate.

  4. Test your rule. Make sure to test your yara rule on a variety of malware samples. This will help you to ensure that it is accurate.