Communitygithub.com

自動化IOC擴增

自動從多個威脅情報來源擴增原始入侵指標。

自動化IOC擴增 是什麼?

此技能提供了一套完整的自動化IOC(入侵指標)擴增工作流程,專為安全分析師和工程師設計,能顯著縮短平均分類時間(MTTT)。它支援 SOAR 平台(如 Cortex XSOAR、Splunk SOAR、Tines)以及 Python 環境。核心機制是建立一個管道,從 SIEM 警報中提取 IOC(IP、域名、URL、雜湊值),然後平行調用 VirusTotal、AbuseIPDB、Shodan、MISP 等多個威脅情報來源進行擴增。最後,它會聚合來源的資料,計算一個複合信心分數,並根據分數決定將警報升級、排入佇列或自動關閉。此技能也深入處理了速率限制(例如 VirusTotal 免費方案的每分鐘4次請求)、API 錯誤重試和結果快取等實務挑戰,確保管道高效且可靠。最終產出是一個標準化的 JSON 結果物件,可直接用於更新警報上下文,協助分析師做出更明智的決策。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/mukul975/Anthropic-Cybersecurity-Skills/tree/main/skills/automating-ioc-enrichment

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

自動化 IOC 擴增

使用時機

在以下情況下使用此技能:

  • 建立一個 SOAR 劇本,自動在將 SIEM 警報路由給分析師之前,為其補充威脅情報背景
  • 建立一個 Python 管道,用於從釣魚郵件提交中批量擴增 IOC
  • 藉由預先填入 VT、Shodan 和 MISP 資料的警報背景,縮短分析師的平均分類時間 (MTTT)

請勿在未經人工審查的情況下,將此技能用於完全自動化的封鎖決策——擴增自動化應輔助決策,而非針對高影響行動自主執行封鎖。

先決條件

  • SOAR 平台 (Cortex XSOAR、Splunk SOAR、Tines 或 n8n) 或 Python 3.9+ 環境
  • API 金鑰:VirusTotal、AbuseIPDB、Shodan,以及至少一個 TIP (MISP 或 OpenCTI)
  • 用於接收警報的 SIEM 整合端點
  • 每個 API 記錄的速率限制預算 (VT:免費方案每分鐘 4 次,企業版每分鐘 500 次)

工作流程

步驟 1:設計擴增管道架構

為每種 IOC 類型定義擴增流程:

SIEM 警報 → 提取 IOC → 分類類型 → 路由至擴增函式
  IP 位址 → AbuseIPDB + Shodan + VirusTotal IP + MISP
  網域 → VirusTotal Domain + PassiveTotal + Shodan + MISP
  URL → URLScan.io + VirusTotal URL + Google Safe Browse
  檔案雜湊 → VirusTotal Files + MalwareBazaar + MISP
→ 聚合結果 → 計算信心分數 → 更新警報 → 通知分析師

步驟 2:實作 Python 擴增函式

import requests
import time
from dataclasses import dataclass, field
from typing import Optional

RATE_LIMIT_DELAY = 0.25  # VT 免費方案每秒 4 個請求

@dataclass
class EnrichmentResult:
    ioc_value: str
    ioc_type: str
    vt_malicious: int = 0
    vt_total: int = 0
    abuse_confidence: int = 0
    shodan_ports: list = field(default_factory=list)
    misp_events: list = field(default_factory=list)
    confidence_score: int = 0

def enrich_ip(ip: str, vt_key: str, abuse_key: str, shodan_key: str) -> EnrichmentResult:
    result = EnrichmentResult(ip, "ip")

    # VirusTotal IP 查詢
    vt_resp = requests.get(
        f"https://www.virustotal.com/api/v3/ip_addresses/{ip}",
        headers={"x-apikey": vt_key}
    )
    if vt_resp.status_code == 200:
        stats = vt_resp.json()["data"]["attributes"]["last_analysis_stats"]
        result.vt_malicious = stats.get("malicious", 0)
        result.vt_total = sum(stats.values())

    time.sleep(RATE_LIMIT_DELAY)

    # AbuseIPDB
    abuse_resp = requests.get(
        "https://api.abuseipdb.com/api/v2/check",
        headers={"Key": abuse_key, "Accept": "application/json"},
        params={"ipAddress": ip, "maxAgeInDays": 90}
    )
    if abuse_resp.status_code == 200:
        result.abuse_confidence = abuse_resp.json()["data"]["abuseConfidenceScore"]

    # 計算複合信心分數
    result.confidence_score = min(
        (result.vt_malicious / max(result.vt_total, 1)) * 60 +
        (result.abuse_confidence / 100) * 40, 100
    )

    return result

