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 relationships4 using impacket for SID filtering analysis, trust key extraction, cross-forest SID5 history abuse detection, and inter-realm Kerberos ticket assessment. Use when working6 with performing active directory forest trust attack.7domain: cybersecurity8subdomain: red-team9tags:10- active-directory11- forest-trust12- impacket13- SID-filtering14- kerberos15- red-team16- trust-enumeration17version: '1.0'18author: oyi7719license: Apache-2.020nist_csf:21- ID.RA-0122- GV.OV-0223- DE.AE-0724category: cybersecurity25metadata:26 source: https://skillmd.com/skills/oyi77/performing-active-directory-forest-trust-attack27---282930# Performing Active Directory Forest Trust Attack3132## Overview3334Active 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.353637## When to Use38**Trigger phrases:**39- "performing active directory forest trust attack"40- "Enumerate and audit Active Directory forest trust relationships using impacket f"414243- When conducting security assessments that involve performing active directory forest trust attack44- When following incident response procedures for related security events45- When performing scheduled security testing or auditing activities46- When validating security controls through hands-on testing4748## Prerequisites4950- Python 3.9+ with `impacket`, `ldap3`51- Domain credentials with read access to AD trust objects52- Network access to Domain Controllers (ports 389, 445, 88)53- Authorized penetration testing engagement or lab environment545556> **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.5758## Steps5960```python61# Example: IOC detection62import re6364IOC_PATTERNS = {65 "ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",66 "domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",67 "hash_md5": r"\b[a-f0-9]{32}\b",68 "hash_sha256": r"\b[a-f0-9]{64}\b",69}7071def extract_iocs(text: str) -> dict:72 return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}73```74751. Enumerate forest trust relationships via LDAP trusted domain objects762. Query trust attributes and SID filtering status for each trust773. Perform SID lookups across trust boundaries using LsarLookupNames3784. Enumerate foreign security principals in trusted domains795. Check for SID history on cross-forest accounts806. Assess trust direction and transitivity for lateral movement paths817. Generate trust security audit report with risk findings8283## Expected Output8485- JSON report listing all trust relationships, SID filtering status, foreign principals, trust direction/transitivity, and risk assessment86- Cross-forest attack path analysis with remediation recommendations87## When NOT to Use8889- You don't have explicit written authorization to test90- Task is about defense/detection, not offense (use detection skills)91- You need to implement security controls (use implementing-* skills)92- Task requires compliance auditing (use auditing-* skills)93- You're investigating an incident (use incident response skills)94- Target is out of scope for your engagement95- Task is about vulnerability scanning only (use scanning tools)969798## Red Flags99100- Performing actions without explicit written authorization from the asset owner101- Testing against production systems without a defined scope and rules of engagement102- Capturing traffic on networks without authorization or privacy considerations103- Leaving packet captures containing sensitive data unencrypted on disk104- Deploying inline blocking rules without testing for false positives first105106## Process1071081. **Reconnaissance** — Gather target information, identify attack surface, enumerate services1091. **Analysis/Exploitation** — Execute the technique, analyze results, document findings1101. **Reporting** — Document IOCs, write findings, provide remediation recommendations111112## Verification113114- All steps executed successfully against a test environment before production use115- Output documented with screenshots or logs demonstrating expected behavior116- Captures verified as complete with no dropped packets117- Detection rules tested against known-benign traffic for false positive rate118- Alert thresholds validated and tuned to reduce noise119120## Anti-Rationalization Table121122| Rationalization | Reality |123|---|---|124| "We are too small to be targeted" | Automated attacks target everyone. Size does not matter. |125| "Security slows us down" | A breach slows you down 100x more. Build security in from the start. |126| "We will fix it after launch" | Vulnerabilities in production are exploited within hours. Fix before deploy. |