본문으로 건너뛰기
Skillpedia
보안6.5k · #13978

ti-yara-hunting

하는 일

이 스킬은 악성코드 샘플과 분석 메모를 파일과 일치하는 YARA 규칙으로 바꾸는 방법을 설명합니다. 탐지 규칙을 만드는 악성코드 분석가와 보안 팀을 위한 스킬입니다.

사용하는 경우

  • ✓분석가가 분석한 악성코드 샘플로 YARA 규칙을 작성해 달라고 요청할 때.
  • ✓에이전트가 규칙을 빠르고 정상 파일과 지나치게 많이 일치하지 않도록 조정해야 할 때.
  • ✓팀이 승인된 규칙으로 대량의 파일 모음에서 변종을 검색하려는 경우.

스킬 링크

https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/ti-yara-hunting/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/BitterSecurity/Decepticon/blob/main/packages/decepticon/decepticon/skills/standard/analyst/ti-yara-hunting/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 샘플의 문자열과 동작으로 YARA 규칙을 작성하고, 정상 파일과 일치하지 않는지 확인해 주시겠어요?”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 샘플에서 식별력 있는 문자열과 구조를 고르고, 규칙을 작성하고, 구문을 확인한 뒤, 깨끗한 집합과 악성 집합에 대해 테스트합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

YARA Hunting

Write YARA rules from malware samples, behavioral observations, and threat intelligence reports. Deploy rules for retrohunting across VirusTotal (500M+ files) and ANY.RUN (2TB malware corpus) to discover campaign variants, earlier versions, and related infrastructure.

Quick Reference

# Install YARA
apt-get install -y yara || pip install yara-python

# Install YARA-X (Rust rewrite — faster, stricter)
cargo install yara-x

# Install yarGen for automated rule generation
git clone https://github.com/Neo23x0/yarGen.git /opt/yarGen
cd /opt/yarGen && pip install -r requirements.txt
python3 yarGen.py --update  # Download goodware string DB (first run only)

# Scan a file with a rule
yara /workspace/rules/suspect.yar /workspace/samples/

# Compile rules for faster scanning
yarac /workspace/rules/*.yar /workspace/rules/compiled.yarc
yara /workspace/rules/compiled.yarc /workspace/samples/

# Validate rule syntax (YARA-X — stricter parser)
yr check /workspace/rules/suspect.yar

MITRE ATT&CK Mapping

Technique ID Relevance
Obtain Capabilities: Exploits T1588.005 YARA identifies exploit tools/payloads in attacker arsenals
Develop Capabilities: Malware T1587.001 Rules detect custom malware based on unique strings/structures
Gather Victim Host Information: Software T1592.002 YARA scans reveal installed malware on victim hosts
Indicator Removal on Host T1070 Retrohunting finds samples attackers attempted to erase

1. YARA Rule Syntax

Minimal Rule Structure

rule Malware_FamilyName_Variant {
    meta:
        author      = "Decepticon TI"
        date        = "2025-01-01"
        description = "Detects FamilyName variant based on unique strings"
        hash        = "e3b0c44298fc1c149afbf4c8996fb924..."
        reference   = "https://report-url"
        tlp         = "WHITE"

    strings:
        $s1 = "unique_string_from_sample" ascii wide
        $s2 = { 4D 5A 90 00 03 00 00 00 }  // MZ header + specific bytes
        $s3 = /https?:\/\/[a-z0-9\-\.]+\/gate\.php/ nocase

    condition:
        uint16(0) == 0x5A4D and    // PE file check
        filesize < 5MB and
        2 of ($s*)
}

String Types

strings:
    // Text strings
    $text1 = "CreateRemoteThread"           // ASCII exact
    $text2 = "CreateRemoteThread" ascii wide // Both encodings
    $text3 = "http://c2.evil.com" nocase    // Case insensitive
    $text4 = "cmd /c" fullword              // Word boundary match

    // Hex strings (byte patterns)
    $hex1 = { 48 8B 05 ?? ?? ?? ?? }        // ?? = any byte (wildcard)
    $hex2 = { 4D 5A [0-200] 50 45 00 00 }   // Jump 0-200 bytes
    $hex3 = { ( 74 | 75 ) 0? }              // Alternation: je or jne

    // Regex strings
    $re1 = /https?:\/\/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}(:\d+)?\/[a-z]+\.php/
    $re2 = /[A-Za-z0-9+\/]{50,}={0,2}/      // Base64 blob

    // XOR-encoded strings (YARA 4.0+)
    $xor1 = "This program cannot" xor       // All single-byte XOR keys
    $xor2 = "config_url" xor(0x01-0xFF)     // Specific XOR range

    // Base64-encoded strings (YARA 4.0+)
    $b64 = "powershell" base64 base64wide

Condition Essentials

condition:
    // File type guards (always lead with these)
    uint16(0) == 0x5A4D                     // PE (MZ header)
    uint32(0) == 0x464C457F                 // ELF
    uint16(0) == 0x4B50                     // ZIP/DOCX/XLSX (PK)

    // String matching
    all of them                             // Every string must match
    any of them                             // At least one
    2 of ($s*)                              // 2+ from $s group
    3 of ($api*) and 1 of ($str*)           // Mixed groups
    #s1 > 5                                 // $s1 appears 5+ times

    // Size + offset constraints
    filesize < 1MB
    $mz at 0                                // $mz must be at offset 0
    $s1 in (0..1024)                        // $s1 in first 1KB

    // PE module (import pe)
    pe.imports("kernel32.dll", "VirtualAlloc")
    pe.number_of_sections > 6

    // Math module (import math)
    math.entropy(0, filesize) > 7.0         // High entropy (packed)

    // Typical combined condition
    uint16(0) == 0x5A4D and filesize < 2MB and
    (2 of ($s*) or all of ($api*))

2. Writing Rules from Malware Samples

Step-by-Step: Sample to Rule

# Step 1: Extract strings from sample
strings -n 6 /workspace/samples/<SAMPLE> > /
자주 묻는 질문

YARA 규칙이란 무엇인가요?

악성코드의 특징, 예컨대 텍스트 문자열이나 파일 구조를 설명해 스캐너가 일치하는 것을 찾도록 하는 패턴 파일입니다.

정상 파일에 대해 왜 테스트하나요?

스킬은 정상 파일과 많이 일치하는 규칙은 노이즈를 만들고 분석가의 시간을 낭비한다고 설명합니다.

스킬은 어떤 도구를 언급하나요?

YARA, YARA-X, 그리고 규칙을 만드는 yarGen 생성기를 언급합니다.

상세 정보

작성자의 원본 설명

YARA rule writing from behavioral observations and TI report analysis — sample-to-rule conversion, condition optimization, performance tuning, and retrohunting on VirusTotal and ANY.RUN. Covers YARA/YARA-X syntax, yarGen automated generation, and production rule deployment.

repo: BitterSecurity/Decepticon

인기도

GitHub 스타
6.5k
순위
#13978
라이선스
Apache-2.0
업데이트
2026. 11. 1.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