def enrich_hash(sha256: str, vt_key: str) -> EnrichmentResult:
    result = EnrichmentResult(sha256, "sha256")
    vt_resp = requests.get(
        f"https://www.virustotal.com/api/v3/files/{sha256}",
        headers={"x-apikey": vt_key}
    )
    if vt_resp.status_code == 200:
        stats = vt_resp.json()["data"]["attributes"]["last_analysis_stats"]
        result.vt_malicious = stats.get("malicious", 0)
        result.vt_total = sum(stats.values())
        result.confidence_score = int((result.vt_malicious / max(result.vt_total, 1)) * 100)
    return result

步驟 3:建立 SOAR 劇本 (Cortex XSOAR)

在 Cortex XSOAR 中建立一個擴增劇本:

  1. 觸發條件:SIEM 中建立警報 (透過 webhook 或輪詢)
  2. 提取 IOC:使用「提取指標」任務,搭配 IP、網域、URL、雜湊的正規表達式模式
  3. 平行擴增:同時分發至多個擴增任務
  4. VT 擴增:調用 !vt-file-scan 或 !vt-ip-scan 指令
  5. AbuseIPDB 檢查:調用 !abuseipdb-check-ip 指令
  6. MISP 查詢:調用 !misp-search 進行交叉比對
  7. 分數聚合:Python 轉換任務,計算複合分數
  8. 條件路由:如果分數 ≥70 → 高優先級佇列;如果 40–69 → 中優先級;<40 → 自動關閉並附上註記
  9. 警報擴增:將擴增結果寫入警報上下文供分析師檢視

步驟 4:處理速率限制與失敗

import time
from functools import wraps

def rate_limited(max_per_second):
    min_interval = 1.0 / max_per_second
    def decorator(func):
        last_called = [0.0]
        @wraps(func)
        def wrapper(*args, **kwargs):
            elapsed = time.time() - last_called[0]
            wait = min_interval - elapsed
            if wait > 0:
                time.sleep(wait)
            result = func(*args, **kwargs)
            last_called[0] = time.time()
            return result
        return wrapper
    return decorator

def retry_on_429(max_retries=3):
    def decorator(func):
        @wraps(func)
        def wrapper(*args, **kwargs):
            for attempt in range(max_retries):
                response = func(*args, **kwargs)
                if response.status_code == 429:
                    retry_after = int(response.headers.get("Retry-After", 60))
                    time.sleep(retry_after)
                else:
                    return response
        return wrapper
    return decorator

步驟 5:指標與調校

每週追蹤管道的效能:

  • 擴增延遲:目標從警報觸發到產生擴增結果 <30 秒
  • API 成功率:目標 >99% (識別速率限制或中斷事件)
  • 真陽性率:追蹤分析師對自動信心分數的覆寫情況
  • 成本:追蹤 API 呼叫量與預算的比較 (VT Enterprise:每 100 萬次查詢 X 美元)

關鍵概念

術語定義
SOAR安全編排、自動化與回應 (Security Orchestration, Automation, and Response) — 用於自動化安全工作流程並整合不同工具的平臺
擴增劇本自動化工作流程序列,為原始安全事件添加背景情報
速率限制API 提供者對請求頻率的限制 (例如,VT 免費方案:每分鐘 4 個請求);管道必須遵守這些限制
複合信心分數使用加權公式從多個擴增來源聚合訊號的單一總分
扇出模式同時平行執行多個擴增查詢,以最小化總擴增延遲

工具與系統

  • Cortex XSOAR (Palo Alto):企業級 SOAR,擁有超過 700 個市集整合,包括 VT、MISP、Shodan 和 AbuseIPDB
  • Splunk SOAR (Phantom):SOAR 平臺,支援基於 Python 的劇本;與原生 Splunk SIEM 整合
  • Tines:無程式碼 SOAR 平臺,採用 webhook 驅動自動化;對較小團隊來說成本效益高
  • TheHive + Cortex:開源事故回應/擴增平臺,透過 Cortex 分析器進行可觀察項擴增

常見陷阱

  • 因擴增延遲而阻塞:如果擴增時間超過 5 分鐘,分析師就會開始處理未擴增的警報,失去擴增的意義。應設定逾時限制並提供部分結果。
  • 未使用快取:查詢同一個 IOC 50 次會產生不必要的 API 成本。預設情況下,將擴增結果快取 24 小時。
  • 靜默忽略 API 失敗:失敗的擴增呼叫應被記錄並觸發備援邏輯,而不是默默產生空結果,讓 IOC 看起來是乾淨的。
  • 僅根據擴增分數自動封鎖:複合分數包含誤報;對共享基礎設施的封鎖決策需要人工確認。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

