[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ADXFHKSNFSC6XSTH27BXXK":3,"skill-same:01M6ADXFHKSNFSC6XSTH27BXXK":110},{"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":6,"sourceHtmlUrl":16,"categories":17,"keywords":23,"publishedAt":44,"linkOnly":45,"markdownContent":46,"markdownBody":47,"frontMatter":48,"refName":69,"commitSha":70,"skillDirectory":71,"forksCount":72,"repositoryHtmlUrl":73,"repositoryHomepageUrl":74,"ownerHtmlUrl":75,"ownerBlogUrl":76,"ownerDescription":77,"updatedAt":78,"install":79,"resources":92},"01M6ADXFHKSNFSC6XSTH27BXXK","building-attack-pattern-library-from-cti-reports",null,"Parse cyber threat intelligence reports (Mandiant, CrowdStrike, Talos, Microsoft) with stix2, mitreattack-python, and spaCy to extract adversary behaviors, map them to MITRE ATT&CK technique IDs, and build a searchable STIX 2.1 attack-pattern library with detection templates. Use when cataloging attack patterns from CTI reports for threat-informed detection engineering, or generating Sigma\u002FYARA templates from documented behaviors.","mukul975\u002FAnthropic-Cybersecurity-Skills","mukul975","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42860185?v=4","01M6ADEQR8T5M4EEG6C67BQCWF","Mahipal","01M6ADJPMYWG1E5GM1FWBE3128",36078,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002FSKILL.md",[18],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",[24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43],"building attack pattern library from cti reports","library","cti","mitre-attack","detection-engineering","cti-reports","attack-pattern","T1059.001","yara","stix","threat-intelligence","nlp","engineering","file","protocol","validation","microsoft","threat intelligence","cybersecurity","python","2026-11-10 10:12:30",false,"---\nname: building-attack-pattern-library-from-cti-reports\ndescription: Parse cyber threat intelligence reports (Mandiant, CrowdStrike, Talos, Microsoft) with stix2, mitreattack-python, and spaCy to extract adversary behaviors, map them to MITRE ATT&CK technique IDs, and build a searchable STIX 2.1 attack-pattern library with detection templates. Use when cataloging attack patterns from CTI reports for threat-informed detection engineering, or generating Sigma\u002FYARA templates from documented behaviors.\ndomain: cybersecurity\nsubdomain: threat-intelligence\ntags:\n- attack-pattern\n- cti-reports\n- mitre-attack\n- stix\n- detection-engineering\n- threat-intelligence\n- nlp\n- extraction\nversion: '1.0'\nauthor: mahipal\nlicense: Apache-2.0\nd3fend_techniques:\n- File Metadata Consistency Validation\n- Application Protocol Command Analysis\n- Identifier Analysis\n- Content Format Conversion\n- Message Analysis\nnist_csf:\n- ID.RA-01\n- ID.RA-05\n- DE.CM-01\n- DE.AE-02\nmitre_attack:\n- T1566.001\n- T1059.001\n- T1003.001\n- T1558.003\n- T1550.002\n---\n# Building Attack Pattern Library from CTI Reports\n\n## Overview\n\nCyber threat intelligence (CTI) reports from vendors like Mandiant, CrowdStrike, Talos, and Microsoft contain detailed descriptions of adversary behaviors that can be extracted, normalized, and cataloged into a structured attack pattern library. This skill covers parsing CTI reports to extract adversary techniques, mapping behaviors to MITRE ATT&CK technique IDs, creating STIX 2.1 Attack Pattern objects, building a searchable library indexed by tactic, technique, and threat actor, and generating detection rule templates from documented patterns.\n\n\n## When to Use\n\n- When deploying or configuring building attack pattern library from cti reports capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Python 3.9+ with `stix2`, `mitreattack-python`, `spacy`, `requests` libraries\n- Collection of CTI reports (PDF, HTML, or text format)\n- MITRE ATT&CK STIX data (local or via TAXII)\n- Understanding of ATT&CK technique structure and naming conventions\n- Familiarity with detection engineering concepts (Sigma, YARA)\n\n## Key Concepts\n\n### Attack Pattern Extraction\n\nCTI reports describe adversary behaviors in natural language. Extraction involves identifying action verbs and technical terms that map to ATT&CK techniques, recognizing tool names and malware families, identifying infrastructure indicators, and mapping sequences of behaviors to attack chains (kill chain phases).\n\n### STIX 2.1 Attack Pattern Objects\n\nSTIX defines Attack Pattern as a Structured Domain Object (SDO) that describes ways threat actors attempt to compromise targets. Each pattern links to ATT&CK via external references, includes kill chain phases (tactics), and can be related to Intrusion Sets, Malware, and Tool objects.\n\n### Detection Rule Generation\n\nExtracted attack patterns inform detection engineering by providing: specific procedure examples for Sigma rule creation, behavioral sequences for correlation rules, IOC patterns for YARA and Snort rules, and data source requirements for telemetry gaps.\n\n## Workflow\n\n### Step 1: Parse CTI Reports and Extract Behaviors\n\n```python\nimport re\nimport json\nfrom collections import defaultdict\n\nclass CTIReportParser:\n    \"\"\"Parse CTI reports to extract adversary behaviors.\"\"\"\n\n    BEHAVIOR_INDICATORS = [\n        \"used\", \"executed\", \"deployed\", \"leveraged\", \"exploited\",\n        \"established\", \"created\", \"modified\", \"downloaded\", \"uploaded\",\n        \"exfiltrated\", \"injected\", \"enumerated\", \"spawned\", \"dropped\",\n        \"persisted\", \"escalated\", \"moved laterally\", \"collected\",\n        \"encrypted\", \"compressed\", \"encoded\", \"obfuscated\",\n    ]\n\n    TOOL_PATTERNS = [\n        r'\\b(Cobalt Strike|Mimikatz|PsExec|BloodHound|Rubeus|Impacket)\\b',\n        r'\\b(PowerShell|cmd\\.exe|WMI|WMIC|certutil|bitsadmin)\\b',\n        r'\\b(Metasploit|Empire|Covenant|Sliver|Brute Ratel)\\b',\n        r'\\b(Lazagne|SharpHound|ADFind|Sharphound|Invoke-Obfuscation)\\b',\n    ]\n\n    TECHNIQUE_KEYWORDS = {\n        \"spearphishing\": \"T1566\",\n        \"phishing attachment\": \"T1566.001\",\n        \"phishing link\": \"T1566.002\",\n        \"powershell\": \"T1059.001\",\n        \"command line\": \"T1059.003\",\n        \"scheduled task\": \"T1053.005\",\n        \"registry run key\": \"T1547.001\",\n        \"process injection\": \"T1055\",\n        \"dll side-loading\": \"T1574.002\",\n        \"credential dumping\": \"T1003\",\n        \"lsass\": \"T1003.001\",\n        \"kerberoasting\": \"T1558.003\",\n        \"pass the hash\": \"T1550.002\",\n        \"remote desktop\": \"T1021.001\",\n        \"smb\": \"T1021.002\",\n        \"winrm\": \"T1021.006\",\n        \"data staging\": \"T1074\",\n        \"exfiltration over c2\": \"T1041\",\n        \"dns tunneling\": \"T1071.004\",\n        \"web shell\": \"T1505.003\",\n    }\n\n    def parse_report(self, text, report_metadata=None):\n        \"\"\"Parse a CTI report and extract behaviors.\"\"\"\n        sentences = re.split(r'[.!?]\\s+', text)\n        behaviors = []\n\n        for sentence in sentences:\n            sentence_lower = sentence.lower()\n            # Check for behavior indicators\n            for indicator in self.BEHAVIOR_INDICATORS:\n                if indicator in sentence_lower:\n                    behavior = {\n                        \"sentence\": sentence.strip(),\n                        \"action\": indicator,\n                        \"tools\": self._extract_tools(sentence),\n                        \"technique_hints\": self._match_techniques(sentence_lower),\n                    }\n                    if behavior[\"technique_hints\"]:\n                        behaviors.append(behavior)\n                    break\n\n        print(f\"[+] Extracted {len(behaviors)} behavioral indicators from report\")\n        return behaviors\n\n    def _extract_tools(self, text):\n        \"\"\"Extract tool\u002Fmalware names from text.\"\"\"\n        tools = set()\n        for pattern in self.TOOL_PATTERNS:\n            matches = re.findall(pattern, text, re.IGNORECASE)\n            tools.update(matches)\n        return list(tools)\n\n    def _match_techniques(self, text):\n        \"\"\"Match text to ATT&CK technique hints.\"\"\"\n        matches = []\n        for keyword, tech_id in self.TECHNIQUE_KEYWORDS.items():\n            if keyword in text:\n                matches.append({\"keyword\": keyword, \"technique_id\": tech_id})\n        return matches\n\nparser = CTIReportParser()\nsample_report = \"\"\"\nThe threat actor used spearphishing attachments with macro-enabled documents to\ngain initial access. Once inside, they executed PowerShell scripts to download\nadditional tooling. The actor leveraged Mimikatz to dump credentials from LSASS\nmemory. They then used pass the hash techniques for lateral movement via SMB\nto multiple systems. Data was staged in a compressed archive and exfiltrated\nover the existing C2 channel. The actor established persistence through\nscheduled tasks and registry run keys.\n\"\"\"\nbehaviors = parser.parse_report(sample_report)\n```\n\n### Step 2: Map Behaviors to ATT&CK Techniques\n\n```python\nfrom attackcti import attack_client\n\nclass ATTACKMapper:\n    def __init__(self):\n        self.lift = attack_client()\n        self.techniques = {}\n        self._load_techniques()\n\n    def _load_techniques(self):\n        \"\"\"Load all ATT&CK techniques for mapping.\"\"\"\n        all_techs = self.lift.get_enterprise_techniques()\n        for tech in all_techs:\n            tech_id = \"\"\n            for ref in tech.get(\"external_references\", []):\n                if ref.get(\"source_name\") == \"mitre-attack\":\n                    tech_id = ref.get(\"external_id\", \"\")\n                    break\n            if tech_id:\n                self.techniques[tech_id] = {\n                    \"name\": tech.get(\"name\", \"\"),\n                    \"description\": tech.get(\"description\", \"\")[:500],\n                    \"tactics\": [p.get(\"phase_name\") for p in tech.get(\"kill_chain_phases\", [])],\n                    \"platforms\": tech.get(\"x_mitre_platforms\", []),\n                    \"data_sources\": tech.get(\"x_mitre_data_sources\", []),\n                }\n        print(f\"[+] Loaded {len(self.techniques)} ATT&CK techniques\")\n\n    def map_behaviors(self, behaviors):\n        \"\"\"Map extracted behaviors to ATT&CK techniques.\"\"\"\n        mapped = []\n        for behavior in behaviors:\n            for hint in behavior.get(\"technique_hints\", []):\n                tech_id = hint[\"technique_id\"]\n                if tech_id in self.techniques:\n                    tech_info = self.techniques[tech_id]\n                    mapped.append({\n                        \"technique_id\": tech_id,\n                        \"technique_name\": tech_info[\"name\"],\n                        \"tactics\": tech_info[\"tactics\"],\n                        \"source_sentence\": behavior[\"sentence\"],\n                        \"tools_observed\": behavior[\"tools\"],\n                        \"keyword_matched\": hint[\"keyword\"],\n                        \"data_sources\": tech_info[\"data_sources\"],\n                    })\n        print(f\"[+] Mapped {len(mapped)} behaviors to ATT&CK techniques\")\n        return mapped\n\nmapper = ATTACKMapper()\nmapped_behaviors = mapper.map_behaviors(behaviors)\n```\n\n### Step 3: Create STIX 2.1 Attack Pattern Library\n\n```python\nfrom stix2 import AttackPattern, Relationship, Bundle, TLP_GREEN\nfrom datetime import datetime\n\nclass AttackPatternLibrary:\n    def __init__(self):\n        self.patterns = []\n        self.relationships = []\n\n    def add_pattern_from_mapping(self, mapping, report_source=\"CTI Report\"):\n        \"\"\"Create STIX Attack Pattern from mapped behavior.\"\"\"\n        pattern = AttackPattern(\n            name=mapping[\"technique_name\"],\n            description=f\"Observed: {mapping['source_sentence']}\\n\\n\"\n                        f\"Tools: {', '.join(mapping['tools_observed']) or 'None identified'}\\n\"\n                        f\"Source: {report_source}\",\n            external_references=[{\n                \"source_name\": \"mitre-attack\",\n                \"external_id\": mapping[\"technique_id\"],\n                \"url\": f\"https:\u002F\u002Fattack.mitre.org\u002Ftechniques\u002F{mapping['technique_id'].replace('.', '\u002F')}\u002F\",\n            }],\n            kill_chain_phases=[{\n                \"kill_chain_name\": \"mitre-attack\",\n                \"phase_name\": tactic,\n            } for tactic in mapping[\"tactics\"]],\n            object_marking_refs=[TLP_GREEN],\n        )\n        self.patterns.append(pattern)\n        return pattern\n\n    def build_library(self, mapped_behaviors, report_source=\"CTI Report\"):\n        \"\"\"Build complete attack pattern library from mappings.\"\"\"\n        seen_techniques = set()\n        for mapping in mapped_behaviors:\n            tech_id = mapping[\"technique_id\"]\n            if tech_id not in seen_techniques:\n                self.add_pattern_from_mapping(mapping, report_source)\n                seen_techniques.add(tech_id)\n\n        bundle = Bundle(objects=self.patterns + self.relationships)\n        print(f\"[+] Library: {len(self.patterns)} attack patterns\")\n        return bundle\n\n    def export_library(self, output_file=\"attack_pattern_library.json\"):\n        bundle = Bundle(objects=self.patterns + self.relationships)\n        with open(output_file, \"w\") as f:\n            f.write(bundle.serialize(pretty=True))\n        print(f\"[+] Library exported to {output_file}\")\n\n    def generate_detection_templates(self, mapped_behaviors):\n        \"\"\"Generate Sigma rule templates from attack patterns.\"\"\"\n        templates = []\n        for mapping in mapped_behaviors:\n            template = {\n                \"title\": f\"Detection: {mapping['technique_name']} ({mapping['technique_id']})\",\n                \"status\": \"experimental\",\n                \"description\": f\"Detects {mapping['technique_name']} based on CTI report observation\",\n                \"references\": [\n                    f\"https:\u002F\u002Fattack.mitre.org\u002Ftechniques\u002F{mapping['technique_id'].replace('.', '\u002F')}\u002F\",\n                ],\n                \"tags\": [\n                    f\"attack.{mapping['tactics'][0]}\" if mapping['tactics'] else \"attack.unknown\",\n                    f\"attack.{mapping['technique_id'].lower()}\",\n                ],\n                \"data_sources\": mapping.get(\"data_sources\", []),\n                \"observed_tools\": mapping.get(\"tools_observed\", []),\n                \"source_context\": mapping[\"source_sentence\"],\n            }\n            templates.append(template)\n\n        with open(\"detection_templates.json\", \"w\") as f:\n            json.dump(templates, f, indent=2)\n        print(f\"[+] Generated {len(templates)} detection templates\")\n        return templates\n\nlibrary = AttackPatternLibrary()\nbundle = library.build_library(mapped_behaviors, \"Sample CTI Report\")\nlibrary.export_library()\ntemplates = library.generate_detection_templates(mapped_behaviors)\n```\n\n## Validation Criteria\n\n- CTI report parsed and behavioral indicators extracted\n- Behaviors mapped to ATT&CK techniques with confidence\n- STIX 2.1 Attack Pattern objects created with proper references\n- Library searchable by tactic, technique, and threat actor\n- Detection templates generated from documented patterns\n- Library exportable as STIX bundle for sharing\n\n## References\n\n- [MITRE ATT&CK](https:\u002F\u002Fattack.mitre.org\u002F)\n- [STIX 2.1 Attack Pattern SDO](https:\u002F\u002Fdocs.oasis-open.org\u002Fcti\u002Fstix\u002Fv2.1\u002Fos\u002Fstix-v2.1-os.html#_axjijf603msy)\n- [CISA: Best Practices for ATT&CK Mapping](https:\u002F\u002Fwww.cisa.gov\u002Fsites\u002Fdefault\u002Ffiles\u002F2023-01\u002FBest%20Practices%20for%20MITRE%20ATTCK%20Mapping.pdf)\n- [attackcti Python Library](https:\u002F\u002Fgithub.com\u002FOTRF\u002FATTACK-Python-Client)\n- [Sigma Rules Project](https:\u002F\u002Fgithub.com\u002FSigmaHQ\u002Fsigma)\n- [MITRE ATT&CK STIX Data](https:\u002F\u002Fgithub.com\u002Fmitre\u002Fcti)\n","# Building Attack Pattern Library from CTI Reports\n\n## Overview\n\nCyber threat intelligence (CTI) reports from vendors like Mandiant, CrowdStrike, Talos, and Microsoft contain detailed descriptions of adversary behaviors that can be extracted, normalized, and cataloged into a structured attack pattern library. This skill covers parsing CTI reports to extract adversary techniques, mapping behaviors to MITRE ATT&CK technique IDs, creating STIX 2.1 Attack Pattern objects, building a searchable library indexed by tactic, technique, and threat actor, and generating detection rule templates from documented patterns.\n\n\n## When to Use\n\n- When deploying or configuring building attack pattern library from cti reports capabilities in your environment\n- When establishing security controls aligned to compliance requirements\n- When building or improving security architecture for this domain\n- When conducting security assessments that require this implementation\n\n## Prerequisites\n\n- Python 3.9+ with `stix2`, `mitreattack-python`, `spacy`, `requests` libraries\n- Collection of CTI reports (PDF, HTML, or text format)\n- MITRE ATT&CK STIX data (local or via TAXII)\n- Understanding of ATT&CK technique structure and naming conventions\n- Familiarity with detection engineering concepts (Sigma, YARA)\n\n## Key Concepts\n\n### Attack Pattern Extraction\n\nCTI reports describe adversary behaviors in natural language. Extraction involves identifying action verbs and technical terms that map to ATT&CK techniques, recognizing tool names and malware families, identifying infrastructure indicators, and mapping sequences of behaviors to attack chains (kill chain phases).\n\n### STIX 2.1 Attack Pattern Objects\n\nSTIX defines Attack Pattern as a Structured Domain Object (SDO) that describes ways threat actors attempt to compromise targets. Each pattern links to ATT&CK via external references, includes kill chain phases (tactics), and can be related to Intrusion Sets, Malware, and Tool objects.\n\n### Detection Rule Generation\n\nExtracted attack patterns inform detection engineering by providing: specific procedure examples for Sigma rule creation, behavioral sequences for correlation rules, IOC patterns for YARA and Snort rules, and data source requirements for telemetry gaps.\n\n## Workflow\n\n### Step 1: Parse CTI Reports and Extract Behaviors\n\n```python\nimport re\nimport json\nfrom collections import defaultdict\n\nclass CTIReportParser:\n    \"\"\"Parse CTI reports to extract adversary behaviors.\"\"\"\n\n    BEHAVIOR_INDICATORS = [\n        \"used\", \"executed\", \"deployed\", \"leveraged\", \"exploited\",\n        \"established\", \"created\", \"modified\", \"downloaded\", \"uploaded\",\n        \"exfiltrated\", \"injected\", \"enumerated\", \"spawned\", \"dropped\",\n        \"persisted\", \"escalated\", \"moved laterally\", \"collected\",\n        \"encrypted\", \"compressed\", \"encoded\", \"obfuscated\",\n    ]\n\n    TOOL_PATTERNS = [\n        r'\\b(Cobalt Strike|Mimikatz|PsExec|BloodHound|Rubeus|Impacket)\\b',\n        r'\\b(PowerShell|cmd\\.exe|WMI|WMIC|certutil|bitsadmin)\\b',\n        r'\\b(Metasploit|Empire|Covenant|Sliver|Brute Ratel)\\b',\n        r'\\b(Lazagne|SharpHound|ADFind|Sharphound|Invoke-Obfuscation)\\b',\n    ]\n\n    TECHNIQUE_KEYWORDS = {\n        \"spearphishing\": \"T1566\",\n        \"phishing attachment\": \"T1566.001\",\n        \"phishing link\": \"T1566.002\",\n        \"powershell\": \"T1059.001\",\n        \"command line\": \"T1059.003\",\n        \"scheduled task\": \"T1053.005\",\n        \"registry run key\": \"T1547.001\",\n        \"process injection\": \"T1055\",\n        \"dll side-loading\": \"T1574.002\",\n        \"credential dumping\": \"T1003\",\n        \"lsass\": \"T1003.001\",\n        \"kerberoasting\": \"T1558.003\",\n        \"pass the hash\": \"T1550.002\",\n        \"remote desktop\": \"T1021.001\",\n        \"smb\": \"T1021.002\",\n        \"winrm\": \"T1021.006\",\n        \"data staging\": \"T1074\",\n        \"exfiltration over c2\": \"T1041\",\n        \"dns tunneling\": \"T1071.004\",\n        \"web shell\": \"T1505.003\",\n    }\n\n    def parse_report(self, text, report_metadata=None):\n        \"\"\"Parse a CTI report and extract behaviors.\"\"\"\n        sentences = re.split(r'[.!?]\\s+', text)\n        behaviors = []\n\n        for sentence in sentences:\n            sentence_lower = sentence.lower()\n            # Check for behavior indicators\n            for indicator in self.BEHAVIOR_INDICATORS:\n                if indicator in sentence_lower:\n                    behavior = {\n                        \"sentence\": sentence.strip(),\n                        \"action\": indicator,\n                        \"tools\": self._extract_tools(sentence),\n                        \"technique_hints\": self._match_techniques(sentence_lower),\n                    }\n                    if behavior[\"technique_hints\"]:\n                        behaviors.append(behavior)\n                    break\n\n        print(f\"[+] Extracted {len(behaviors)} behavioral indicators from report\")\n        return behaviors\n\n    def _extract_tools(self, text):\n        \"\"\"Extract tool\u002Fmalware names from text.\"\"\"\n        tools = set()\n        for pattern in self.TOOL_PATTERNS:\n            matches = re.findall(pattern, text, re.IGNORECASE)\n            tools.update(matches)\n        return list(tools)\n\n    def _match_techniques(self, text):\n        \"\"\"Match text to ATT&CK technique hints.\"\"\"\n        matches = []\n        for keyword, tech_id in self.TECHNIQUE_KEYWORDS.items():\n            if keyword in text:\n                matches.append({\"keyword\": keyword, \"technique_id\": tech_id})\n        return matches\n\nparser = CTIReportParser()\nsample_report = \"\"\"\nThe threat actor used spearphishing attachments with macro-enabled documents to\ngain initial access. Once inside, they executed PowerShell scripts to download\nadditional tooling. The actor leveraged Mimikatz to dump credentials from LSASS\nmemory. They then used pass the hash techniques for lateral movement via SMB\nto multiple systems. Data was staged in a compressed archive and exfiltrated\nover the existing C2 channel. The actor established persistence through\nscheduled tasks and registry run keys.\n\"\"\"\nbehaviors = parser.parse_report(sample_report)\n```\n\n### Step 2: Map Behaviors to ATT&CK Techniques\n\n```python\nfrom attackcti import attack_client\n\nclass ATTACKMapper:\n    def __init__(self):\n        self.lift = attack_client()\n        self.techniques = {}\n        self._load_techniques()\n\n    def _load_techniques(self):\n        \"\"\"Load all ATT&CK techniques for mapping.\"\"\"\n        all_techs = self.lift.get_enterprise_techniques()\n        for tech in all_techs:\n            tech_id = \"\"\n            for ref in tech.get(\"external_references\", []):\n                if ref.get(\"source_name\") == \"mitre-attack\":\n                    tech_id = ref.get(\"external_id\", \"\")\n                    break\n            if tech_id:\n                self.techniques[tech_id] = {\n                    \"name\": tech.get(\"name\", \"\"),\n                    \"description\": tech.get(\"description\", \"\")[:500],\n                    \"tactics\": [p.get(\"phase_name\") for p in tech.get(\"kill_chain_phases\", [])],\n                    \"platforms\": tech.get(\"x_mitre_platforms\", []),\n                    \"data_sources\": tech.get(\"x_mitre_data_sources\", []),\n                }\n        print(f\"[+] Loaded {len(self.techniques)} ATT&CK techniques\")\n\n    def map_behaviors(self, behaviors):\n        \"\"\"Map extracted behaviors to ATT&CK techniques.\"\"\"\n        mapped = []\n        for behavior in behaviors:\n            for hint in behavior.get(\"technique_hints\", []):\n                tech_id = hint[\"technique_id\"]\n                if tech_id in self.techniques:\n                    tech_info = self.techniques[tech_id]\n                    mapped.append({\n                        \"technique_id\": tech_id,\n                        \"technique_name\": tech_info[\"name\"],\n                        \"tactics\": tech_info[\"tactics\"],\n                        \"source_sentence\": behavior[\"sentence\"],\n                        \"tools_observed\": behavior[\"tools\"],\n                        \"keyword_matched\": hint[\"keyword\"],\n                        \"data_sources\": tech_info[\"data_sources\"],\n                    })\n        print(f\"[+] Mapped {len(mapped)} behaviors to ATT&CK techniques\")\n        return mapped\n\nmapper = ATTACKMapper()\nmapped_behaviors = mapper.map_behaviors(behaviors)\n```\n\n### Step 3: Create STIX 2.1 Attack Pattern Library\n\n```python\nfrom stix2 import AttackPattern, Relationship, Bundle, TLP_GREEN\nfrom datetime import datetime\n\nclass AttackPatternLibrary:\n    def __init__(self):\n        self.patterns = []\n        self.relationships = []\n\n    def add_pattern_from_mapping(self, mapping, report_source=\"CTI Report\"):\n        \"\"\"Create STIX Attack Pattern from mapped behavior.\"\"\"\n        pattern = AttackPattern(\n            name=mapping[\"technique_name\"],\n            description=f\"Observed: {mapping['source_sentence']}\\n\\n\"\n                        f\"Tools: {', '.join(mapping['tools_observed']) or 'None identified'}\\n\"\n                        f\"Source: {report_source}\",\n            external_references=[{\n                \"source_name\": \"mitre-attack\",\n                \"external_id\": mapping[\"technique_id\"],\n                \"url\": f\"https:\u002F\u002Fattack.mitre.org\u002Ftechniques\u002F{mapping['technique_id'].replace('.', '\u002F')}\u002F\",\n            }],\n            kill_chain_phases=[{\n                \"kill_chain_name\": \"mitre-attack\",\n                \"phase_name\": tactic,\n            } for tactic in mapping[\"tactics\"]],\n            object_marking_refs=[TLP_GREEN],\n        )\n        self.patterns.append(pattern)\n        return pattern\n\n    def build_library(self, mapped_behaviors, report_source=\"CTI Report\"):\n        \"\"\"Build complete attack pattern library from mappings.\"\"\"\n        seen_techniques = set()\n        for mapping in mapped_behaviors:\n            tech_id = mapping[\"technique_id\"]\n            if tech_id not in seen_techniques:\n                self.add_pattern_from_mapping(mapping, report_source)\n                seen_techniques.add(tech_id)\n\n        bundle = Bundle(objects=self.patterns + self.relationships)\n        print(f\"[+] Library: {len(self.patterns)} attack patterns\")\n        return bundle\n\n    def export_library(self, output_file=\"attack_pattern_library.json\"):\n        bundle = Bundle(objects=self.patterns + self.relationships)\n        with open(output_file, \"w\") as f:\n            f.write(bundle.serialize(pretty=True))\n        print(f\"[+] Library exported to {output_file}\")\n\n    def generate_detection_templates(self, mapped_behaviors):\n        \"\"\"Generate Sigma rule templates from attack patterns.\"\"\"\n        templates = []\n        for mapping in mapped_behaviors:\n            template = {\n                \"title\": f\"Detection: {mapping['technique_name']} ({mapping['technique_id']})\",\n                \"status\": \"experimental\",\n                \"description\": f\"Detects {mapping['technique_name']} based on CTI report observation\",\n                \"references\": [\n                    f\"https:\u002F\u002Fattack.mitre.org\u002Ftechniques\u002F{mapping['technique_id'].replace('.', '\u002F')}\u002F\",\n                ],\n                \"tags\": [\n                    f\"attack.{mapping['tactics'][0]}\" if mapping['tactics'] else \"attack.unknown\",\n                    f\"attack.{mapping['technique_id'].lower()}\",\n                ],\n                \"data_sources\": mapping.get(\"data_sources\", []),\n                \"observed_tools\": mapping.get(\"tools_observed\", []),\n                \"source_context\": mapping[\"source_sentence\"],\n            }\n            templates.append(template)\n\n        with open(\"detection_templates.json\", \"w\") as f:\n            json.dump(templates, f, indent=2)\n        print(f\"[+] Generated {len(templates)} detection templates\")\n        return templates\n\nlibrary = AttackPatternLibrary()\nbundle = library.build_library(mapped_behaviors, \"Sample CTI Report\")\nlibrary.export_library()\ntemplates = library.generate_detection_templates(mapped_behaviors)\n```\n\n## Validation Criteria\n\n- CTI report parsed and behavioral indicators extracted\n- Behaviors mapped to ATT&CK techniques with confidence\n- STIX 2.1 Attack Pattern objects created with proper references\n- Library searchable by tactic, technique, and threat actor\n- Detection templates generated from documented patterns\n- Library exportable as STIX bundle for sharing\n\n## References\n\n- [MITRE ATT&CK](https:\u002F\u002Fattack.mitre.org\u002F)\n- [STIX 2.1 Attack Pattern SDO](https:\u002F\u002Fdocs.oasis-open.org\u002Fcti\u002Fstix\u002Fv2.1\u002Fos\u002Fstix-v2.1-os.html#_axjijf603msy)\n- [CISA: Best Practices for ATT&CK Mapping](https:\u002F\u002Fwww.cisa.gov\u002Fsites\u002Fdefault\u002Ffiles\u002F2023-01\u002FBest%20Practices%20for%20MITRE%20ATTCK%20Mapping.pdf)\n- [attackcti Python Library](https:\u002F\u002Fgithub.com\u002FOTRF\u002FATTACK-Python-Client)\n- [Sigma Rules Project](https:\u002F\u002Fgithub.com\u002FSigmaHQ\u002Fsigma)\n- [MITRE ATT&CK STIX Data](https:\u002F\u002Fgithub.com\u002Fmitre\u002Fcti)\n",{"name":5,"tags":49,"author":51,"domain":42,"license":15,"version":52,"nist_csf":53,"subdomain":34,"description":7,"mitre_attack":58,"d3fend_techniques":63},[30,29,27,33,28,34,35,50],"extraction","mahipal","1.0",[54,55,56,57],"ID.RA-01","ID.RA-05","DE.CM-01","DE.AE-02",[59,31,60,61,62],"T1566.001","T1003.001","T1558.003","T1550.002",[64,65,66,67,68],"File Metadata Consistency Validation","Application Protocol Command Analysis","Identifier Analysis","Content Format Conversion","Message Analysis","main","54a798831d2266a3ca61ce68a7acb80b81160d57","skills\u002Fbuilding-attack-pattern-library-from-cti-reports",4414,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills","https:\u002F\u002Fmahipal.engineer\u002FAnthropic-Cybersecurity-Skills\u002F","https:\u002F\u002Fgithub.com\u002Fmukul975","Mahipal.engineer","🔐 Cybersecurity | 💻 Dev | 📷 Street Photographer\r\n🎓 MSc | 📚 Research & AI Security","2026-08-31 12:32:44",{"source":8,"skillName":5,"commands":80,"prompt":90,"zipAvailable":91},[81,84,87],{"tool":82,"command":83},"npx","npx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill building-attack-pattern-library-from-cti-reports",{"tool":85,"command":86},"bunx","bunx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill building-attack-pattern-library-from-cti-reports",{"tool":88,"command":89},"pnpm","pnpm dlx skills add mukul975\u002FAnthropic-Cybersecurity-Skills --skill building-attack-pattern-library-from-cti-reports","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002FSKILL.md",true,[93,98,104],{"path":94,"resourceType":94,"resourceTypeDesc":95,"sizeBytes":96,"sourceHtmlUrl":97},"LICENSE","许可证",11255,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002FLICENSE",{"path":99,"resourceType":100,"resourceTypeDesc":101,"sizeBytes":102,"sourceHtmlUrl":103},"references\u002Fapi-reference.md","REFERENCE","参考文档",1431,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002Freferences\u002Fapi-reference.md",{"path":105,"resourceType":106,"resourceTypeDesc":107,"sizeBytes":108,"sourceHtmlUrl":109},"scripts\u002Fagent.py","SCRIPT","脚本",5175,"https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002Fscripts\u002Fagent.py",[111,138,162,189,215,242],{"skillNo":112,"name":113,"nameZh":6,"description":114,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":118,"publishedAt":44},"01M6AGDM3HJXTKXX15ZZ0ZVCJ3","verifying-build-provenance-with-slsa-sigstore","Verifies artifact signatures and SLSA provenance using Sigstore's cosign (verify, verify-attestation, verify-blob-attestation) and slsa-verifier (verify-artifact), enforcing keyless OIDC builder identity and source repo against SLSA Build levels. Use in CI\u002FCD before deploying artifacts, when consuming third-party attestations, establishing a SLSA Build L3 pipeline, or confirming provenance during incident response or admission control.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fverifying-build-provenance-with-slsa-sigstore\u002FSKILL.md",[117],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[119,120,121,122,123,42,124,125,126,127,128,129,130,131,132,133,134,135,136,137],"sigstore","provenance","slsa","verifying build provenance with slsa sigstore","security","incident response","identity","pr","code","artifacts","ci","supply-chain","pipeline","supply-chain-security","t1195","attestation","code-signing","cosign","keyless",{"skillNo":139,"name":140,"nameZh":6,"description":141,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":142,"categories":143,"keywords":145,"publishedAt":44},"01M6AGDGBPWYVZ2F11GFKJ4HZ9","validating-tpm-measured-boot-attestation","Verifies TPM 2.0 measured-boot integrity and remote attestation with tpm2-tools -- reading PCRs (tpm2_pcrread), replaying the boot event log, generating and checking signed quotes (tpm2_quote\u002Ftpm2_checkquote), and sealing secrets to a PCR policy. Use to confirm a system booted trusted firmware\u002Fkernel for Zero Trust device posture, detect boot-chain tampering via PCR drift, or build a golden-value baseline for fleet attestation.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-tpm-measured-boot-attestation\u002FSKILL.md",[144],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[146,134,147,148,123,149,42,126,150,151,152,153,154,155,156,157,158,159,160,161],"boot","TPM","validating tpm measured boot attestation","policy","verification","ZeRO","firmware","Tools","measured-boot","PCR","integrity","secrets","remote-attestation","tpm2-tools","integrity-verification","trusted-computing",{"skillNo":163,"name":164,"nameZh":6,"description":165,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":166,"categories":167,"keywords":172,"publishedAt":44},"01M6AGDCW0Y4FXZ3362GT1941M","validating-backup-integrity-for-recovery","Validates backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to confirm backups are reliable for disaster recovery and ransomware response. Use before relying on backups for recovery, when building post-backup validation pipelines, auditing backup infrastructure for compliance, or checking immutable\u002Fair-gapped backups for silent corruption or tampering.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalidating-backup-integrity-for-recovery\u002FSKILL.md",[168,171],{"categoryNo":169,"categoryName":170,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[156,173,174,175,176,42,177,39,150,178,179,180,181,182,183,184,185,186,187,188],"backup","recovery","validating backup integrity for recovery","testing","infrastructure","compliance","hash-verification","incident-response","ransomware","cryptocurrency","detection","t1078","t1490","immutable","disaster-recovery","restore-testing",{"skillNo":190,"name":191,"nameZh":6,"description":192,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":193,"categories":194,"keywords":196,"publishedAt":44},"01M6AGD9GBG2KZ336AE763J3WH","triaging-windows-with-kape","Runs KAPE (Kroll Artifact Parser and Extractor) to collect targeted forensic artifacts (registry hives, $MFT, event logs, prefetch, browser data) via Targets and parse them with Modules wrapping Eric Zimmerman's EZ Tools (PECmd, MFTECmd, RECmd). Use during early incident containment\u002Ftriage when full disk imaging is impractical but a defensible, parseable Windows artifact set is needed quickly, including at-scale remote collection.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-windows-with-kape\u002FSKILL.md",[195],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[197,198,199,42,200,201,202,203,204,205,206,207,208,209,210,211,153,212,213,214],"windows","kape","triaging windows with kape","registry","browser","logs","windows-forensics","dfir","mft","mftecmd","data","prefetch","eric-zimmerman","digital-forensics","SET","collection","pecmd","artifact-collection",{"skillNo":216,"name":217,"nameZh":6,"description":218,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":219,"categories":220,"keywords":222,"publishedAt":44},"01M6AGD5PW5J4EVZM958WD74ZQ","triaging-vulnerabilities-with-ssvc-framework","Triages and prioritizes vulnerabilities with CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree, weighing exploitation status (via the CISA KEV catalog and FIRST EPSS API), technical impact, automatability, and mission prevalence to output Track\u002FTrack*\u002FAttend\u002FAct decisions. Use when prioritizing vulnerability scan results (OpenVAS, Nessus, Qualys) for remediation planning beyond raw CVSS scores.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-vulnerabilities-with-ssvc-framework\u002FSKILL.md",[221],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[223,224,225,42,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241],"vulnerabilities","framework","triaging vulnerabilities with ssvc framework","status","planning","CISA","vulnerability-management","risk-management","nessus","qualys","openvas","cvss","remediation","risk","vulnerability","api","prioritization","ssvc","decision-tree",{"skillNo":243,"name":244,"nameZh":6,"description":245,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":246,"categories":247,"keywords":249,"publishedAt":44},"01M6AGD24TTQQM4CXG69E3B9TJ","triaging-security-incident","Performs initial triage of security incidents using the NIST SP 800-61r3 and SANS PICERL frameworks, classifying incident type, assigning priority by business impact, and routing to the appropriate response team. Use when a SIEM\u002FEDR alert needs human classification, concurrent alerts must be prioritized, or a user report or threat-intel IOC match requires initial incident categorization.","https:\u002F\u002Fgithub.com\u002Fmukul975\u002FAnthropic-Cybersecurity-Skills\u002Fblob\u002Fmain\u002Fskills\u002Ftriaging-security-incident\u002FSKILL.md",[248],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[123,250,42,251,37,252,253,254,255,256,257,184,258,185,259,260,261,262,263,264],"triaging security incident","siem","ioc","soc","NIST-800-61","NIST","severity","edr","execution","analysis","classification","severity-classification","incident-triage","SANS-PICERL","SOC-operations"]