Skip to content

Instantly share code, notes, and snippets.

@stvemillertime
stvemillertime / regopenparams_rule_writer.yar
Created January 28, 2024 20:25
a rule that writes other rules (almost)
import "pe"
import "console"
private rule rulewriter_regopenparams_miner {
meta:
author = "Greg Lesnewich"
description = "mine out API calls that are x-ref'd from things that might be registry values being pushed to the stack "
reference = "https://learn.microsoft.com/en-us/windows/win32/sysinfo/predefined-keys"
date = "2024-01-28"
version = "1"
@stvemillertime
stvemillertime / copy_yara_format_bytes.py
Created January 17, 2024 02:29 — forked from utkonos/copy_yara_format_bytes.py
Binary Ninja plugin for copying opcode bytes to the clipboard formatted to YARA best practice
"""Binary Ninja plugin for copying opcode bytes to the clipboard formatted to YARA best practice."""
import json
from binaryninja.enums import InstructionTextTokenType, LinearDisassemblyLineType
from binaryninja.interaction import get_text_line_input
from binaryninja.plugin import PluginCommand
from binaryninja.settings import Settings
import PySide6
s = Settings()
@stvemillertime
stvemillertime / rich_header_yara.py
Created January 10, 2024 21:21 — forked from latonis/rich_header_yara.py
Rich Header YARA Rule Generator
#!/usr/bin/env python
import argparse
import binascii
import hashlib
import os
import re
import sys
import traceback
__author__ = "Jeff White [karttoon] @noottrak"

This Gist has been transfered into a Github Repo. You'll find the most recent version here.

YARA Performance Guidelines

When creating your rules for YARA keep in mind the following guidelines in order to get the best performance from them. This guide is based on ideas and recommendations by Victor M. Alvarez and WXS.

  • Revision 1.4, October 2020, applies to all YARA versions higher than 3.7
@stvemillertime
stvemillertime / mstscax_ole.yar
Created January 6, 2023 02:14 — forked from edeca/mstscax_ole.yar
Yara rule to detect documents (RTF/CDF/OOXML) using MsTscAx scripting controls
rule terminal_services_scripting {
meta:
author = "David Cannings"
description = "Microsoft Terminal Services Client Control (not safe for scripting)"
ref = "https://twitter.com/joe4security/status/1221765460502421504?s=20%E2%80%9D"
generated_by = "yaml2yara, see https://github.com/nccgroup/yaml2yara/"
strings:
// Parsers will open files without the full 'rtf'
$header_rtf = "{\\rt" nocase
@stvemillertime
stvemillertime / yara_example_1.yar
Created January 6, 2023 02:13 — forked from edeca/yara_example_1.yar
Yara rule to find a string near to other strings
import "math"
rule example {
meta:
author = "David Cannings"
description = "Rule example - finding a chunk of code near other known code"
strings:
$chunk = { AA BB CC DD }
$chunk_prologue = { 11 22 33 44 }
@stvemillertime
stvemillertime / high_entropy_pe_rules.yar
Created January 6, 2023 02:13 — forked from edeca/high_entropy_pe_rules.yar
Variations on Yara rules by @greglesnewich
/*
Original rule from: https://gist.github.com/g-les/0745a9d6cd7f4abb3083a8dee1eaf984
Two variations on the original rule by @greglesnewich.
Conversation on Twitter at: https://twitter.com/edeca/status/1477650229709225990
*/
@stvemillertime
stvemillertime / server.py
Created November 4, 2022 13:51 — forked from ecks/server.py
Carbanak Server
import socket
import hashlib
import struct
import time
class IdUid:
def __init__(self):
@stvemillertime
stvemillertime / nozomi_upx.yara
Created October 4, 2022 12:23 — forked from notareverser/nozomi_upx.yara
YARA signatures derived from Nozomi UPX recovery tool https://github.com/NozomiNetworks/upx-recovery-tool
// https://github.com/NozomiNetworks/upx-recovery-tool
rule UPX_nozomi_x86
{
strings: $sig = { 50 e8 ?? ?? 00 00 eb 5a 58 59 97 60 8a 54 24 20 e9 ?? ?? 00 00 60 8b 74 24 24 8b 7c 24 2c 83 cd}
condition: any of them
}
rule UPX_nozomi_x64
{
strings:
@stvemillertime
stvemillertime / 100_days_of_yara.yar
Created September 26, 2022 01:01 — forked from g-les/100_days_of_yara.yar
100 Days of YARA to be updated with rules & ideas as the year progresses
/*
Goals for #100DaysofYARA:
better understanding of bitwise operators
use math module beyond general entropy of a section / resource
position specific things beyond what PE module tells us
do some funky stuff with hashing
*/