abusing-dpapi-for-credential-access

Extract and decrypt Windows DPAPI-protected secrets (Credential Manager, browser logins/cookies, Wi-Fi credentials, KeePass keys) online or offline using SharpDPAPI, SharpChrome, Mimikatz, or Impacket

abusing-shadow-credentials-for-privesc

Take over Active Directory accounts by writing attacker-controlled public keys to msDS-KeyCredentialLink (Shadow Credentials) with pyWhisker, Whisker, or Certipy, then authenticate via PKINIT to recover the target

achieving-cmmc-level-2-compliance

>-

acquiring-disk-image-with-dd-and-dcfldd

Create forensically sound bit-for-bit disk images with dd or dcfldd on a Linux forensic workstation, preserving evidence integrity through hash verification (MD5/SHA) during acquisition. Use when imaging a suspect drive, USB device, or memory card for investigation, preserving volatile disk evidence during incident response, or producing a verified copy for legal or law-enforcement proceedings before any destructive analysis.

analyzing-active-directory-acl-abuse

Detect dangerous ACL misconfigurations in Active Directory using ldap3

analyzing-android-malware-with-apktool

Perform static analysis of Android APK malware using apktool for resource decompilation, jadx for Java source recovery, and androguard for manifest inspection, dangerous permission-combination detection, and identification of obfuscated code, dynamic code loading, and reflection-based API calls. Use to statically triage a suspicious APK without executing it or to build mobile malware detection rules.

analyzing-api-gateway-access-logs

Parses API Gateway access logs (AWS API Gateway, Kong, Nginx) to detect

analyzing-apt-group-with-mitre-navigator

Query ATT&CK data with attackcti, mitreattack-python, and stix2, then build MITRE ATT&CK Navigator layers and multi-layer heatmap overlays mapping one or more APT groups

analyzing-azure-activity-logs-for-threats

Queries Azure Monitor activity logs and sign-in logs via azure-monitor-query

analyzing-bootkit-and-rootkit-samples

Analyzes bootkit and advanced rootkit malware infecting the Master

analyzing-browser-forensics-with-hindsight

Parse Chromium-based browser databases with Hindsight to extract and correlate browsing history, downloads, cookies, cached content, autofill data, saved passwords, and extensions from Chrome, Edge, Brave, Opera, and Vivaldi into a unified timeline (XLSX, JSON, or SQLite output). Use during incident response, insider-threat investigations, or criminal cases when you need to reconstruct a user

analyzing-campaign-attribution-evidence

Systematically evaluate cyber-campaign evidence to attribute an operation to a threat actor, using the Diamond Model and Analysis of Competing Hypotheses (ACH) to weigh infrastructure overlaps, TTP consistency, malware code similarity, and timing/language artifacts into confidence-weighted attribution assessments. Use when an incident investigation needs a defensible attribution confidence level.

analyzing-certificate-transparency-for-phishing

Monitor Certificate Transparency logs using crt.sh and Certstream to

analyzing-cloud-storage-access-patterns

Detect abnormal access in AWS S3, GCS, and Azure Blob Storage by analyzing CloudTrail Data Events, GCS audit logs, and Azure Storage Analytics for after-hours bulk downloads, new-IP access, and API-call spikes (e.g. GetObject) via statistical baselines and time-series anomaly detection. Use when investigating suspected cloud data exfiltration or building related detection rules.

analyzing-cobalt-strike-beacon-configuration

Extract and analyze Cobalt Strike beacon configuration from PE files

analyzing-cobaltstrike-malleable-c2-profiles

Parse and analyze Cobalt Strike Malleable C2 profiles with dissect.cobaltstrike (profiles and beacon-payload configs) and pyMalleableC2 (AST parsing) to extract HTTP/DNS transforms, URIs, headers, sleep/jitter, and injection behavior, then generate network detection signatures. Use when reverse-engineering a captured malleable profile or building detections against Cobalt Strike Beacon traffic.

analyzing-command-and-control-communication

Analyzes malware C2 communication over HTTP, HTTPS, DNS, and custom

analyzing-cyber-kill-chain

Analyzes intrusion activity against the Lockheed Martin Cyber Kill Chain

analyzing-disk-image-with-autopsy

Perform comprehensive forensic analysis of raw (dd), E01, or AFF disk images with Autopsy and The Sleuth Kit, recovering deleted files, examining metadata and embedded artifacts, keyword searching, and building investigation timelines with visual reports. Use for structured analysis of a forensic disk image or when stakeholders need visual reports from evidence.

analyzing-dns-logs-for-exfiltration

Analyzes DNS query logs to detect data exfiltration via DNS tunneling,

相關技能