[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M73BGRW21DQA5RYKWD0M9YPC":3,"skill-same:01M73BGRW21DQA5RYKWD0M9YPC":89},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":49,"commitSha":50,"skillDirectory":51,"forksCount":52,"repositoryHtmlUrl":53,"repositoryHomepageUrl":54,"ownerHtmlUrl":55,"ownerBlogUrl":56,"ownerDescription":57,"updatedAt":58,"install":59,"resources":72},"01M73BGRW21DQA5RYKWD0M9YPC","extracting-iocs-from-malware-samples",null,"Extracts indicators of compromise (IOCs) from malware samples including file hashes, network indicators (IPs, domains, URLs), host artifacts (file paths, registry keys, mutexes), and behavioral patterns for threat intelligence sharing and detection rule creation. Activates for requests involving IOC extraction, threat indicator harvesting, malware indicator collection, or building detection content from samples.","Horonomos-laps\u002FYana-AI","Horonomos-laps","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F355299122?v=4","01M76B3QPXE88ET2SQPDPVATZT"," Horonomos-laps","01M72ZQRJPCYPSSWT4D00VJR2A",13,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fextracting-iocs-from-malware-samples\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fextracting-iocs-from-malware-samples\u002FSKILL.md",[],[],"2026-11-11 15:11:14",false,"---\nname: extracting-iocs-from-malware-samples\ndescription: 'Extracts indicators of compromise (IOCs) from malware samples including\n  file hashes, network indicators (IPs, domains, URLs), host artifacts (file paths,\n  registry keys, mutexes), and behavioral patterns for threat intelligence sharing\n  and detection rule creation. Activates for requests involving IOC extraction, threat\n  indicator harvesting, malware indicator collection, or building detection content\n  from samples.\n\n  '\ndomain: cybersecurity\nsubdomain: malware-analysis\ntags:\n- malware\n- IOC-extraction\n- threat-intelligence\n- indicators\n- detection\nversion: 1.0.0\nauthor: mahipal\nlicense: Apache-2.0\nnist_csf:\n- DE.AE-02\n- RS.AN-03\n- ID.RA-01\n- DE.CM-01\nmitre_attack:\n- T1027\n- T1055\n- T1140\n- T1497\nsource: https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\nsource_commit: 04450304b12645cb2b974ab96d28c0664758a88d\nnote: \"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.\"\n---\n\n# Extracting IOCs from Malware Samples\n\n## When to Use\n\n- A malware analysis (static or dynamic) is complete and actionable indicators need to be extracted for defense teams\n- Building blocklists for firewalls, proxies, and DNS sinkholes from analyzed samples\n- Creating YARA rules, Snort\u002FSuricata signatures, or SIEM detection content from malware artifacts\n- Contributing to threat intelligence sharing platforms (MISP, OTX, ThreatConnect)\n- Tracking malware campaigns by correlating IOCs across multiple samples\n\n**Do not use** for IOCs from unverified sources without validation; false positives in blocklists can disrupt legitimate business operations.\n\n## Prerequisites\n\n- Python 3.8+ with `iocextract`, `pefile`, `yara-python` libraries installed\n- Completed malware analysis report (static analysis, dynamic analysis, or reverse engineering)\n- Access to PCAP files, memory dumps, or sandbox reports from the analysis\n- MISP instance or STIX\u002FTAXII server for structured IOC sharing\n- VirusTotal API key for IOC enrichment and validation\n- CyberChef for decoding obfuscated indicators\n\n## Workflow\n\n### Step 1: Extract File-Based IOCs\n\nCompute hashes and identify file metadata indicators:\n\n```bash\n# Generate all standard hashes\nmd5sum malware_sample.exe\nsha1sum malware_sample.exe\nsha256sum malware_sample.exe\n\n# Generate ssdeep fuzzy hash for similarity matching\nssdeep malware_sample.exe\n\n# Generate imphash (import hash) for PE files\npython3 -c \"\nimport pefile\npe = pefile.PE('malware_sample.exe')\nprint(f'Imphash: {pe.get_imphash()}')\n\"\n\n# Generate TLSH (Trend Micro Locality Sensitive Hash)\npython3 -c \"\nimport tlsh\nwith open('malware_sample.exe', 'rb') as f:\n    h = tlsh.hash(f.read())\nprint(f'TLSH: {h}')\n\"\n\n# Compile file metadata IOCs\npython3 \u003C\u003C 'PYEOF'\nimport pefile\nimport os\nimport hashlib\nimport datetime\n\npe = pefile.PE(\"malware_sample.exe\")\n\nprint(\"FILE IOCs:\")\nwith open(\"malware_sample.exe\", \"rb\") as f:\n    data = f.read()\n    print(f\"  MD5:        {hashlib.md5(data).hexdigest()}\")\n    print(f\"  SHA-1:      {hashlib.sha1(data).hexdigest()}\")\n    print(f\"  SHA-256:    {hashlib.sha256(data).hexdigest()}\")\n    print(f\"  File Size:  {len(data)} bytes\")\n\nts = pe.FILE_HEADER.TimeDateStamp\nprint(f\"  Compile:    {datetime.datetime.utcfromtimestamp(ts)} UTC\")\nprint(f\"  Imphash:    {pe.get_imphash()}\")\nPYEOF\n```\n\n### Step 2: Extract Network IOCs\n\nPull network indicators from strings, PCAP, and sandbox reports:\n\n```python\n# Extract network IOCs from strings\nimport re\n\nwith open(\"malware_sample.exe\", \"rb\") as f:\n    data = f.read()\n\n# Extract ASCII and Unicode strings\nascii_strings = re.findall(b'[ -~]{4,}', data)\nunicode_strings = re.findall(b'(?:[ -~]\\x00){4,}', data)\n\nall_strings = [s.decode('ascii', errors='ignore') for s in ascii_strings]\nall_strings += [s.decode('utf-16-le', errors='ignore') for s in unicode_strings]\n\n# IP addresses (excluding private ranges for C2 indicators)\nip_pattern = re.compile(r'\\b(?:(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)\\b')\nips = set()\nfor s in all_strings:\n    for ip in ip_pattern.findall(s):\n        # Filter out private\u002Freserved ranges\n        octets = [int(o) for o in ip.split('.')]\n        if octets[0] not in [10, 127, 0] and not (octets[0] == 172 and 16 \u003C= octets[1] \u003C= 31) and not (octets[0] == 192 and octets[1] == 168):\n            ips.add(ip)\n\n# Domain names\ndomain_pattern = re.compile(r'\\b[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z]{2,})+\\b')\ndomains = set()\nfor s in all_strings:\n    for d in domain_pattern.findall(s):\n        if not d.endswith(('.dll', '.exe', '.sys', '.com.au')):\n            domains.add(d)\n\n# URLs\nurl_pattern = re.compile(r'https?:\u002F\u002F[^\\s\u003C>\"{}|\\\\^`\\[\\]]+')\nurls = set()\nfor s in all_strings:\n    for u in url_pattern.findall(s):\n        urls.add(u)\n\nprint(\"NETWORK IOCs:\")\nprint(f\"  IPs:     {ips}\")\nprint(f\"  Domains: {domains}\")\nprint(f\"  URLs:    {urls}\")\n```\n\n### Step 3: Extract Host-Based IOCs\n\nIdentify file paths, registry keys, mutexes, and services:\n\n```python\n# Extract host-based IOCs from sandbox report\nimport json\n\nwith open(\"cuckoo_report.json\") as f:\n    report = json.load(f)\n\nprint(\"HOST IOCs:\")\n\n# File paths created or modified\nprint(\"\\nFile Paths:\")\nfor f in report[\"behavior\"][\"summary\"].get(\"files\", []):\n    if any(p in f.lower() for p in [\"temp\", \"appdata\", \"system32\", \"programdata\"]):\n        print(f\"  [DROPPED] {f}\")\n\n# Registry keys for persistence\nprint(\"\\nRegistry Keys:\")\nfor key in report[\"behavior\"][\"summary\"].get(\"write_keys\", []):\n    if any(p in key.lower() for p in [\"run\", \"service\", \"startup\", \"shell\"]):\n        print(f\"  [PERSIST] {key}\")\n\n# Mutexes (unique to malware family)\nprint(\"\\nMutexes:\")\nfor mutex in report[\"behavior\"][\"summary\"].get(\"mutexes\", []):\n    if mutex not in [\"Local\\\\!IETld!Mutex\", \"RasPbFile\"]:  # Filter known Windows mutexes\n        print(f\"  [MUTEX] {mutex}\")\n\n# Created services\nprint(\"\\nServices:\")\nfor svc in report[\"behavior\"][\"summary\"].get(\"started_services\", []):\n    print(f\"  [SERVICE] {svc}\")\n```\n\n### Step 4: Extract Network IOCs from PCAP\n\nParse network captures for additional indicators:\n\n```bash\n# Extract DNS queries from PCAP\ntshark -r capture.pcap -T fields -e dns.qry.name -Y \"dns.flags.response == 0\" | sort -u\n\n# Extract HTTP hosts and URLs\ntshark -r capture.pcap -T fields -e http.host -e http.request.uri -Y \"http.request\" | sort -u\n\n# Extract TLS server names (SNI)\ntshark -r capture.pcap -T fields -e tls.handshake.extensions_server_name -Y \"tls.handshake.type == 1\" | sort -u\n\n# Extract JA3 hashes\ntshark -r capture.pcap -T fields -e tls.handshake.ja3 -Y \"tls.handshake.type == 1\" | sort -u\n\n# Extract unique destination IPs\ntshark -r capture.pcap -T fields -e ip.dst -Y \"ip.src == 10.0.2.15\" | sort -u\n\n# Extract User-Agent strings\ntshark -r capture.pcap -T fields -e http.user_agent -Y \"http.user_agent\" | sort -u\n```\n\n### Step 5: Defang and Validate IOCs\n\nDefang indicators for safe sharing and validate against threat intelligence:\n\n```python\n# Defang IOCs for safe sharing\ndef defang_ip(ip):\n    return ip.replace(\".\", \"[.]\")\n\ndef defang_url(url):\n    return url.replace(\"http\", \"hxxp\").replace(\".\", \"[.]\")\n\ndef defang_domain(domain):\n    return domain.replace(\".\", \"[.]\")\n\n# Validate IOCs against VirusTotal\nimport requests\n\nVT_API_KEY = \"your_api_key\"\n\ndef check_vt_ip(ip):\n    resp = requests.get(f\"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fip_addresses\u002F{ip}\",\n                       headers={\"x-apikey\": VT_API_KEY})\n    data = resp.json()\n    stats = data[\"data\"][\"attributes\"][\"last_analysis_stats\"]\n    return stats[\"malicious\"]\n\ndef check_vt_domain(domain):\n    resp = requests.get(f\"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fdomains\u002F{domain}\",\n                       headers={\"x-apikey\": VT_API_KEY})\n    data = resp.json()\n    stats = data[\"data\"][\"attributes\"][\"last_analysis_stats\"]\n    return stats[\"malicious\"]\n\n# Validate each IOC\nfor ip in ips:\n    detections = check_vt_ip(ip)\n    print(f\"  {defang_ip(ip)} - VT: {detections} detections\")\n```\n\n### Step 6: Export IOCs in Standard Formats\n\nGenerate structured IOC outputs for sharing and ingestion:\n\n```python\n# Export as STIX 2.1 bundle\nfrom stix2 import Indicator, Bundle, Malware, Relationship\nimport datetime\n\nindicators = []\n\n# File hash indicator\nindicators.append(Indicator(\n    name=\"Malware SHA-256 Hash\",\n    pattern=f\"[file:hashes.'SHA-256' = '{sha256_hash}']\",\n    pattern_type=\"stix\",\n    valid_from=datetime.datetime.now(datetime.timezone.utc),\n    labels=[\"malicious-activity\"]\n))\n\n# IP indicator\nfor ip in ips:\n    indicators.append(Indicator(\n        name=f\"C2 IP Address {ip}\",\n        pattern=f\"[ipv4-addr:value = '{ip}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.datetime.now(datetime.timezone.utc),\n        labels=[\"malicious-activity\"]\n    ))\n\n# Domain indicator\nfor domain in domains:\n    indicators.append(Indicator(\n        name=f\"C2 Domain {domain}\",\n        pattern=f\"[domain-name:value = '{domain}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.datetime.now(datetime.timezone.utc),\n        labels=[\"malicious-activity\"]\n    ))\n\nbundle = Bundle(objects=indicators)\nwith open(\"iocs_stix.json\", \"w\") as f:\n    f.write(bundle.serialize(pretty=True))\n\n# Export as CSV for SIEM ingestion\nimport csv\nwith open(\"iocs.csv\", \"w\", newline=\"\") as f:\n    writer = csv.writer(f)\n    writer.writerow([\"type\", \"value\", \"context\", \"confidence\"])\n    writer.writerow([\"sha256\", sha256_hash, \"malware_sample\", \"high\"])\n    for ip in ips:\n        writer.writerow([\"ipv4\", ip, \"c2_server\", \"high\"])\n    for domain in domains:\n        writer.writerow([\"domain\", domain, \"c2_domain\", \"high\"])\n    for url in urls:\n        writer.writerow([\"url\", url, \"c2_url\", \"high\"])\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **IOC (Indicator of Compromise)** | Forensic artifact observed in a network or system that indicates a potential intrusion: hashes, IPs, domains, file paths, registry keys |\n| **Defanging** | Modifying IOCs to prevent accidental activation (e.g., replacing dots with [.] in URLs and IPs for safe sharing in reports) |\n| **Imphash** | MD5 hash of the import table functions in a PE file; samples from the same malware family often share the same imphash |\n| **STIX\u002FTAXII** | Structured Threat Information Expression \u002F Trusted Automated Exchange; standards for encoding and transmitting threat intelligence |\n| **JA3\u002FJA3S** | TLS client\u002Fserver fingerprint based on ClientHello\u002FServerHello parameters; identifies specific malware families by their TLS implementation |\n| **Fuzzy Hashing (ssdeep)** | Context-triggered piecewise hashing that identifies similar files even with minor modifications; useful for malware variant detection |\n| **MISP** | Malware Information Sharing Platform; open-source threat intelligence platform for collecting, storing, and sharing IOCs |\n\n## Tools & Systems\n\n- **iocextract (Python)**: Automated IOC extraction library supporting IPs, URLs, domains, hashes, and YARA rules from text\n- **MISP**: Open-source threat intelligence sharing platform for structured IOC management and distribution\n- **CyberChef**: Web-based tool for decoding, decrypting, and transforming data useful for deobfuscating encoded IOCs\n- **tshark**: Command-line network protocol analyzer for extracting network IOCs from PCAP files\n- **VirusTotal**: Online service for validating and enriching IOCs with community detection results and threat intelligence\n\n## Common Scenarios\n\n### Scenario: Building a Comprehensive IOC Package from a Ransomware Sample\n\n**Context**: A ransomware incident requires rapid IOC extraction for blocking across the enterprise while the full investigation continues. Multiple data sources are available: the sample binary, PCAP from network monitoring, and a Cuckoo sandbox report.\n\n**Approach**:\n1. Compute all file hashes (MD5, SHA-1, SHA-256, imphash, ssdeep) for the ransomware binary and any dropped files\n2. Extract network IOCs from strings in the binary (hardcoded C2 addresses)\n3. Parse the PCAP for DNS queries, HTTP requests, and TLS SNI fields\n4. Extract host IOCs from the sandbox report (file paths, registry keys, mutexes, ransom note filenames)\n5. Validate all network IOCs against VirusTotal to confirm malicious status and check for known associations\n6. Defang all indicators and compile into STIX 2.1 format for sharing and CSV for SIEM ingestion\n7. Submit to MISP event for organizational and community sharing\n\n**Pitfalls**:\n- Including IP addresses of legitimate CDNs or cloud services without validating context (e.g., AWS IPs used for hosting, not inherently malicious)\n- Not defanging URLs and IPs in reports, leading to accidental clicks or DNS resolution\n- Extracting strings from packed binaries (IOCs from packed samples are unreliable; unpack first)\n- Forgetting to include dropped file hashes (the initial dropper and the final payload are separate IOCs)\n\n## Output Format\n\n```\nIOC EXTRACTION REPORT\n======================\nSample:           ransomware.exe\nAnalysis Date:    2025-09-15\nAnalyst:          [Name]\n\nFILE INDICATORS\nSHA-256:          e3b0c44298fc1c149afbf4c8996fb924...\nSHA-1:            da39a3ee5e6b4b0d3255bfef95601890afd80709\nMD5:              d41d8cd98f00b204e9800998ecf8427e\nImphash:          a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6\nssdeep:           3072:kJh3bN7fY+aUkJh3bN7fY+aU:kJh3R7aUkJh3R7aU\n\nNETWORK INDICATORS\nC2 IPs:           185.220.101[.]42, 91.215.85[.]17\nC2 Domains:       update.malicious[.]com, backup.evil[.]net\nC2 URLs:          hxxps:\u002F\u002Fupdate.malicious[.]com\u002Fgate.php\n                  hxxps:\u002F\u002Fbackup.evil[.]net\u002Fgate.php\nJA3 Hash:         a0e9f5d64349fb13191bc781f81f42e1\nUser-Agent:       Mozilla\u002F5.0 (compatible; MSIE 10.0)\n\nHOST INDICATORS\nFile Paths:       C:\\Users\\Public\\svchost.exe\n                  C:\\Users\\%USER%\\AppData\\Local\\Temp\\payload.dll\n                  C:\\Users\\%USER%\\Desktop\\README_DECRYPT.txt\nRegistry Keys:    HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\WindowsUpdate\nMutexes:          Global\\CryptLocker_2025_Q3\nServices:         FakeWindowsUpdate\n\nCONFIDENCE ASSESSMENT\nHigh Confidence:  SHA-256, C2 IPs (validated via VT), Mutexes\nMedium Confidence: Domains (could be compromised legitimate sites)\nLow Confidence:   User-Agent (common string, high false positive risk)\n\nEXPORT FILES\nstix_bundle.json  - STIX 2.1 format for TIP ingestion\niocs.csv          - Flat CSV for SIEM blocklist import\nyara_rule.yar     - YARA detection rule\n```\n","# Extracting IOCs from Malware Samples\n\n## When to Use\n\n- A malware analysis (static or dynamic) is complete and actionable indicators need to be extracted for defense teams\n- Building blocklists for firewalls, proxies, and DNS sinkholes from analyzed samples\n- Creating YARA rules, Snort\u002FSuricata signatures, or SIEM detection content from malware artifacts\n- Contributing to threat intelligence sharing platforms (MISP, OTX, ThreatConnect)\n- Tracking malware campaigns by correlating IOCs across multiple samples\n\n**Do not use** for IOCs from unverified sources without validation; false positives in blocklists can disrupt legitimate business operations.\n\n## Prerequisites\n\n- Python 3.8+ with `iocextract`, `pefile`, `yara-python` libraries installed\n- Completed malware analysis report (static analysis, dynamic analysis, or reverse engineering)\n- Access to PCAP files, memory dumps, or sandbox reports from the analysis\n- MISP instance or STIX\u002FTAXII server for structured IOC sharing\n- VirusTotal API key for IOC enrichment and validation\n- CyberChef for decoding obfuscated indicators\n\n## Workflow\n\n### Step 1: Extract File-Based IOCs\n\nCompute hashes and identify file metadata indicators:\n\n```bash\n# Generate all standard hashes\nmd5sum malware_sample.exe\nsha1sum malware_sample.exe\nsha256sum malware_sample.exe\n\n# Generate ssdeep fuzzy hash for similarity matching\nssdeep malware_sample.exe\n\n# Generate imphash (import hash) for PE files\npython3 -c \"\nimport pefile\npe = pefile.PE('malware_sample.exe')\nprint(f'Imphash: {pe.get_imphash()}')\n\"\n\n# Generate TLSH (Trend Micro Locality Sensitive Hash)\npython3 -c \"\nimport tlsh\nwith open('malware_sample.exe', 'rb') as f:\n    h = tlsh.hash(f.read())\nprint(f'TLSH: {h}')\n\"\n\n# Compile file metadata IOCs\npython3 \u003C\u003C 'PYEOF'\nimport pefile\nimport os\nimport hashlib\nimport datetime\n\npe = pefile.PE(\"malware_sample.exe\")\n\nprint(\"FILE IOCs:\")\nwith open(\"malware_sample.exe\", \"rb\") as f:\n    data = f.read()\n    print(f\"  MD5:        {hashlib.md5(data).hexdigest()}\")\n    print(f\"  SHA-1:      {hashlib.sha1(data).hexdigest()}\")\n    print(f\"  SHA-256:    {hashlib.sha256(data).hexdigest()}\")\n    print(f\"  File Size:  {len(data)} bytes\")\n\nts = pe.FILE_HEADER.TimeDateStamp\nprint(f\"  Compile:    {datetime.datetime.utcfromtimestamp(ts)} UTC\")\nprint(f\"  Imphash:    {pe.get_imphash()}\")\nPYEOF\n```\n\n### Step 2: Extract Network IOCs\n\nPull network indicators from strings, PCAP, and sandbox reports:\n\n```python\n# Extract network IOCs from strings\nimport re\n\nwith open(\"malware_sample.exe\", \"rb\") as f:\n    data = f.read()\n\n# Extract ASCII and Unicode strings\nascii_strings = re.findall(b'[ -~]{4,}', data)\nunicode_strings = re.findall(b'(?:[ -~]\\x00){4,}', data)\n\nall_strings = [s.decode('ascii', errors='ignore') for s in ascii_strings]\nall_strings += [s.decode('utf-16-le', errors='ignore') for s in unicode_strings]\n\n# IP addresses (excluding private ranges for C2 indicators)\nip_pattern = re.compile(r'\\b(?:(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)\\.){3}(?:25[0-5]|2[0-4]\\d|1\\d{2}|[1-9]?\\d)\\b')\nips = set()\nfor s in all_strings:\n    for ip in ip_pattern.findall(s):\n        # Filter out private\u002Freserved ranges\n        octets = [int(o) for o in ip.split('.')]\n        if octets[0] not in [10, 127, 0] and not (octets[0] == 172 and 16 \u003C= octets[1] \u003C= 31) and not (octets[0] == 192 and octets[1] == 168):\n            ips.add(ip)\n\n# Domain names\ndomain_pattern = re.compile(r'\\b[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z]{2,})+\\b')\ndomains = set()\nfor s in all_strings:\n    for d in domain_pattern.findall(s):\n        if not d.endswith(('.dll', '.exe', '.sys', '.com.au')):\n            domains.add(d)\n\n# URLs\nurl_pattern = re.compile(r'https?:\u002F\u002F[^\\s\u003C>\"{}|\\\\^`\\[\\]]+')\nurls = set()\nfor s in all_strings:\n    for u in url_pattern.findall(s):\n        urls.add(u)\n\nprint(\"NETWORK IOCs:\")\nprint(f\"  IPs:     {ips}\")\nprint(f\"  Domains: {domains}\")\nprint(f\"  URLs:    {urls}\")\n```\n\n### Step 3: Extract Host-Based IOCs\n\nIdentify file paths, registry keys, mutexes, and services:\n\n```python\n# Extract host-based IOCs from sandbox report\nimport json\n\nwith open(\"cuckoo_report.json\") as f:\n    report = json.load(f)\n\nprint(\"HOST IOCs:\")\n\n# File paths created or modified\nprint(\"\\nFile Paths:\")\nfor f in report[\"behavior\"][\"summary\"].get(\"files\", []):\n    if any(p in f.lower() for p in [\"temp\", \"appdata\", \"system32\", \"programdata\"]):\n        print(f\"  [DROPPED] {f}\")\n\n# Registry keys for persistence\nprint(\"\\nRegistry Keys:\")\nfor key in report[\"behavior\"][\"summary\"].get(\"write_keys\", []):\n    if any(p in key.lower() for p in [\"run\", \"service\", \"startup\", \"shell\"]):\n        print(f\"  [PERSIST] {key}\")\n\n# Mutexes (unique to malware family)\nprint(\"\\nMutexes:\")\nfor mutex in report[\"behavior\"][\"summary\"].get(\"mutexes\", []):\n    if mutex not in [\"Local\\\\!IETld!Mutex\", \"RasPbFile\"]:  # Filter known Windows mutexes\n        print(f\"  [MUTEX] {mutex}\")\n\n# Created services\nprint(\"\\nServices:\")\nfor svc in report[\"behavior\"][\"summary\"].get(\"started_services\", []):\n    print(f\"  [SERVICE] {svc}\")\n```\n\n### Step 4: Extract Network IOCs from PCAP\n\nParse network captures for additional indicators:\n\n```bash\n# Extract DNS queries from PCAP\ntshark -r capture.pcap -T fields -e dns.qry.name -Y \"dns.flags.response == 0\" | sort -u\n\n# Extract HTTP hosts and URLs\ntshark -r capture.pcap -T fields -e http.host -e http.request.uri -Y \"http.request\" | sort -u\n\n# Extract TLS server names (SNI)\ntshark -r capture.pcap -T fields -e tls.handshake.extensions_server_name -Y \"tls.handshake.type == 1\" | sort -u\n\n# Extract JA3 hashes\ntshark -r capture.pcap -T fields -e tls.handshake.ja3 -Y \"tls.handshake.type == 1\" | sort -u\n\n# Extract unique destination IPs\ntshark -r capture.pcap -T fields -e ip.dst -Y \"ip.src == 10.0.2.15\" | sort -u\n\n# Extract User-Agent strings\ntshark -r capture.pcap -T fields -e http.user_agent -Y \"http.user_agent\" | sort -u\n```\n\n### Step 5: Defang and Validate IOCs\n\nDefang indicators for safe sharing and validate against threat intelligence:\n\n```python\n# Defang IOCs for safe sharing\ndef defang_ip(ip):\n    return ip.replace(\".\", \"[.]\")\n\ndef defang_url(url):\n    return url.replace(\"http\", \"hxxp\").replace(\".\", \"[.]\")\n\ndef defang_domain(domain):\n    return domain.replace(\".\", \"[.]\")\n\n# Validate IOCs against VirusTotal\nimport requests\n\nVT_API_KEY = \"your_api_key\"\n\ndef check_vt_ip(ip):\n    resp = requests.get(f\"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fip_addresses\u002F{ip}\",\n                       headers={\"x-apikey\": VT_API_KEY})\n    data = resp.json()\n    stats = data[\"data\"][\"attributes\"][\"last_analysis_stats\"]\n    return stats[\"malicious\"]\n\ndef check_vt_domain(domain):\n    resp = requests.get(f\"https:\u002F\u002Fwww.virustotal.com\u002Fapi\u002Fv3\u002Fdomains\u002F{domain}\",\n                       headers={\"x-apikey\": VT_API_KEY})\n    data = resp.json()\n    stats = data[\"data\"][\"attributes\"][\"last_analysis_stats\"]\n    return stats[\"malicious\"]\n\n# Validate each IOC\nfor ip in ips:\n    detections = check_vt_ip(ip)\n    print(f\"  {defang_ip(ip)} - VT: {detections} detections\")\n```\n\n### Step 6: Export IOCs in Standard Formats\n\nGenerate structured IOC outputs for sharing and ingestion:\n\n```python\n# Export as STIX 2.1 bundle\nfrom stix2 import Indicator, Bundle, Malware, Relationship\nimport datetime\n\nindicators = []\n\n# File hash indicator\nindicators.append(Indicator(\n    name=\"Malware SHA-256 Hash\",\n    pattern=f\"[file:hashes.'SHA-256' = '{sha256_hash}']\",\n    pattern_type=\"stix\",\n    valid_from=datetime.datetime.now(datetime.timezone.utc),\n    labels=[\"malicious-activity\"]\n))\n\n# IP indicator\nfor ip in ips:\n    indicators.append(Indicator(\n        name=f\"C2 IP Address {ip}\",\n        pattern=f\"[ipv4-addr:value = '{ip}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.datetime.now(datetime.timezone.utc),\n        labels=[\"malicious-activity\"]\n    ))\n\n# Domain indicator\nfor domain in domains:\n    indicators.append(Indicator(\n        name=f\"C2 Domain {domain}\",\n        pattern=f\"[domain-name:value = '{domain}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.datetime.now(datetime.timezone.utc),\n        labels=[\"malicious-activity\"]\n    ))\n\nbundle = Bundle(objects=indicators)\nwith open(\"iocs_stix.json\", \"w\") as f:\n    f.write(bundle.serialize(pretty=True))\n\n# Export as CSV for SIEM ingestion\nimport csv\nwith open(\"iocs.csv\", \"w\", newline=\"\") as f:\n    writer = csv.writer(f)\n    writer.writerow([\"type\", \"value\", \"context\", \"confidence\"])\n    writer.writerow([\"sha256\", sha256_hash, \"malware_sample\", \"high\"])\n    for ip in ips:\n        writer.writerow([\"ipv4\", ip, \"c2_server\", \"high\"])\n    for domain in domains:\n        writer.writerow([\"domain\", domain, \"c2_domain\", \"high\"])\n    for url in urls:\n        writer.writerow([\"url\", url, \"c2_url\", \"high\"])\n```\n\n## Key Concepts\n\n| Term | Definition |\n|------|------------|\n| **IOC (Indicator of Compromise)** | Forensic artifact observed in a network or system that indicates a potential intrusion: hashes, IPs, domains, file paths, registry keys |\n| **Defanging** | Modifying IOCs to prevent accidental activation (e.g., replacing dots with [.] in URLs and IPs for safe sharing in reports) |\n| **Imphash** | MD5 hash of the import table functions in a PE file; samples from the same malware family often share the same imphash |\n| **STIX\u002FTAXII** | Structured Threat Information Expression \u002F Trusted Automated Exchange; standards for encoding and transmitting threat intelligence |\n| **JA3\u002FJA3S** | TLS client\u002Fserver fingerprint based on ClientHello\u002FServerHello parameters; identifies specific malware families by their TLS implementation |\n| **Fuzzy Hashing (ssdeep)** | Context-triggered piecewise hashing that identifies similar files even with minor modifications; useful for malware variant detection |\n| **MISP** | Malware Information Sharing Platform; open-source threat intelligence platform for collecting, storing, and sharing IOCs |\n\n## Tools & Systems\n\n- **iocextract (Python)**: Automated IOC extraction library supporting IPs, URLs, domains, hashes, and YARA rules from text\n- **MISP**: Open-source threat intelligence sharing platform for structured IOC management and distribution\n- **CyberChef**: Web-based tool for decoding, decrypting, and transforming data useful for deobfuscating encoded IOCs\n- **tshark**: Command-line network protocol analyzer for extracting network IOCs from PCAP files\n- **VirusTotal**: Online service for validating and enriching IOCs with community detection results and threat intelligence\n\n## Common Scenarios\n\n### Scenario: Building a Comprehensive IOC Package from a Ransomware Sample\n\n**Context**: A ransomware incident requires rapid IOC extraction for blocking across the enterprise while the full investigation continues. Multiple data sources are available: the sample binary, PCAP from network monitoring, and a Cuckoo sandbox report.\n\n**Approach**:\n1. Compute all file hashes (MD5, SHA-1, SHA-256, imphash, ssdeep) for the ransomware binary and any dropped files\n2. Extract network IOCs from strings in the binary (hardcoded C2 addresses)\n3. Parse the PCAP for DNS queries, HTTP requests, and TLS SNI fields\n4. Extract host IOCs from the sandbox report (file paths, registry keys, mutexes, ransom note filenames)\n5. Validate all network IOCs against VirusTotal to confirm malicious status and check for known associations\n6. Defang all indicators and compile into STIX 2.1 format for sharing and CSV for SIEM ingestion\n7. Submit to MISP event for organizational and community sharing\n\n**Pitfalls**:\n- Including IP addresses of legitimate CDNs or cloud services without validating context (e.g., AWS IPs used for hosting, not inherently malicious)\n- Not defanging URLs and IPs in reports, leading to accidental clicks or DNS resolution\n- Extracting strings from packed binaries (IOCs from packed samples are unreliable; unpack first)\n- Forgetting to include dropped file hashes (the initial dropper and the final payload are separate IOCs)\n\n## Output Format\n\n```\nIOC EXTRACTION REPORT\n======================\nSample:           ransomware.exe\nAnalysis Date:    2025-09-15\nAnalyst:          [Name]\n\nFILE INDICATORS\nSHA-256:          e3b0c44298fc1c149afbf4c8996fb924...\nSHA-1:            da39a3ee5e6b4b0d3255bfef95601890afd80709\nMD5:              d41d8cd98f00b204e9800998ecf8427e\nImphash:          a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6\nssdeep:           3072:kJh3bN7fY+aUkJh3bN7fY+aU:kJh3R7aUkJh3R7aU\n\nNETWORK INDICATORS\nC2 IPs:           185.220.101[.]42, 91.215.85[.]17\nC2 Domains:       update.malicious[.]com, backup.evil[.]net\nC2 URLs:          hxxps:\u002F\u002Fupdate.malicious[.]com\u002Fgate.php\n                  hxxps:\u002F\u002Fbackup.evil[.]net\u002Fgate.php\nJA3 Hash:         a0e9f5d64349fb13191bc781f81f42e1\nUser-Agent:       Mozilla\u002F5.0 (compatible; MSIE 10.0)\n\nHOST INDICATORS\nFile Paths:       C:\\Users\\Public\\svchost.exe\n                  C:\\Users\\%USER%\\AppData\\Local\\Temp\\payload.dll\n                  C:\\Users\\%USER%\\Desktop\\README_DECRYPT.txt\nRegistry Keys:    HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\WindowsUpdate\nMutexes:          Global\\CryptLocker_2025_Q3\nServices:         FakeWindowsUpdate\n\nCONFIDENCE ASSESSMENT\nHigh Confidence:  SHA-256, C2 IPs (validated via VT), Mutexes\nMedium Confidence: Domains (could be compromised legitimate sites)\nLow Confidence:   User-Agent (common string, high false positive risk)\n\nEXPORT FILES\nstix_bundle.json  - STIX 2.1 format for TIP ingestion\niocs.csv          - Flat CSV for SIEM blocklist import\nyara_rule.yar     - YARA detection rule\n```\n",{"name":5,"note":25,"tags":26,"author":32,"domain":33,"source":34,"license":15,"version":35,"nist_csf":36,"subdomain":41,"description":42,"mitre_attack":43,"source_commit":48},"Vendored verbatim from an external Apache-2.0 security-skill library, pinned by commit. Exceeds the internal 300-line skill guideline (agent-code-constraints.md) -- kept as-is because this is vendored reference material (forensics\u002Fthreat-intel procedure), not Yana AI-authored content, and trimming would damage technical accuracy.",[27,28,29,30,31],"malware","IOC-extraction","threat-intelligence","indicators","detection","mahipal","cybersecurity","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","1.0.0",[37,38,39,40],"DE.AE-02","RS.AN-03","ID.RA-01","DE.CM-01","malware-analysis","Extracts indicators of compromise (IOCs) from malware samples including file hashes, network indicators (IPs, domains, URLs), host artifacts (file paths, registry keys, mutexes), and behavioral patterns for threat intelligence sharing and detection rule creation. Activates for requests involving IOC extraction, threat indicator harvesting, malware indicator collection, or building detection content from samples.\n",[44,45,46,47],"T1027","T1055","T1140","T1497","04450304b12645cb2b974ab96d28c0664758a88d","main","481dcd7dd2e288b9d627a2bd017db70e64e6c6fa","core\u002Fskills\u002Fextracting-iocs-from-malware-samples",2,"https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI","https:\u002F\u002Fyana.vutam.link\u002F","https:\u002F\u002Fgithub.com\u002FHoronomos-laps","https:\u002F\u002Fyana.vutam.link","An open-source governed runtime & execution environment for multi-agent AI systems.","2026-11-14 13:24:09",{"source":8,"skillName":5,"commands":60,"prompt":70,"zipAvailable":71},[61,64,67],{"tool":62,"command":63},"npx","npx skills add Horonomos-laps\u002FYana-AI --skill extracting-iocs-from-malware-samples",{"tool":65,"command":66},"bunx","bunx skills add Horonomos-laps\u002FYana-AI --skill extracting-iocs-from-malware-samples",{"tool":68,"command":69},"pnpm","pnpm dlx skills add Horonomos-laps\u002FYana-AI --skill extracting-iocs-from-malware-samples","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fextracting-iocs-from-malware-samples\u002FSKILL.md",true,[73,77,83],{"path":74,"resourceType":74,"resourceTypeDesc":75,"sizeBytes":76,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":78,"resourceType":79,"resourceTypeDesc":80,"sizeBytes":81,"sourceHtmlUrl":82},"references\u002Fapi-reference.md","REFERENCE","参考文档",2640,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fextracting-iocs-from-malware-samples\u002Freferences\u002Fapi-reference.md",{"path":84,"resourceType":85,"resourceTypeDesc":86,"sizeBytes":87,"sourceHtmlUrl":88},"scripts\u002Fagent.py","SCRIPT","脚本",10921,"https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fextracting-iocs-from-malware-samples\u002Fscripts\u002Fagent.py",[90,98,105,113,121,129],{"skillNo":91,"name":92,"nameZh":6,"description":93,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":94,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":20},"01M735GKET5YVYKAY62W2P5YXB","openai--sentry--sentry","Use when the user asks to inspect Sentry issues or events, summarize recent production errors, or pull basic Sentry health data via the Sentry API; perform read-only queries with the bundled script and require `SENTRY_AUTH_TOKEN`.","MIT","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fopenai--sentry--sentry\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":20},"01M73DCAP83T17HY7SMGK7MGFE","ito-basket-compare","Compare Itô prediction-market baskets against a user's knowledge base, portfolio notes, financial context, watchlist, or research thesis. Use for read-only basket comparison and gap analysis without investment advice or live trading.","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fito-basket-compare\u002FSKILL.md",[],[],{"skillNo":106,"name":107,"nameZh":6,"description":108,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":109,"sourceHtmlUrl":110,"categories":111,"keywords":112,"publishedAt":20},"01M734CYEMZFDR3KH6SW0JP8TD","implementing-network-traffic-baselining","Build network traffic baselines from NetFlow\u002FIPFIX data using Python pandas for statistical analysis, z-score anomaly detection, and hourly\u002Fdaily traffic pattern profiling","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-network-traffic-baselining\u002FSKILL.md",[],[],{"skillNo":114,"name":115,"nameZh":6,"description":116,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":117,"sourceHtmlUrl":118,"categories":119,"keywords":120,"publishedAt":20},"01M73ASZ6NJRJM44Z2P84NGQ3Q","detecting-evasion-techniques-in-endpoint-logs","Detects defense evasion techniques used by adversaries in endpoint logs including log tampering, timestomping, process injection, and security tool disabling. Use when investigating suspicious endpoint behavior, building detection rules for evasion tactics, or conducting threat hunting for stealthy adversary activity. Activates for requests involving evasion detection, defense evasion analysis, log tampering detection, or MITRE ATT&CK TA0005.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002Fcore\u002Fskills\u002Fdetecting-evasion-techniques-in-endpoint-logs\u002FSKILL.md",[],[],{"skillNo":122,"name":123,"nameZh":6,"description":124,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":125,"sourceHtmlUrl":126,"categories":127,"keywords":128,"publishedAt":20},"01M734AFNXD06Z78QRK0VKGT7Q","implementing-microsegmentation-with-guardicore","Implementing microsegmentation using Akamai Guardicore Segmentation to map application dependencies, create granular network policies, visualize east-west traffic flows, and enforce least-privilege communication between workloads across data centers and cloud.","https:\u002F\u002Fgithub.com\u002Fyanacuti1121\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fimplementing-microsegmentation-with-guardicore\u002FSKILL.md",[],[],{"skillNo":130,"name":131,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":132,"categories":133,"keywords":134,"publishedAt":20},"01M736TK27QMCXK0DVCH25SJN5","ramdisk-tmpfs-patterns","https:\u002F\u002Fgithub.com\u002FHoronomos-laps\u002FYana-AI\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Framdisk-tmpfs-patterns\u002FSKILL.md",[],[]]