attack-rs
Production-grade Rust library for the MITRE ATT&CK® Framework
A strongly-typed, high-performance semantic layer for MITRE ATT&CK, providing complete coverage of all ATT&CK objects, relationships, and extended fields. Built on top of stix-rs for STIX 2.1 compatibility.
Features
- 100% ATT&CK Coverage - All 16 object types, 6 relationship types, 45 extended fields
- High Performance - O(1) lookups via HashMap indices, efficient relationship traversal
- Type-Safe - Strongly-typed domain models with comprehensive trait implementations
- Multi-Domain - Enterprise, Mobile, and ICS ATT&CK matrices
- Smart Indexing - T-Code lookup, name search, relationship mapping
- Validation - ID validation with revoked/deprecated detection
- Well-Tested - 23 comprehensive integration tests
Quick Start
Add to your Cargo.toml:
[]
= "0.1.0"
Basic Usage
use ;
Campaign Attribution
// Track threat campaigns
let campaign = store.get_campaign?.unwrap;
println!;
// Get attribution
let groups = store.get_groups_for_campaign;
let techniques = store.get_techniques_for_campaign;
let software = store.get_software_for_campaign;
Detection Engineering
// Get granular detection data
let components = store.get_datacomponents_for_technique;
for component in components
Validation
use ;
let validator = new;
match validator.validate_id
Complete ATT&CK Coverage
Object Types (16/16)
| ATT&CK Object | STIX Type | Description |
|---|---|---|
| Technique | attack-pattern |
Adversary tactics and techniques |
| Sub-technique | attack-pattern |
Specific implementations of techniques |
| Tactic | x-mitre-tactic |
Tactical goals (Initial Access, etc.) |
| Group | intrusion-set |
Threat actor groups (APT29, etc.) |
| Campaign | campaign |
Specific threat operations |
| Software | malware / tool |
Malware and tools |
| Mitigation | course-of-action |
Defensive measures |
| Data Source | x-mitre-data-source |
Detection data sources |
| Data Component | x-mitre-data-component |
Granular detection points |
| Matrix | x-mitre-matrix |
Enterprise/Mobile/ICS matrices |
| Analytic | x-mitre-analytic |
Detection analytics |
| Detection Strategy | x-mitre-detection-strategy |
Detection approaches |
Relationships (6/6)
uses- Group/Campaign → Technique/Softwaremitigates- Mitigation → Techniquedetects- Data Source/Component → Techniqueattributed-to- Campaign → Groupsubtechnique-of- Sub-technique → Techniquerevoked-by- Old Object → New Object
Extended Fields (45/45)
All x_mitre_* fields are captured, including:
- Version tracking
- Contributors
- Domain classifications
- Detection guidance
- Permission requirements
- Defense bypass methods
- And more...
See the API Documentation for complete field listings.
Architecture
attack-rs
├── domain/ # Strongly-typed ATT&CK objects
│ ├── technique.rs # Techniques & sub-techniques
│ ├── tactic.rs # Tactics
│ ├── group.rs # Threat actor groups
│ ├── campaign.rs # Campaigns
│ ├── software.rs # Malware & tools
│ ├── mitigation.rs # Mitigations
│ ├── data_source.rs # Data sources
│ ├── data_component.rs # Data components
│ ├── matrix.rs # ATT&CK matrices
│ ├── analytic.rs # Analytics
│ └── detection_strategy.rs
├── store/ # Knowledge graph & indices
├── validation/ # ID validation
└── error/ # Error types
CLI Tool
Install the CLI:
Usage
# Download ATT&CK data
# Lookup technique
# Validate IDs
# Display ATT&CK matrix
Testing
Run the test suite:
Coverage includes:
- Integration tests (7)
- Full object coverage tests (10)
- Field coverage tests (6)
Performance
- Loading: ~500ms for full Enterprise ATT&CK dataset
- Memory: ~20MB for Enterprise ATT&CK (4000+ objects)
- Lookups: O(1) via HashMap indices
- Relationship traversal: O(k) where k = related objects
Integration
With stix-rs
attack-rs is built on stix-rs:
use StixObject;
use ;
let tech: Technique = /* ... */;
println!;
println!;
With hpfeeds-rs
Validate ATT&CK IDs from threat feeds:
use ;
let store = from_file?;
let validator = new;
// Validate IDs from HPFeeds
if validator.validate_id.is_valid
With maec-rs
Map malware analysis to ATT&CK:
// Map malware behavior to techniques
let techniques = map_behavior_to_attack;
Documentation
- API Documentation - Complete API reference with examples
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Add tests for new functionality
- Ensure
cargo testandcargo clippypass - Submit a pull request
License
Licensed under the MIT License. See LICENSE-MIT for details.
Acknowledgments
- MITRE Corporation for the ATT&CK® Framework
- Built for the Threatwise threat intelligence stack
MITRE ATT&CK® is a registered trademark of The MITRE Corporation.