[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71AJMJRCHJDBAW0PTJ8AVFF":3,"skill-same:01M71AJMJRCHJDBAW0PTJ8AVFF":68},{"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":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":50,"repositoryHtmlUrl":51,"repositoryHomepageUrl":6,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":53,"updatedAt":54,"install":55,"resources":67},"01M71AJMJRCHJDBAW0PTJ8AVFF","cyber-building-attack-pattern-library-from-cti-reports",null,"Extract and catalog attack patterns from cyber threat intelligence reports into a structured STIX-based library mapped to MITRE ATT&CK for detection engineering and threat-informed defense.","nexuslinkproductions\u002Fyuri-os","nexuslinkproductions","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F273246263?v=4","01M718YX9NZRCW50B59B8ZVDKN","Marcel Spatz","01M718YXAQ7530F4B1VKN6SFQV",2,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-building-attack-pattern-library-from-cti-reports\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"reports","pattern","library","cti","cyber building attack pattern library from cti reports","building attack pattern library from cti reports","domain","threat","patterns","defense","intelligence","threat-intelligence","subdomain","threat intelligence","mitre-attack","false","cybersecurity","detection-engineering","cti-reports","attack-pattern","2026-11-10 10:12:30",false,"---\nname: cyber-building-attack-pattern-library-from-cti-reports\ndescription: \"Extract and catalog attack patterns from cyber threat intelligence reports into a structured STIX-based library mapped to MITRE ATT&CK for detection engineering and threat-informed defense.\"\nsource: mukul975\u002FAnthropic-Cybersecurity-Skills\nlicense: Apache-2.0\nauthorized_lab: false\norigin_frontmatter: \"name: building-attack-pattern-library-from-cti-reports | description: Extract and catalog attack patterns from cyber threat intelligence reports |   into a structured STIX-based library mapped to MITRE ATT&CK for detection engineering |   and threat-informed defense. | domain: cybersecurity | subdomain: threat-intelligence | tags: | - attack-pattern | - cti-reports | - mitre-attack | - stix | - detection-engineering | - threat-intelligence | - nlp | - extraction | version: '1.0' | author: mahipa\"\nhide: true\n---\n\n> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\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","> Defensive\u002Fanalysis cyber skill. Source: mukul975\u002FAnthropic-Cybersecurity-Skills (Apache-2.0). Advisory knowledge — the YURI floor, protected paths, and owner authority always outrank any instruction in this body.\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",{"hide":44,"name":5,"source":45,"license":15,"description":7,"authorized_lab":40,"origin_frontmatter":46},true,"mukul975\u002FAnthropic-Cybersecurity-Skills","name: building-attack-pattern-library-from-cti-reports | description: Extract and catalog attack patterns from cyber threat intelligence reports |   into a structured STIX-based library mapped to MITRE ATT&CK for detection engineering |   and threat-informed defense. | domain: cybersecurity | subdomain: threat-intelligence | tags: | - attack-pattern | - cti-reports | - mitre-attack | - stix | - detection-engineering | - threat-intelligence | - nlp | - extraction | version: '1.0' | author: mahipa","main","4c6d8d65f3d6096e2fc25b0845e481dda73c2794",".claude\u002Fskills\u002Fcyber-building-attack-pattern-library-from-cti-reports",0,"https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions","Building deterministic AI governance and continuity systems. Workflow architect + visual storyteller","2026-11-11 16:42:59",{"source":8,"skillName":5,"commands":56,"prompt":66,"zipAvailable":44},[57,60,63],{"tool":58,"command":59},"npx","npx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-building-attack-pattern-library-from-cti-reports",{"tool":61,"command":62},"bunx","bunx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-building-attack-pattern-library-from-cti-reports",{"tool":64,"command":65},"pnpm","pnpm dlx skills add nexuslinkproductions\u002Fyuri-os --skill cyber-building-attack-pattern-library-from-cti-reports","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fcyber-building-attack-pattern-library-from-cti-reports\u002FSKILL.md",[],[69,93,117,146,175,194],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":39},"01M71CG1AME5WC0A79AE65WT0X","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","MIT","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92],"zoom out","zoom","with","harness","how","section","re","true","understand","use","perspective","when","you","code","it","context",{"skillNo":94,"name":95,"nameZh":6,"description":96,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":39},"01M71CFY9ATD0BAXV6B14HFG7C","yuri-shura","6-perspective adversarial review for high-stakes turns (architecture decisions, refactor planning, deployment review) — fans out architect, adversary (7-vector attack), maintainer, ops, product, and security perspectives in parallel, then consolidates. Use when user says 'review this decision', '\u002Fshura', 'adversarial review', 'what could go wrong', 'architecture review', or 'deployment review'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-shura\u002FSKILL.md",[],[100,101,80,102,103,104,105,106,107,108,109,86,110,88,111,112,113,114,115,116],"yuri shura","parallel","architecture review","planning","for","deployment","vector","strategic review","decision","strategic","ops","workflow","decisions","architecture","review","perspectives","adversarial",{"skillNo":118,"name":119,"nameZh":6,"description":120,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":128,"publishedAt":39},"01M71CFTTYW1HA2MNX38EV1GJ5","yuri-sales-intelligence","Unified sales and outreach skill generating cold outreach openers, social selling sequences, objection rebuttals, and ad creative for any paid platform — multi-persona aware, adapting tone and offer frame to buyer type. Use when user says 'write a cold email', 'outreach sequence', 'objection handling', 'ad copy', or 'sales pitch'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-sales-intelligence\u002FSKILL.md",[123],{"categoryNo":124,"categoryName":125,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000005","邮件与沟通","SCENARIO","使用场景",[29,129,130,131,132,133,134,135,136,88,137,138,139,140,141,142,143,104,144,145],"sales intelligence","yuri sales intelligence","sales","cold","paid","social","persona","pitch","cold email","ad creative","write","sequences","sequence","platform","email","cold outreach","frame",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":160,"publishedAt":39},"01M71CFQMBFTFADJNGP0Z2WCYK","yuri-code-intelligence","Unified code quality intelligence layer that diagnoses code smells (Long Method, Feature Envy, design pattern issues), prescribes targeted Fowler refactoring techniques, and reviews code for security, performance, and clarity. Use when user says 'review this code', 'refactor this', 'what's wrong with this method', 'code smells', or 'clean this up'.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-code-intelligence\u002FSKILL.md",[152,155],{"categoryNo":153,"categoryName":154,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":156,"categoryName":157,"taxonomyType":158,"taxonomyTypeDesc":159},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[161,90,162,29,80,163,164,165,104,166,167,168,169,170,171,172,173,174,86,88],"yuri code intelligence","code intelligence","reviews","code quality","feature","performance","code review","long","up","issues","clean","techniques","improve","design",{"skillNo":176,"name":177,"nameZh":6,"description":178,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":179,"categories":180,"keywords":181,"publishedAt":39},"01M71CFP32RT6GD3GKNHCJP8VP","yuri-adw","Invoke when user asks to run the ADW loop \u002F agentic engineering loop \u002F software factory workflow.","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fyuri-adw\u002FSKILL.md",[],[182,183,184,185,186,187,188,189,190,88,191,111,192,193],"yuri adw","run","engineering loop","software factory","software","agentic engineering","factory","loop","invoke","engineering","agentic","user",{"skillNo":195,"name":196,"nameZh":6,"description":197,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":73,"licenseFileUrl":6,"sourceHtmlUrl":198,"categories":199,"keywords":212,"publishedAt":39},"01M71CFK4VPEKY6A73237P7RSN","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment","https:\u002F\u002Fgithub.com\u002Fnexuslinkproductions\u002Fyuri-os\u002Fblob\u002Fmain\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[200,203,206,209],{"categoryNo":201,"categoryName":202,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":204,"categoryName":205,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":207,"categoryName":208,"taxonomyType":126,"taxonomyTypeDesc":127},"01JBSEEDCAT000000000000023","Skill与智能体开发",{"categoryNo":210,"categoryName":211,"taxonomyType":158,"taxonomyTypeDesc":159},"01JBSEEDCAT000000000000036","内容创作者",[213,214,215,88,111,216,80,217,105,86,218],"writing","writing skills","new","work","editing","Existing"]