Skip to content
Buy me a coffee

YARA

tag: yaratag: detection

Download the Ubuntu desktop image (.iso) from ubuntu.com/download.

Ubuntu download page

VMware Fusion and Workstation Pro have been free for personal use since May 2024 (announcement).

  1. Open VMware Fusion and choose File › New.

    File, New in VMware Fusion

  2. Drag the downloaded .iso onto the installer window. The OS details fill in automatically. Click Continue.

    Dropping the Ubuntu .iso onto the installer

    The Ubuntu .iso selected in the new VM assistant

  3. On Linux Easy Install, untick Use Easy Install, then Continue.

    Linux Easy Install with the option unticked

  4. On Choose Firmware Type, select Legacy BIOS, then Continue.

    Choose Firmware Type set to Legacy BIOS

  5. On Finish, review memory, network and cores (Customize Settings to change them), then Finish.

    Finish screen summary

  6. Name and save the VM with something descriptive.

    Naming and saving the VM

  7. At the boot screen, choose Try or Install Ubuntu and press Enter. The installation begins.

    Ubuntu boot menu

    Installation starting

Follow the installer, then create your account. A restart may be needed.

  1. Choose your language.

    Language selection

  2. Set your accessibility options.

    Accessibility settings

  3. Set the keyboard layout.

    Keyboard layout

  4. Choose how to connect to the internet.

    Internet connection options

  5. Apply any updates the installer asks for (not every install needs this).

    Installer update prompt

    Installer updating

  1. Update the package lists:

    Terminal window
    sudo apt-get update

    apt-get update output

  2. Install YARA:

    Terminal window
    sudo apt-get install yara -y

    Installing YARA

  3. Check the version to confirm it worked:

    Terminal window
    yara --version

    yara –version output

The example uses a public RedLine Stealer sample. Its hashes:

Hash Value
MD5 0c341e00d3027a4a6ea5438f37f06677
SHA1 60717e853262eeae53ccc87da6940adb73aa9ce2
SHA256 1da56a5f2bbdc5215305e5e397bd3ed926f44520e145aa7bf2e6785b33f381e6

VirusTotal report

  1. Create a rule file:

    Terminal window
    cd ~/Desktop
    touch test_08_yara_rule.yar

    The new rule file on the desktop

  2. Open it in a text editor. A rule has three parts: meta (who wrote it and why), strings (what to look for) and condition (when it matches).

  3. Write the rule:

    rule test_08_potential_RedLineStealer
    {
    meta:
    author = "FName LName"
    date = "2024-06-27"
    description = "Test string search"
    strings:
    $string1 = "Apriorist.exe"
    $string2 = "Scripting.FileSystemObject"
    $string3 = "WScript.Shell"
    condition:
    ($string1 or $string2 or $string3)
    }
  4. Run it against a file:

    Terminal window
    yara test_08_yara_rule.yar <target file>

    If it matches, YARA prints the rule name and the file.

    YARA reporting a match

  5. Add -s to see which strings matched and where:

    Terminal window
    yara -s test_08_yara_rule.yar <target file>

One Reverse Look

"A little learning is a dangerous thing." ~ A. Pope

One Reverse Look · Made with ❤ · Your friendly knowledge seeker