Performing Active Directory Forest Trust Attack
Overview
Active Directory forest trusts enable authentication across organizational boundaries but introduce attack surface if misconfigured. This skill uses impacket to enumerate trust relationships, analyze SID filtering configuration, detect SID history abuse vectors, perform cross-forest SID lookups via LSA/LSAT RPC calls, and assess inter-realm Kerberos ticket configurations for trust ticket forgery risks.
When to Use
Trigger phrases:
"performing active directory forest trust attack"
"Enumerate and audit Active Directory forest trust relationships using impacket f"
When conducting security assessments that involve performing active directory forest trust attack
When following incident response procedures for related security events
When performing scheduled security testing or auditing activities
When validating security controls through hands-on testing
Prerequisites
- Python 3.9+ with
impacket, ldap3
- Domain credentials with read access to AD trust objects
- Network access to Domain Controllers (ports 389, 445, 88)
- Authorized penetration testing engagement or lab environment
Legal Notice: This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.
Steps
# Example: IOC detection
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}
- Enumerate forest trust relationships via LDAP trusted domain objects
- Query trust attributes and SID filtering status for each trust
- Perform SID lookups across trust boundaries using LsarLookupNames3
- Enumerate foreign security principals in trusted domains
- Check for SID history on cross-forest accounts
- Assess trust direction and transitivity for lateral movement paths
- Generate trust security audit report with risk findings
Expected Output
- JSON report listing all trust relationships, SID filtering status, foreign principals, trust direction/transitivity, and risk assessment
- Cross-forest attack path analysis with remediation recommendations
When NOT to Use
- You don't have explicit written authorization to test
- Task is about defense/detection, not offense (use detection skills)
- You need to implement security controls (use implementing-* skills)
- Task requires compliance auditing (use auditing-* skills)
- You're investigating an incident (use incident response skills)
- Target is out of scope for your engagement
- Task is about vulnerability scanning only (use scanning tools)
Red Flags
- Performing actions without explicit written authorization from the asset owner
- Testing against production systems without a defined scope and rules of engagement
- Capturing traffic on networks without authorization or privacy considerations
- Leaving packet captures containing sensitive data unencrypted on disk
- Deploying inline blocking rules without testing for false positives first
Process
- Reconnaissance — Gather target information, identify attack surface, enumerate services
- Analysis/Exploitation — Execute the technique, analyze results, document findings
- Reporting — Document IOCs, write findings, provide remediation recommendations
Verification
- All steps executed successfully against a test environment before production use
- Output documented with screenshots or logs demonstrating expected behavior
- Captures verified as complete with no dropped packets
- Detection rules tested against known-benign traffic for false positive rate
- Alert thresholds validated and tuned to reduce noise
Anti-Rationalization Table
| Rationalization |
Reality |
| "We are too small to be targeted" |
Automated attacks target everyone. Size does not matter. |
| "Security slows us down" |
A breach slows you down 100x more. Build security in from the start. |
| "We will fix it after launch" |
Vulnerabilities in production are exploited within hours. Fix before deploy. |
1---2name: performing-active-directory-forest-trust-attack3description: Use when enumerate and audit Active Directory forest trust relationships using impacket for SID filtering analysis, trust key extraction, cross-forest SID history abuse detection, and inter-realm Kerberos ticket assessment. Use when working with performing active directory forest trust attack.4license: Apache-2.05---678# Performing Active Directory Forest Trust Attack910## Overview1112Active Directory forest trusts enable authentication across organizational boundaries but introduce attack surface if misconfigured. This skill uses impacket to enumerate trust relationships, analyze SID filtering configuration, detect SID history abuse vectors, perform cross-forest SID lookups via LSA/LSAT RPC calls, and assess inter-realm Kerberos ticket configurations for trust ticket forgery risks.131415## When to Use16**Trigger phrases:**17- "performing active directory forest trust attack"18- "Enumerate and audit Active Directory forest trust relationships using impacket f"192021- When conducting security assessments that involve performing active directory forest trust attack22- When following incident response procedures for related security events23- When performing scheduled security testing or auditing activities24- When validating security controls through hands-on testing2526## Prerequisites2728- Python 3.9+ with `impacket`, `ldap3`29- Domain credentials with read access to AD trust objects30- Network access to Domain Controllers (ports 389, 445, 88)31- Authorized penetration testing engagement or lab environment323334> **Legal Notice:** This skill is for authorized security testing and educational purposes only. Unauthorized use against systems you do not own or have written permission to test is illegal and may violate computer fraud laws.3536## Steps3738```python39# Example: IOC detection40import re4142IOC_PATTERNS = {43 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",44 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",45 "hash_md5": r"\b[a-f0-9]{32}\b",46 "hash_sha256": r"\b[a-f0-9]{64}\b",47}4849def extract_iocs(text: str) -> dict:50 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}51```52531. Enumerate forest trust relationships via LDAP trusted domain objects542. Query trust attributes and SID filtering status for each trust553. Perform SID lookups across trust boundaries using LsarLookupNames3564. Enumerate foreign security principals in trusted domains575. Check for SID history on cross-forest accounts586. Assess trust direction and transitivity for lateral movement paths597. Generate trust security audit report with risk findings6061## Expected Output6263- JSON report listing all trust relationships, SID filtering status, foreign principals, trust direction/transitivity, and risk assessment64- Cross-forest attack path analysis with remediation recommendations65## When NOT to Use6667- You don't have explicit written authorization to test68- Task is about defense/detection, not offense (use detection skills)69- You need to implement security controls (use implementing-* skills)70- Task requires compliance auditing (use auditing-* skills)71- You're investigating an incident (use incident response skills)72- Target is out of scope for your engagement73- Task is about vulnerability scanning only (use scanning tools)747576## Red Flags7778- Performing actions without explicit written authorization from the asset owner79- Testing against production systems without a defined scope and rules of engagement80- Capturing traffic on networks without authorization or privacy considerations81- Leaving packet captures containing sensitive data unencrypted on disk82- Deploying inline blocking rules without testing for false positives first8384## Process85861. **Reconnaissance** — Gather target information, identify attack surface, enumerate services871. **Analysis/Exploitation** — Execute the technique, analyze results, document findings881. **Reporting** — Document IOCs, write findings, provide remediation recommendations8990## Verification9192- All steps executed successfully against a test environment before production use93- Output documented with screenshots or logs demonstrating expected behavior94- Captures verified as complete with no dropped packets95- Detection rules tested against known-benign traffic for false positive rate96- Alert thresholds validated and tuned to reduce noise9798## Anti-Rationalization Table99100| Rationalization | Reality |101|---|---|102| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |103| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |104| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |