[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7D6WCNMH3AS09TAGBXNZGS9":3,"skill-same:01M7D6WCNMH3AS09TAGBXNZGS9":93},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":54,"commitSha":55,"skillDirectory":56,"forksCount":57,"repositoryHtmlUrl":58,"repositoryHomepageUrl":6,"ownerHtmlUrl":59,"ownerBlogUrl":60,"ownerDescription":61,"updatedAt":62,"install":63,"resources":76},"01M7D6WCNMH3AS09TAGBXNZGS9","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.","SaiVatsal\u002FSkills-I-Use","SaiVatsal","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F242597752?v=4","01M7D5YM1T4VXW9203M0GFAHZ1","SaiVatsalPolimera","01M7D5YM2D61ST39XVR2V7B7ZJ",3,"Apache-2.0","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002FLICENSE","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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":25,"author":34,"domain":35,"license":15,"version":36,"nist_csf":37,"subdomain":31,"description":7,"mitre_attack":42,"d3fend_techniques":48},[26,27,28,29,30,31,32,33],"attack-pattern","cti-reports","mitre-attack","stix","detection-engineering","threat-intelligence","nlp","extraction","mahipal","cybersecurity","1.0",[38,39,40,41],"ID.RA-01","ID.RA-05","DE.CM-01","DE.AE-02",[43,44,45,46,47],"T1566.001","T1059.001","T1003.001","T1558.003","T1550.002",[49,50,51,52,53],"File Metadata Consistency Validation","Application Protocol Command Analysis","Identifier Analysis","Content Format Conversion","Message Analysis","main","8a3b3de73262a4c4db64523949360f3c599c2fb1","Anthropic-Cybersecurity-Skills-main\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports",0,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use","https:\u002F\u002Fgithub.com\u002FSaiVatsal","https:\u002F\u002Fsaivatsal.github.io\u002FPortfolio\u002F","The Longer It Takes The Stronger It Becomes ","2026-09-21 22:45:58",{"source":8,"skillName":5,"commands":64,"prompt":74,"zipAvailable":75},[65,68,71],{"tool":66,"command":67},"npx","npx skills add SaiVatsal\u002FSkills-I-Use --skill building-attack-pattern-library-from-cti-reports",{"tool":69,"command":70},"bunx","bunx skills add SaiVatsal\u002FSkills-I-Use --skill building-attack-pattern-library-from-cti-reports",{"tool":72,"command":73},"pnpm","pnpm dlx skills add SaiVatsal\u002FSkills-I-Use --skill building-attack-pattern-library-from-cti-reports","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002FSKILL.md",true,[77,81,87],{"path":78,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":16},"LICENSE","许可证",11255,{"path":82,"resourceType":83,"resourceTypeDesc":84,"sizeBytes":85,"sourceHtmlUrl":86},"references\u002Fapi-reference.md","REFERENCE","参考文档",1431,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002Freferences\u002Fapi-reference.md",{"path":88,"resourceType":89,"resourceTypeDesc":90,"sizeBytes":91,"sourceHtmlUrl":92},"scripts\u002Fagent.py","SCRIPT","脚本",5175,"https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002FAnthropic-Cybersecurity-Skills-main\u002Fskills\u002Fbuilding-attack-pattern-library-from-cti-reports\u002Fscripts\u002Fagent.py",[94,102,110,119,126,133],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":98,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":20},"01M7DJZP6E6KMBQV4CZSDPZEZ8","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":103,"name":104,"nameZh":6,"description":105,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":106,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":20},"01M7DJZFTS5TS06K2TV3MDTE67","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fweb-artifacts-builder\u002FSKILL.md",[],[],{"skillNo":111,"name":112,"nameZh":6,"description":113,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":114,"licenseFileUrl":115,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":20},"01M7DJRK4SRQ908F2TJM6EZ7EV","ui-styling","Create beautiful, accessible user interfaces with shadcn\u002Fui components (built on Radix UI + Tailwind), Tailwind CSS utility-first styling, and canvas-based visual designs. Use when building user interfaces, implementing design systems, creating responsive layouts, adding accessible components (dialogs, dropdowns, forms, tables), customizing themes and colors, implementing dark mode, generating visual designs and posters, or establishing consistent styling patterns across applications.","MIT","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fui-styling\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fui-styling\u002FSKILL.md",[],[],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":114,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":20},"01M7DJR902059VEQP23PVM2WA0","design","Comprehensive design skill: brand identity, design tokens, UI styling, logo generation (55 styles, Gemini AI), corporate identity program (50 deliverables, CIP mockups), HTML presentations (Chart.js), banner design (22 styles, social\u002Fads\u002Fweb\u002Fprint), icon design (15 styles, SVG, Gemini 3.1 Pro), social photos (HTML→screenshot, multi-platform). Actions: design logo, create CIP, generate mockups, build slides, design banner, generate icon, create social photos, social media images, brand identity, design system. Platforms: Facebook, Twitter, LinkedIn, YouTube, Instagram, Pinterest, TikTok, Threads, Google Ads.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fdesign\u002FSKILL.md",[],[],{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":114,"licenseFileUrl":6,"sourceHtmlUrl":130,"categories":131,"keywords":132,"publishedAt":20},"01M7DJR56QF5N6XYTCPCFHFMNP","design-system","Token architecture, component specifications, and slide generation. Three-layer tokens (primitive→semantic→component), CSS variables, spacing\u002Ftypography scales, component specs, strategic slide creation. Use for design tokens, systematic design, brand-compliant presentations.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fdesign-system\u002FSKILL.md",[],[],{"skillNo":134,"name":135,"nameZh":6,"description":136,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":114,"licenseFileUrl":6,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":20},"01M7DJQXB6M0SFF7NX8J5N01AH","banner-design","Design banners for social media, ads, website heroes, creative assets, and print. Multiple art direction options with AI-generated visuals. Actions: design, create, generate banner. Platforms: Facebook, Twitter\u002FX, LinkedIn, YouTube, Instagram, Google Display, website hero, print. Styles: minimalist, gradient, bold typography, photo-based, illustrated, geometric, retro, glassmorphism, 3D, neon, duotone, editorial, collage. Uses ui-ux-pro-max, frontend-design, ai-artist, ai-multimodal skills.","https:\u002F\u002Fgithub.com\u002FSaiVatsal\u002FSkills-I-Use\u002Fblob\u002Fmain\u002Fui-ux-pro-max-skill-main\u002Fcli\u002Fassets\u002Fskills\u002Fbanner-design\u002FSKILL.md",[],[]]