YARA
YARA is a pattern matching tool for malware researchers to identify and classify malware samples using textual or binary patterns. It allows creation of descriptions based on strings and Boolean expressions with advanced features like wildcards and regular expressions.
Description
YARA helps malware researchers identify and classify malware samples by creating descriptions of malware families based on textual or binary patterns contained in samples. Each description consists of a set of strings and a Boolean expression that determines its logic. Complex and powerful rules can be created using binary strings with wild-cards, case-insensitive text strings, special operators, regular expressions, and many other features.
The tool is available as multiple packages: the main 'yara' binary for pattern matching, 'libyara10' shared library, 'libyara-dev' for development, 'yarac' for compiling rules, and 'yara-doc' for HTML documentation. It finds files matching patterns and rules written in a special-purpose language, serving as a swiss army knife for malware analysis.
YARA is used in threat hunting contexts, such as detecting malware without IoCs, writing custom rules, and in training labs for introduction to YARA and malware detection.
How It Works
YARA operates by scanning files, directories, or processes against rules defined in a special-purpose language. Rules consist of strings (textual, binary, hex with wildcards, regex) and logical conditions evaluated as Boolean expressions. The scanner matches patterns using atom quality tables for optimization, supports compiled rules for faster scanning, external variable definitions, and fast matching modes. Compilation via yarac produces binary rule files for efficient loading.
Installation
sudo apt install yaraFlags
Examples
yara -hyara [NAMESPACE:]RULES_FILE... FILE | DIR | PIDyara -C [NAMESPACE:]RULES_FILE... FILEyara -c [NAMESPACE:]RULES_FILE... DIRyara -d foo=123 [NAMESPACE:]RULES_FILE... FILEyarac -hyarac [NAMESPACE:]SOURCE_FILE... OUTPUT_FILE