[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6GZAZ8DEVZ2JFNAR0YF937D":3,"skill-same:01M6GZAZ8DEVZ2JFNAR0YF937D":106},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":38,"linkOnly":39,"markdownContent":40,"markdownBody":41,"frontMatter":42,"refName":50,"commitSha":51,"skillDirectory":52,"forksCount":53,"repositoryHtmlUrl":54,"repositoryHomepageUrl":6,"ownerHtmlUrl":55,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":56,"install":57,"resources":70},"01M6GZAZ8DEVZ2JFNAR0YF937D","performing-malware-ioc-extraction",null,"Malware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), regist","micsapp\u002Fmicstec-skills","micsapp","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F82411001?v=4","01M6GWCFQ6D3PV8EHNY62NN5VW","01M6GWCFVE1PA5HG0DKC7AMFJ3",4,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002FSKILL.md",[],[18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37],"performing","extraction","malware","ioc","performing malware ioc extraction","ioc extraction","analysis","addresses","actionable","domains","software","ip","intelligence","malicious","network","analyzing","threat-intelligence","mitre-attack","reverse-engineering","cybersecurity","2026-11-10 10:12:30",false,"---\nname: performing-malware-ioc-extraction\ndescription: Malware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), regist\ndomain: cybersecurity\nsubdomain: threat-intelligence\ntags: [threat-intelligence, cti, ioc, mitre-attack, stix, malware-analysis, yara, reverse-engineering]\nversion: \"1.0\"\nauthor: mahipal\nlicense: Apache-2.0\n---\n# Performing Malware IOC Extraction\n\n## Overview\n\nMalware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), registry modifications, mutex names, embedded strings, and behavioral artifacts. This skill covers static analysis with PE parsing and string extraction, dynamic analysis with sandbox detonation, automated IOC extraction using tools like YARA, and formatting results as STIX 2.1 indicators for sharing.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing malware ioc extraction\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Python 3.9+ with `pefile`, `yara-python`, `oletools`, `stix2` libraries\n- Access to malware analysis sandbox (Cuckoo, CAPE, Any.Run, Joe Sandbox)\n- VirusTotal API key for enrichment\n- Isolated analysis environment (VM or container)\n- Understanding of PE file format, common packing techniques\n- Familiarity with YARA rule syntax\n\n## Key Concepts\n\n### Static Analysis IOCs\n- **File Hashes**: MD5, SHA-1, SHA-256 of the sample and any dropped files\n- **Import Hash (imphash)**: Hash of imported function table, groups malware families\n- **Rich Header Hash**: PE rich header hash for compiler fingerprinting\n- **Strings**: Embedded URLs, IP addresses, domain names, registry paths, mutex names\n- **PE Metadata**: Compilation timestamp, section names, resources, digital signatures\n- **Embedded Artifacts**: PDB paths, version info, certificate details\n\n### Dynamic Analysis IOCs\n- **Network Activity**: DNS queries, HTTP requests, TCP\u002FUDP connections, SSL certificates\n- **File System**: Created\u002Fmodified\u002Fdeleted files and directories\n- **Registry**: Created\u002Fmodified registry keys and values\n- **Process**: Spawned processes, injected processes, service creation\n- **Behavioral**: API calls, mutex creation, scheduled tasks, persistence mechanisms\n\n### YARA Rules\nYARA is a pattern-matching tool for identifying and classifying malware. Rules consist of strings (text, hex, regex) and conditions that define matching logic. Rules can detect malware families, packers, exploit kits, and specific campaign tools.\n\n## Workflow\n\n### Step 1: Static Analysis - PE Parsing and Hash Generation\n\n```python\nimport pefile\nimport hashlib\nimport os\n\ndef analyze_pe(filepath):\n    \"\"\"Extract IOCs from a PE file through static analysis.\"\"\"\n    iocs = {\"hashes\": {}, \"pe_info\": {}, \"strings\": [], \"imports\": []}\n\n    # Calculate file hashes\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n    iocs[\"hashes\"][\"md5\"] = hashlib.md5(data).hexdigest()\n    iocs[\"hashes\"][\"sha1\"] = hashlib.sha1(data).hexdigest()\n    iocs[\"hashes\"][\"sha256\"] = hashlib.sha256(data).hexdigest()\n    iocs[\"hashes\"][\"file_size\"] = len(data)\n\n    # Parse PE headers\n    try:\n        pe = pefile.PE(filepath)\n        iocs[\"hashes\"][\"imphash\"] = pe.get_imphash()\n        iocs[\"pe_info\"][\"compilation_time\"] = str(pe.FILE_HEADER.TimeDateStamp)\n        iocs[\"pe_info\"][\"machine_type\"] = hex(pe.FILE_HEADER.Machine)\n        iocs[\"pe_info\"][\"subsystem\"] = pe.OPTIONAL_HEADER.Subsystem\n\n        # Extract sections\n        iocs[\"pe_info\"][\"sections\"] = []\n        for section in pe.sections:\n            iocs[\"pe_info\"][\"sections\"].append({\n                \"name\": section.Name.decode(\"utf-8\", errors=\"ignore\").strip(\"\\x00\"),\n                \"virtual_size\": section.Misc_VirtualSize,\n                \"raw_size\": section.SizeOfRawData,\n                \"entropy\": section.get_entropy(),\n                \"md5\": section.get_hash_md5(),\n            })\n\n        # Extract imports\n        if hasattr(pe, \"DIRECTORY_ENTRY_IMPORT\"):\n            for entry in pe.DIRECTORY_ENTRY_IMPORT:\n                dll_name = entry.dll.decode(\"utf-8\", errors=\"ignore\")\n                functions = [\n                    imp.name.decode(\"utf-8\", errors=\"ignore\")\n                    for imp in entry.imports\n                    if imp.name\n                ]\n                iocs[\"imports\"].append({\"dll\": dll_name, \"functions\": functions})\n\n        # Check for suspicious characteristics\n        iocs[\"pe_info\"][\"is_dll\"] = pe.is_dll()\n        iocs[\"pe_info\"][\"is_driver\"] = pe.is_driver()\n        iocs[\"pe_info\"][\"is_exe\"] = pe.is_exe()\n\n        # Version info\n        if hasattr(pe, \"VS_VERSIONINFO\"):\n            for entry in pe.FileInfo:\n                for st in entry:\n                    for item in st.entries.items():\n                        key = item[0].decode(\"utf-8\", errors=\"ignore\")\n                        val = item[1].decode(\"utf-8\", errors=\"ignore\")\n                        iocs[\"pe_info\"][f\"version_{key}\"] = val\n\n        pe.close()\n\n    except pefile.PEFormatError as e:\n        iocs[\"pe_info\"][\"error\"] = str(e)\n\n    return iocs\n```\n\n### Step 2: String Extraction and IOC Pattern Matching\n\n```python\nimport re\n\ndef extract_ioc_strings(filepath):\n    \"\"\"Extract IOC-relevant strings from binary file.\"\"\"\n    patterns = {\n        \"ipv4\": re.compile(\n            r\"\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}\"\n            r\"(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\b\"\n        ),\n        \"domain\": re.compile(\n            r\"\\b(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+\"\n            r\"(?:com|net|org|io|ru|cn|tk|xyz|top|info|biz|cc|ws|pw)\\b\"\n        ),\n        \"url\": re.compile(\n            r\"https?:\u002F\u002F[^\\s\\\"'\u003C>]{5,200}\"\n        ),\n        \"email\": re.compile(\n            r\"\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b\"\n        ),\n        \"registry\": re.compile(\n            r\"(?:HKEY_[A-Z_]+|HKLM|HKCU|HKU|HKCR|HKCC)\"\n            r\"\\\\[\\\\a-zA-Z0-9_ .{}-]+\"\n        ),\n        \"filepath_windows\": re.compile(\n            r\"[A-Z]:\\\\(?:[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\\\\)*[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\"\n        ),\n        \"mutex\": re.compile(\n            r\"(?:Global\\\\|Local\\\\)[a-zA-Z0-9_\\-{}.]{4,}\"\n        ),\n        \"useragent\": re.compile(\n            r\"Mozilla\u002F[45]\\.0[^\\\"']{10,200}\"\n        ),\n        \"bitcoin\": re.compile(\n            r\"\\b[13][a-km-zA-HJ-NP-Z1-9]{25,34}\\b\"\n        ),\n        \"pdb_path\": re.compile(\n            r\"[A-Z]:\\\\[^\\\"]{5,200}\\.pdb\"\n        ),\n    }\n\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n\n    # Extract ASCII strings (min length 4)\n    ascii_strings = re.findall(rb\"[\\x20-\\x7e]{4,}\", data)\n    # Extract Unicode strings\n    unicode_strings = re.findall(\n        rb\"(?:[\\x20-\\x7e]\\x00){4,}\", data\n    )\n\n    all_strings = [s.decode(\"ascii\", errors=\"ignore\") for s in ascii_strings]\n    all_strings += [\n        s.decode(\"utf-16-le\", errors=\"ignore\") for s in unicode_strings\n    ]\n\n    extracted = {category: set() for category in patterns}\n\n    for string in all_strings:\n        for category, pattern in patterns.items():\n            matches = pattern.findall(string)\n            for match in matches:\n                extracted[category].add(match)\n\n    # Convert sets to sorted lists\n    return {k: sorted(v) for k, v in extracted.items() if v}\n```\n\n### Step 3: YARA Rule Scanning\n\n```python\nimport yara\n\ndef scan_with_yara(filepath, rules_path):\n    \"\"\"Scan file with YARA rules for malware classification.\"\"\"\n    rules = yara.compile(filepath=rules_path)\n    matches = rules.match(filepath)\n\n    results = []\n    for match in matches:\n        result = {\n            \"rule\": match.rule,\n            \"namespace\": match.namespace,\n            \"tags\": match.tags,\n            \"meta\": match.meta,\n            \"strings\": [],\n        }\n        for offset, identifier, data in match.strings:\n            result[\"strings\"].append({\n                \"offset\": hex(offset),\n                \"identifier\": identifier,\n                \"data\": data.hex() if len(data) \u003C 100 else data[:100].hex() + \"...\",\n            })\n        results.append(result)\n\n    return results\n\n\n# Example YARA rule for common malware indicators\nSAMPLE_YARA_RULE = \"\"\"\nrule Suspicious_Network_Indicators {\n    meta:\n        description = \"Detects suspicious network-related strings\"\n        author = \"CTI Analyst\"\n        severity = \"medium\"\n    strings:\n        $ua1 = \"Mozilla\u002F5.0\" ascii\n        $cmd1 = \"cmd.exe \u002Fc\" ascii nocase\n        $ps1 = \"powershell\" ascii nocase\n        $wget = \"wget\" ascii nocase\n        $curl = \"curl\" ascii nocase\n        $b64 = \"base64\" ascii nocase\n        $reg1 = \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\" ascii nocase\n    condition:\n        uint16(0) == 0x5A4D and\n        (2 of ($ua1, $cmd1, $ps1, $wget, $curl, $b64)) or $reg1\n}\n\nrule Packed_Binary {\n    meta:\n        description = \"Detects potentially packed binary\"\n        author = \"CTI Analyst\"\n    condition:\n        uint16(0) == 0x5A4D and\n        for any section in pe.sections : (\n            section.entropy >= 7.0\n        )\n}\n\"\"\"\n```\n\n### Step 4: Generate STIX 2.1 Indicators\n\n```python\nfrom stix2 import (\n    Bundle, Indicator, Malware, Relationship,\n    File as STIXFile, DomainName, IPv4Address,\n    ObservedData,\n)\nfrom datetime import datetime\n\ndef create_stix_bundle(pe_iocs, string_iocs, yara_results, sample_name):\n    \"\"\"Create STIX 2.1 bundle from extracted IOCs.\"\"\"\n    objects = []\n\n    # Create Malware SDO\n    malware = Malware(\n        name=sample_name,\n        is_family=False,\n        malware_types=[\"unknown\"],\n        description=f\"Malware sample analyzed: {pe_iocs['hashes']['sha256']}\",\n        allow_custom=True,\n    )\n    objects.append(malware)\n\n    # File hash indicator\n    sha256 = pe_iocs[\"hashes\"][\"sha256\"]\n    hash_indicator = Indicator(\n        name=f\"Malware hash: {sha256[:16]}...\",\n        pattern=f\"[file:hashes.'SHA-256' = '{sha256}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n        indicator_types=[\"malicious-activity\"],\n        allow_custom=True,\n    )\n    objects.append(hash_indicator)\n    objects.append(Relationship(\n        relationship_type=\"indicates\",\n        source_ref=hash_indicator.id,\n        target_ref=malware.id,\n    ))\n\n    # Network indicators from strings\n    for ip in string_iocs.get(\"ipv4\", []):\n        if not ip.startswith((\"10.\", \"172.\", \"192.168.\", \"127.\")):\n            ip_indicator = Indicator(\n                name=f\"C2 IP: {ip}\",\n                pattern=f\"[ipv4-addr:value = '{ip}']\",\n                pattern_type=\"stix\",\n                valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n                indicator_types=[\"malicious-activity\"],\n                allow_custom=True,\n            )\n            objects.append(ip_indicator)\n            objects.append(Relationship(\n                relationship_type=\"indicates\",\n                source_ref=ip_indicator.id,\n                target_ref=malware.id,\n            ))\n\n    for domain in string_iocs.get(\"domain\", []):\n        domain_indicator = Indicator(\n            name=f\"C2 Domain: {domain}\",\n            pattern=f\"[domain-name:value = '{domain}']\",\n            pattern_type=\"stix\",\n            valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n            indicator_types=[\"malicious-activity\"],\n            allow_custom=True,\n        )\n        objects.append(domain_indicator)\n        objects.append(Relationship(\n            relationship_type=\"indicates\",\n            source_ref=domain_indicator.id,\n            target_ref=malware.id,\n        ))\n\n    bundle = Bundle(objects=objects, allow_custom=True)\n    return bundle\n```\n\n## Validation Criteria\n\n- PE file parsed successfully with hashes, imports, and section analysis\n- String extraction identifies network IOCs (IPs, domains, URLs)\n- YARA rules match against known malware characteristics\n- STIX 2.1 bundle contains valid Indicator and Malware objects\n- Private IP ranges and benign strings filtered from IOC output\n- IOCs are actionable for blocking and detection rule creation\n\n## References\n\n- [pefile Documentation](https:\u002F\u002Fgithub.com\u002Ferocarrera\u002Fpefile)\n- [YARA Documentation](https:\u002F\u002Fyara.readthedocs.io\u002F)\n- [MITRE ATT&CK Software](https:\u002F\u002Fattack.mitre.org\u002Fsoftware\u002F)\n- [VirusTotal API](https:\u002F\u002Fdocs.virustotal.com\u002F)\n- [CAPE Sandbox](https:\u002F\u002Fgithub.com\u002Fkevoreilly\u002FCAPEv2)\n- [MalwareBazaar](https:\u002F\u002Fbazaar.abuse.ch\u002F)\n","# Performing Malware IOC Extraction\n\n## Overview\n\nMalware IOC extraction is the process of analyzing malicious software to identify actionable indicators of compromise including file hashes, network indicators (C2 domains, IP addresses, URLs), registry modifications, mutex names, embedded strings, and behavioral artifacts. This skill covers static analysis with PE parsing and string extraction, dynamic analysis with sandbox detonation, automated IOC extraction using tools like YARA, and formatting results as STIX 2.1 indicators for sharing.\n\n\n## When to Use\n\n- When conducting security assessments that involve performing malware ioc extraction\n- When following incident response procedures for related security events\n- When performing scheduled security testing or auditing activities\n- When validating security controls through hands-on testing\n\n## Prerequisites\n\n- Python 3.9+ with `pefile`, `yara-python`, `oletools`, `stix2` libraries\n- Access to malware analysis sandbox (Cuckoo, CAPE, Any.Run, Joe Sandbox)\n- VirusTotal API key for enrichment\n- Isolated analysis environment (VM or container)\n- Understanding of PE file format, common packing techniques\n- Familiarity with YARA rule syntax\n\n## Key Concepts\n\n### Static Analysis IOCs\n- **File Hashes**: MD5, SHA-1, SHA-256 of the sample and any dropped files\n- **Import Hash (imphash)**: Hash of imported function table, groups malware families\n- **Rich Header Hash**: PE rich header hash for compiler fingerprinting\n- **Strings**: Embedded URLs, IP addresses, domain names, registry paths, mutex names\n- **PE Metadata**: Compilation timestamp, section names, resources, digital signatures\n- **Embedded Artifacts**: PDB paths, version info, certificate details\n\n### Dynamic Analysis IOCs\n- **Network Activity**: DNS queries, HTTP requests, TCP\u002FUDP connections, SSL certificates\n- **File System**: Created\u002Fmodified\u002Fdeleted files and directories\n- **Registry**: Created\u002Fmodified registry keys and values\n- **Process**: Spawned processes, injected processes, service creation\n- **Behavioral**: API calls, mutex creation, scheduled tasks, persistence mechanisms\n\n### YARA Rules\nYARA is a pattern-matching tool for identifying and classifying malware. Rules consist of strings (text, hex, regex) and conditions that define matching logic. Rules can detect malware families, packers, exploit kits, and specific campaign tools.\n\n## Workflow\n\n### Step 1: Static Analysis - PE Parsing and Hash Generation\n\n```python\nimport pefile\nimport hashlib\nimport os\n\ndef analyze_pe(filepath):\n    \"\"\"Extract IOCs from a PE file through static analysis.\"\"\"\n    iocs = {\"hashes\": {}, \"pe_info\": {}, \"strings\": [], \"imports\": []}\n\n    # Calculate file hashes\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n    iocs[\"hashes\"][\"md5\"] = hashlib.md5(data).hexdigest()\n    iocs[\"hashes\"][\"sha1\"] = hashlib.sha1(data).hexdigest()\n    iocs[\"hashes\"][\"sha256\"] = hashlib.sha256(data).hexdigest()\n    iocs[\"hashes\"][\"file_size\"] = len(data)\n\n    # Parse PE headers\n    try:\n        pe = pefile.PE(filepath)\n        iocs[\"hashes\"][\"imphash\"] = pe.get_imphash()\n        iocs[\"pe_info\"][\"compilation_time\"] = str(pe.FILE_HEADER.TimeDateStamp)\n        iocs[\"pe_info\"][\"machine_type\"] = hex(pe.FILE_HEADER.Machine)\n        iocs[\"pe_info\"][\"subsystem\"] = pe.OPTIONAL_HEADER.Subsystem\n\n        # Extract sections\n        iocs[\"pe_info\"][\"sections\"] = []\n        for section in pe.sections:\n            iocs[\"pe_info\"][\"sections\"].append({\n                \"name\": section.Name.decode(\"utf-8\", errors=\"ignore\").strip(\"\\x00\"),\n                \"virtual_size\": section.Misc_VirtualSize,\n                \"raw_size\": section.SizeOfRawData,\n                \"entropy\": section.get_entropy(),\n                \"md5\": section.get_hash_md5(),\n            })\n\n        # Extract imports\n        if hasattr(pe, \"DIRECTORY_ENTRY_IMPORT\"):\n            for entry in pe.DIRECTORY_ENTRY_IMPORT:\n                dll_name = entry.dll.decode(\"utf-8\", errors=\"ignore\")\n                functions = [\n                    imp.name.decode(\"utf-8\", errors=\"ignore\")\n                    for imp in entry.imports\n                    if imp.name\n                ]\n                iocs[\"imports\"].append({\"dll\": dll_name, \"functions\": functions})\n\n        # Check for suspicious characteristics\n        iocs[\"pe_info\"][\"is_dll\"] = pe.is_dll()\n        iocs[\"pe_info\"][\"is_driver\"] = pe.is_driver()\n        iocs[\"pe_info\"][\"is_exe\"] = pe.is_exe()\n\n        # Version info\n        if hasattr(pe, \"VS_VERSIONINFO\"):\n            for entry in pe.FileInfo:\n                for st in entry:\n                    for item in st.entries.items():\n                        key = item[0].decode(\"utf-8\", errors=\"ignore\")\n                        val = item[1].decode(\"utf-8\", errors=\"ignore\")\n                        iocs[\"pe_info\"][f\"version_{key}\"] = val\n\n        pe.close()\n\n    except pefile.PEFormatError as e:\n        iocs[\"pe_info\"][\"error\"] = str(e)\n\n    return iocs\n```\n\n### Step 2: String Extraction and IOC Pattern Matching\n\n```python\nimport re\n\ndef extract_ioc_strings(filepath):\n    \"\"\"Extract IOC-relevant strings from binary file.\"\"\"\n    patterns = {\n        \"ipv4\": re.compile(\n            r\"\\b(?:(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\.){3}\"\n            r\"(?:25[0-5]|2[0-4]\\d|[01]?\\d\\d?)\\b\"\n        ),\n        \"domain\": re.compile(\n            r\"\\b(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+\"\n            r\"(?:com|net|org|io|ru|cn|tk|xyz|top|info|biz|cc|ws|pw)\\b\"\n        ),\n        \"url\": re.compile(\n            r\"https?:\u002F\u002F[^\\s\\\"'\u003C>]{5,200}\"\n        ),\n        \"email\": re.compile(\n            r\"\\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}\\b\"\n        ),\n        \"registry\": re.compile(\n            r\"(?:HKEY_[A-Z_]+|HKLM|HKCU|HKU|HKCR|HKCC)\"\n            r\"\\\\[\\\\a-zA-Z0-9_ .{}-]+\"\n        ),\n        \"filepath_windows\": re.compile(\n            r\"[A-Z]:\\\\(?:[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\\\\)*[^\\\\\u002F:*?\\\"\u003C>|\\r\\n]+\"\n        ),\n        \"mutex\": re.compile(\n            r\"(?:Global\\\\|Local\\\\)[a-zA-Z0-9_\\-{}.]{4,}\"\n        ),\n        \"useragent\": re.compile(\n            r\"Mozilla\u002F[45]\\.0[^\\\"']{10,200}\"\n        ),\n        \"bitcoin\": re.compile(\n            r\"\\b[13][a-km-zA-HJ-NP-Z1-9]{25,34}\\b\"\n        ),\n        \"pdb_path\": re.compile(\n            r\"[A-Z]:\\\\[^\\\"]{5,200}\\.pdb\"\n        ),\n    }\n\n    with open(filepath, \"rb\") as f:\n        data = f.read()\n\n    # Extract ASCII strings (min length 4)\n    ascii_strings = re.findall(rb\"[\\x20-\\x7e]{4,}\", data)\n    # Extract Unicode strings\n    unicode_strings = re.findall(\n        rb\"(?:[\\x20-\\x7e]\\x00){4,}\", data\n    )\n\n    all_strings = [s.decode(\"ascii\", errors=\"ignore\") for s in ascii_strings]\n    all_strings += [\n        s.decode(\"utf-16-le\", errors=\"ignore\") for s in unicode_strings\n    ]\n\n    extracted = {category: set() for category in patterns}\n\n    for string in all_strings:\n        for category, pattern in patterns.items():\n            matches = pattern.findall(string)\n            for match in matches:\n                extracted[category].add(match)\n\n    # Convert sets to sorted lists\n    return {k: sorted(v) for k, v in extracted.items() if v}\n```\n\n### Step 3: YARA Rule Scanning\n\n```python\nimport yara\n\ndef scan_with_yara(filepath, rules_path):\n    \"\"\"Scan file with YARA rules for malware classification.\"\"\"\n    rules = yara.compile(filepath=rules_path)\n    matches = rules.match(filepath)\n\n    results = []\n    for match in matches:\n        result = {\n            \"rule\": match.rule,\n            \"namespace\": match.namespace,\n            \"tags\": match.tags,\n            \"meta\": match.meta,\n            \"strings\": [],\n        }\n        for offset, identifier, data in match.strings:\n            result[\"strings\"].append({\n                \"offset\": hex(offset),\n                \"identifier\": identifier,\n                \"data\": data.hex() if len(data) \u003C 100 else data[:100].hex() + \"...\",\n            })\n        results.append(result)\n\n    return results\n\n\n# Example YARA rule for common malware indicators\nSAMPLE_YARA_RULE = \"\"\"\nrule Suspicious_Network_Indicators {\n    meta:\n        description = \"Detects suspicious network-related strings\"\n        author = \"CTI Analyst\"\n        severity = \"medium\"\n    strings:\n        $ua1 = \"Mozilla\u002F5.0\" ascii\n        $cmd1 = \"cmd.exe \u002Fc\" ascii nocase\n        $ps1 = \"powershell\" ascii nocase\n        $wget = \"wget\" ascii nocase\n        $curl = \"curl\" ascii nocase\n        $b64 = \"base64\" ascii nocase\n        $reg1 = \"HKLM\\\\SOFTWARE\\\\Microsoft\\\\Windows\\\\CurrentVersion\\\\Run\" ascii nocase\n    condition:\n        uint16(0) == 0x5A4D and\n        (2 of ($ua1, $cmd1, $ps1, $wget, $curl, $b64)) or $reg1\n}\n\nrule Packed_Binary {\n    meta:\n        description = \"Detects potentially packed binary\"\n        author = \"CTI Analyst\"\n    condition:\n        uint16(0) == 0x5A4D and\n        for any section in pe.sections : (\n            section.entropy >= 7.0\n        )\n}\n\"\"\"\n```\n\n### Step 4: Generate STIX 2.1 Indicators\n\n```python\nfrom stix2 import (\n    Bundle, Indicator, Malware, Relationship,\n    File as STIXFile, DomainName, IPv4Address,\n    ObservedData,\n)\nfrom datetime import datetime\n\ndef create_stix_bundle(pe_iocs, string_iocs, yara_results, sample_name):\n    \"\"\"Create STIX 2.1 bundle from extracted IOCs.\"\"\"\n    objects = []\n\n    # Create Malware SDO\n    malware = Malware(\n        name=sample_name,\n        is_family=False,\n        malware_types=[\"unknown\"],\n        description=f\"Malware sample analyzed: {pe_iocs['hashes']['sha256']}\",\n        allow_custom=True,\n    )\n    objects.append(malware)\n\n    # File hash indicator\n    sha256 = pe_iocs[\"hashes\"][\"sha256\"]\n    hash_indicator = Indicator(\n        name=f\"Malware hash: {sha256[:16]}...\",\n        pattern=f\"[file:hashes.'SHA-256' = '{sha256}']\",\n        pattern_type=\"stix\",\n        valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n        indicator_types=[\"malicious-activity\"],\n        allow_custom=True,\n    )\n    objects.append(hash_indicator)\n    objects.append(Relationship(\n        relationship_type=\"indicates\",\n        source_ref=hash_indicator.id,\n        target_ref=malware.id,\n    ))\n\n    # Network indicators from strings\n    for ip in string_iocs.get(\"ipv4\", []):\n        if not ip.startswith((\"10.\", \"172.\", \"192.168.\", \"127.\")):\n            ip_indicator = Indicator(\n                name=f\"C2 IP: {ip}\",\n                pattern=f\"[ipv4-addr:value = '{ip}']\",\n                pattern_type=\"stix\",\n                valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n                indicator_types=[\"malicious-activity\"],\n                allow_custom=True,\n            )\n            objects.append(ip_indicator)\n            objects.append(Relationship(\n                relationship_type=\"indicates\",\n                source_ref=ip_indicator.id,\n                target_ref=malware.id,\n            ))\n\n    for domain in string_iocs.get(\"domain\", []):\n        domain_indicator = Indicator(\n            name=f\"C2 Domain: {domain}\",\n            pattern=f\"[domain-name:value = '{domain}']\",\n            pattern_type=\"stix\",\n            valid_from=datetime.now().strftime(\"%Y-%m-%dT%H:%M:%SZ\"),\n            indicator_types=[\"malicious-activity\"],\n            allow_custom=True,\n        )\n        objects.append(domain_indicator)\n        objects.append(Relationship(\n            relationship_type=\"indicates\",\n            source_ref=domain_indicator.id,\n            target_ref=malware.id,\n        ))\n\n    bundle = Bundle(objects=objects, allow_custom=True)\n    return bundle\n```\n\n## Validation Criteria\n\n- PE file parsed successfully with hashes, imports, and section analysis\n- String extraction identifies network IOCs (IPs, domains, URLs)\n- YARA rules match against known malware characteristics\n- STIX 2.1 bundle contains valid Indicator and Malware objects\n- Private IP ranges and benign strings filtered from IOC output\n- IOCs are actionable for blocking and detection rule creation\n\n## References\n\n- [pefile Documentation](https:\u002F\u002Fgithub.com\u002Ferocarrera\u002Fpefile)\n- [YARA Documentation](https:\u002F\u002Fyara.readthedocs.io\u002F)\n- [MITRE ATT&CK Software](https:\u002F\u002Fattack.mitre.org\u002Fsoftware\u002F)\n- [VirusTotal API](https:\u002F\u002Fdocs.virustotal.com\u002F)\n- [CAPE Sandbox](https:\u002F\u002Fgithub.com\u002Fkevoreilly\u002FCAPEv2)\n- [MalwareBazaar](https:\u002F\u002Fbazaar.abuse.ch\u002F)\n",{"name":5,"tags":43,"author":48,"domain":37,"license":14,"version":49,"subdomain":34,"description":7},[34,44,21,35,45,46,47,36],"cti","stix","malware-analysis","yara","mahipal","1.0","master","3f5d983eb4ef375b749adcd6b07ec03bd82ae8a8","_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction",0,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills","https:\u002F\u002Fgithub.com\u002Fmicsapp","2026-03-20 11:24:18",{"source":8,"skillName":5,"commands":58,"prompt":68,"zipAvailable":69},[59,62,65],{"tool":60,"command":61},"npx","npx skills add micsapp\u002Fmicstec-skills --skill performing-malware-ioc-extraction",{"tool":63,"command":64},"bunx","bunx skills add micsapp\u002Fmicstec-skills --skill performing-malware-ioc-extraction",{"tool":66,"command":67},"pnpm","pnpm dlx skills add micsapp\u002Fmicstec-skills --skill performing-malware-ioc-extraction","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002FSKILL.md",true,[71,77,82,88,92,96,102],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"assets\u002Ftemplate.md","ASSET","资产文件",2294,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Fassets\u002Ftemplate.md",{"path":78,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002FLICENSE",{"path":83,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":86,"sourceHtmlUrl":87},"references\u002Fapi-reference.md","REFERENCE","参考文档",1720,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Freferences\u002Fapi-reference.md",{"path":89,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":90,"sourceHtmlUrl":91},"references\u002Fstandards.md",2949,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Freferences\u002Fstandards.md",{"path":93,"resourceType":84,"resourceTypeDesc":85,"sizeBytes":94,"sourceHtmlUrl":95},"references\u002Fworkflows.md",4140,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Freferences\u002Fworkflows.md",{"path":97,"resourceType":98,"resourceTypeDesc":99,"sizeBytes":100,"sourceHtmlUrl":101},"scripts\u002Fagent.py","SCRIPT","脚本",6173,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Fscripts\u002Fagent.py",{"path":103,"resourceType":98,"resourceTypeDesc":99,"sizeBytes":104,"sourceHtmlUrl":105},"scripts\u002Fprocess.py",16560,"https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002F_universal\u002Fcybersecurity-skills\u002Fskills\u002Fperforming-malware-ioc-extraction\u002Fscripts\u002Fprocess.py",[107,144,174,195,215,240],{"skillNo":108,"name":109,"nameZh":6,"description":110,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":111,"licenseFileUrl":6,"sourceHtmlUrl":112,"categories":113,"keywords":124,"publishedAt":38},"01M6HBTJ02FXBFG9NYEHHYAP52","azure-apim-architecture","Analyzes and explains Azure API Management architecture decisions for enterprise API marketplace implementations using VNet Internal mode, Front Door, hybrid authentication, and multi-environment strategies. Use when discussing APIM component selection, network topology, cost optimization, or comparing alternatives like workspaces vs instances, VNet Internal vs External mode, or Front Door vs Application Gateway.","MIT","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fazure-apim-architecture\u002FSKILL.md",[114,119],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000010","后端与接口","SCENARIO","使用场景",{"categoryNo":120,"categoryName":121,"taxonomyType":122,"taxonomyTypeDesc":123},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[125,126,127,128,129,130,131,132,32,133,134,135,136,137,138,139,140,141,142,143],"architecture","azure","azure apim architecture","component","authentication","gateway","topology","Optimization","api","team","environment","multi-environment","workspaces","instances","selection","strategies","azure api management","mode","for",{"skillNo":145,"name":146,"nameZh":6,"description":147,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":111,"licenseFileUrl":6,"sourceHtmlUrl":148,"categories":149,"keywords":158,"publishedAt":38},"01M6HBT7J4H082JEEA670B3EQ9","apiops-deployment","Guides deployment of Azure API Management infrastructure using Infrastructure as Code (Bicep\u002FTerraform), CI\u002FCD pipelines (GitHub Actions\u002FAzure DevOps), and APIOps workflows. Use when deploying APIM, creating pipelines, or implementing dev→test→prod promotion strategies.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fapiops-deployment\u002FSKILL.md",[150,151,154,157],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},{"categoryNo":152,"categoryName":153,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000011","运维与部署",{"categoryNo":155,"categoryName":156,"taxonomyType":117,"taxonomyTypeDesc":118},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":120,"categoryName":121,"taxonomyType":122,"taxonomyTypeDesc":123},[159,160,161,162,126,163,164,165,166,167,168,169,133,134,140,170,171,141,172,173],"deployment","apiops deployment","workflows","azure devops","infrastructure","code","infrastructure as code","actions","ci","github actions","github-actions","as","guides","CI\u002FCD","implementing",{"skillNo":175,"name":176,"nameZh":6,"description":177,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":111,"licenseFileUrl":6,"sourceHtmlUrl":178,"categories":179,"keywords":181,"publishedAt":38},"01M6HBT2HEA23THNE9E00GYQBE","apim-policy-authoring","Creates production-ready Azure API Management policy XML for authentication (OAuth 2.0, JWT validation, subscription keys), rate limiting, CORS configuration, error handling, and API transformations. Use when implementing API security, access control, or request\u002Fresponse processing logic.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fapim-policy-authoring\u002FSKILL.md",[180],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},[182,183,184,185,126,129,133,134,186,187,188,189,190,191,192,141,193,194,173,143],"policy","authoring","apim policy authoring","security","access","use","ready","api security","Access Control","error","processing","cors configuration","production-ready",{"skillNo":196,"name":197,"nameZh":6,"description":198,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":111,"licenseFileUrl":6,"sourceHtmlUrl":199,"categories":200,"keywords":203,"publishedAt":38},"01M6HBSY65SB29J9WE9KYD0K6T","api-security-review","Reviews Azure API Management configurations for security vulnerabilities, OWASP API Security Top 10 compliance, VNet Internal mode validation, Private Link verification, and Azure Security Benchmark alignment. Use when performing security audits, pre-deployment validation, or compliance reviews.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fcopilot-agent-skills\u002F.github\u002Fskills\u002Fapi-security-review\u002FSKILL.md",[201,202],{"categoryNo":115,"categoryName":116,"taxonomyType":117,"taxonomyTypeDesc":118},{"categoryNo":120,"categoryName":121,"taxonomyType":122,"taxonomyTypeDesc":123},[204,185,205,133,189,206,126,159,207,208,209,210,134,211,141,212,213,214,142,143],"review","security review","api security review","benchmark","verification","owasp","owasp-api","alignment","azure security","reviews","top",{"skillNo":216,"name":217,"nameZh":6,"description":218,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":111,"licenseFileUrl":6,"sourceHtmlUrl":219,"categories":220,"keywords":221,"publishedAt":38},"01M6HBSRW4PDFE6K4F8JYPZQ05","jira-cli","Interact with Jira from the command line to create, list, view, edit, and transition issues, manage sprints and epics, and perform common Jira workflows. Use when the user asks about Jira tasks, tickets, issues, sprints, or needs to manage project work items.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fawesome-copilot-agents\u002Fskills\u002Fjira-cli\u002FSKILL.md",[],[222,223,224,161,225,226,227,228,133,229,230,231,232,233,234,235,236,237,238,239],"cli","jira","jira cli","init","tasks","create","issues","common","work","command","edit","list","view","project","project work","token","line","sprints",{"skillNo":241,"name":242,"nameZh":6,"description":243,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":111,"licenseFileUrl":6,"sourceHtmlUrl":244,"categories":245,"keywords":246,"publishedAt":38},"01M6HBSNS3JHMW603G47TWE31H","calculator","Performs arbitrary-precision arithmetic calculations including addition, subtraction, multiplication, division, and exponents. Use when the user asks to calculate, compute, or evaluate math expressions, or when precise decimal arithmetic is needed to avoid floating-point errors.","https:\u002F\u002Fgithub.com\u002Fmicsapp\u002Fmicstec-skills\u002Fblob\u002Fmaster\u002Fcopilot-cli\u002Fawesome-copilot-agents\u002Fskills\u002Fcalculator\u002FSKILL.md",[],[242,247,248,249,250,251,252,187,253,254],"npm","js","calculate","node","math","user","compute","errors"]