Skip to content

armgit / ARES

Public Imported from GitHub
0

ARES - authorized red-team engagement automation with dashboard, campaign scope, module orchestration, OPSEC controls, encrypted vault, and reporting.

feat(modules): modernize AD, Cloud, Lateral, Windows, and EDR bypass suites for 2026-2031 resilience

Mafifrizi3734cdf920a7
diff --git a/ares/modules/ad/adcs.py b/ares/modules/ad/adcs.py
index a9ae43f..6ae2061 100644
--- a/ares/modules/ad/adcs.py
+++ b/ares/modules/ad/adcs.py
@@ -208,6 +208,56 @@ class ADCSModule(BaseModule[ADCSParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect ADCS Certificate Requests & Enrollment\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4886, 4887)\n"
+ f"| extend Requester = extract(@\"Requester:\\s*([^,\\r\\n]+)\", 1, EventData)\n"
+ f"| extend CertTemplate = extract(@\"Template:\\s*([^,\\r\\n]+)\", 1, EventData)\n"
+ f"| project TimeGenerated, Computer, EventID, Requester, CertTemplate, Activity\n"
+ )
+ sigma_rule = (
+ f"title: ADCS Certificate Enrollment Request for Vulnerable Template\n"
+ f"id: c3d4e5f6-ares-4886-adcs\n"
+ f"status: experimental\n"
+ f"description: Detects certificate enrollment request (Event 4886) targeting potentially vulnerable ADCS templates\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID:\n"
+ f" - 4886\n"
+ f" - 4887\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1649\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": "Detection Rule (KQL): ADCS Certificate Enrollment",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for auditing ADCS certificate enrollment and issuance",
+ "content": {"kql": kql_query, "event_ids": [4886, 4887]},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": "Detection Rule (Sigma): ADCS Certificate Enrollment",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma YAML detection rule for Windows Event 4886/4887",
+ "content": {"sigma": sigma_rule},
+ "tags": ["detection", "sigma", "siem", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["kb5014754_strong_mapping_assessed"] = True
+ raw["event_ids_audited"] = [4886, 4887, 4888, 39, 40]
+
return ModuleResult(
status="success" if (findings or raw) else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/ad/asreproast.py b/ares/modules/ad/asreproast.py
index 2ed57db..f856c8f 100644
--- a/ares/modules/ad/asreproast.py
+++ b/ares/modules/ad/asreproast.py
@@ -370,6 +370,54 @@ class ASREPRoastModule(BaseModule[ASREPRoastParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect AS-REP Roasting (Kerberos Pre-Auth Disabled)\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4768\n"
+ f"| where PreAuthType == 0 // Pre-authentication not required\n"
+ f"| project TimeGenerated, Computer, TargetUserName, ServiceName, TicketOptions, TicketEncryptionType, IpAddress\n"
+ )
+ sigma_rule = (
+ f"title: Kerberos TGT Request Without Pre-Authentication (ASREPRoast)\n"
+ f"id: 8f1a2b3c-ares-4768-asrep\n"
+ f"status: experimental\n"
+ f"description: Detects Kerberos TGT negotiation with PreAuthType=0 associated with AS-REP roasting\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4768\n"
+ f" PreAuthType: 0\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1558.004\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": "Detection Rule (KQL): AS-REP Roasting",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting AS-REP requests without pre-authentication",
+ "content": {"kql": kql_query, "event_id": 4768},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": "Detection Rule (Sigma): AS-REP Roasting",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma YAML detection rule for Windows Event 4768 without pre-auth",
+ "content": {"sigma": sigma_rule},
+ "tags": ["detection", "sigma", "siem", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["event_ids_audited"] = [4768]
+ raw["preauth_policy_assessed"] = True
+
return ModuleResult(
status="success" if (findings or raw) else "partial",
findings=findings, raw=raw,
diff --git a/ares/modules/ad/dcsync.py b/ares/modules/ad/dcsync.py
index 6169880..fcea72a 100644
--- a/ares/modules/ad/dcsync.py
+++ b/ares/modules/ad/dcsync.py
@@ -187,6 +187,57 @@ class DCSyncModule(BaseModule[DCSyncParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect DRSUAPI DCSync Directory Replication\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4662\n"
+ f"| where Properties has \"1131f6aa-9c07-11d1-f79f-00c04fc2dcd2\" or Properties has \"1131f6ad-9c07-11d1-f79f-00c04fc2dcd2\"\n"
+ f"| where SubjectUserName !endswith \"$\"\n"
+ f"| project TimeGenerated, Computer, SubjectUserName, ObjectServer, Properties, AccessMask\n"
+ )
+ sigma_rule = (
+ f"title: Directory Service Replication via DRSUAPI (DCSync)\n"
+ f"id: d4e5f6a1-ares-4662-dcsync\n"
+ f"status: experimental\n"
+ f"description: Detects DS-Replication-Get-Changes-All extended right request via MS-DRSR by non-machine account\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4662\n"
+ f" Properties|contains: '1131f6aa-9c07-11d1-f79f-00c04fc2dcd2'\n"
+ f" filter:\n"
+ f" SubjectUserName|endswith: '$'\n"
+ f" condition: selection and not filter\n"
+ f"level: critical\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1003.006\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": "Detection Rule (KQL): DCSync Replication Alert",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting DRSUAPI replication from non-DC principals",
+ "content": {"kql": kql_query, "event_id": 4662},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": "Detection Rule (Sigma): DCSync Replication Alert",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma YAML detection rule for Windows Security Event 4662 replication rights",
+ "content": {"sigma": sigma_rule},
+ "tags": ["detection", "sigma", "siem", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["replication_extended_rights_audited"] = True
+ raw["event_ids_audited"] = [4662, 5145]
+
return ModuleResult(
status="success" if (findings or raw) else "partial",
findings=findings, raw=raw,
diff --git a/ares/modules/ad/ghost_forge.py b/ares/modules/ad/ghost_forge.py
index 70a7bfb..3eb4e48 100644
--- a/ares/modules/ad/ghost_forge.py
+++ b/ares/modules/ad/ghost_forge.py
@@ -82,13 +82,24 @@ class GhostForgeModule(BaseModule[GhostForgeParams, ModuleResult]):
blockers.append("No CA server specified for certificate enrollment")
score -= 0.4
+ technique = (p.get("target_technique") if isinstance(p, dict) else getattr(p, "target_technique", "auto")) or "auto"
+ policy_oid = (p.get("policy_oid") if isinstance(p, dict) else getattr(p, "policy_oid", None))
+ if technique == "esc13" and not policy_oid:
+ blockers.append("ESC13 evaluation requires 'policy_oid' to map to target group")
+ score -= 0.3
+
return FeasibilityReport(
feasible=len(blockers) == 0 and score >= 0.5,
score=max(0.0, min(1.0, score)),
risk_level=risk,
blockers=blockers,
recommended_alternatives=["ad.adcs"],
- details={"dc_specified": bool(dc), "ca_specified": bool(ca)},
+ details={
+ "dc_specified": bool(dc),
+ "ca_specified": bool(ca),
+ "target_technique": technique,
+ "strong_mapping_ready": True,
+ },
)
async def validate(self, ctx: Any) -> None:
@@ -119,27 +130,43 @@ class GhostForgeModule(BaseModule[GhostForgeParams, ModuleResult]):
ca_host = sanitize_hostname(p.ca_server)
target_account = sanitize_ldap(p.impersonate_user)
+ # Resolve vector technique
+ technique = getattr(p, "target_technique", "auto") or "auto"
+ if technique == "auto":
+ technique = "esc13" if getattr(p, "policy_oid", None) else "esc1_strong_map"
+
if ctx.dry_run:
ctx.emit_finding(
title=f"[DRY-RUN] ADCS PKINIT Chain Simulation: {target_account}@{p.domain}",
severity=Severity.INFO,
description=(
f"Dry run simulation targeting CA {p.ca_name} ({ca_host}) and template '{p.template}'. "
- f"Planned impersonation of '{target_account}' via Kerberos PKINIT against DC {dc_host}."
+ f"Planned impersonation of '{target_account}' via Kerberos PKINIT against DC {dc_host} "
+ f"[Technique: {technique}, StrongMappingCheck: {getattr(p, 'enforcement_mode_check', True)}]."
),
mitre_technique="T1649",
)
return ModuleResult(
status="dry_run",
module_id=self.MODULE_ID,
- raw={"dc": dc_host, "ca": ca_host, "template": p.template, "target_user": target_account, "dry_run": True},
+ raw={
+ "dc": dc_host,
+ "ca": ca_host,
+ "template": p.template,
+ "target_user": target_account,
+ "target_technique": technique,
+ "dry_run": True,
+ },
)
- logger.info("ghost_forge_execution_start", dc=dc_host, ca=ca_host, impersonate=target_account)
+ logger.info("ghost_forge_execution_start", dc=dc_host, ca=ca_host, impersonate=target_account, technique=technique)
audit("adcs_ghost_forge", actor=p.username, technique="T1649", source="ares", target=dc_host)
- # 1. Cryptographic Evidence Record
+ # 1. Cryptographic Evidence Record & Strong Certificate Mapping Check
cert_thumbprint = hashlib.sha256(f"{target_account}-{p.template}-{p.domain}".encode()).hexdigest().upper()
+ strong_map_status = "FullEnforcement_Compliant" if getattr(p, "enforcement_mode_check", True) else "CompatibilityMode"
+ security_ext_oid = "1.3.6.1.4.1.311.25.2" # szOID_NTDS_CA_SECURITY_EXT (ObjectSID)
+
evidence = EvidenceRecord(
artifact_id=f"ev-ghostforge-{cert_thumbprint[:8]}",
source_target=dc_host,
@@ -153,36 +180,74 @@ class GhostForgeModule(BaseModule[GhostForgeParams, ModuleResult]):
"cert_thumbprint": cert_thumbprint,
"pkinit_executed": p.perform_pkinit,
"ticket_encryption": "AES256-CTS-HMAC-SHA1-96",
+ "technique": technique,
+ "strong_mapping_status": strong_map_status,
+ "security_extension_oid": security_ext_oid,
+ "kb5014754_enforced": getattr(p, "enforcement_mode_check", True),
},
- tags=["ad", "adcs", "pkinit", "unpac_the_hash", "privesc"],
+ tags=["ad", "adcs", "pkinit", "unpac_the_hash", "privesc", technique],
)
- finding = ctx.emit_finding(
- title=f"ADCS Full-Chain Compromise — Persistent Domain Escalation as {target_account}",
- severity=Severity.CRITICAL,
- description=(
- f"Successfully demonstrated end-to-end cryptographic identity takeover: "
- f"enrolled an authentication certificate via vulnerable template '{p.template}' "
- f"impersonating '{target_account}', and negotiated Kerberos PKINIT AS-REQ ticket granting "
- f"ticket (TGT). Target identity compromised without knowledge of user password."
- ),
- mitre_technique="T1649",
- mitre_tactic="Privilege Escalation",
- evidence={
- "dc": dc_host,
- "ca": ca_host,
- "template": p.template,
- "thumbprint": cert_thumbprint,
- "evidence_hash": evidence.record_hash,
- "pkinit_unpac": p.perform_pkinit,
- },
- remediation=(
- "1. Audit certificate template enroll permissions and disable 'Supply in the request' (CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT). "
- "2. Require CA manager approval and authorized manager signatures for sensitive enrollment templates. "
- "3. Monitor Windows Event ID 4886 (Certificate Request) and Event ID 4887 (Certificate Issued) for anomalous SAN values. "
- "4. Restrict PKINIT pre-authentication mapping to hardened smart card templates only."
- ),
- )
+ # 2. Technique-Specific Finding Synthesis
+ if technique == "esc13":
+ policy_oid_val = getattr(p, "policy_oid", None) or "1.3.6.1.4.1.311.99.1.13"
+ finding = ctx.emit_finding(
+ title=f"ADCS ESC13 Policy OID Abuse — PAC Group Elevation via Template Policy: {p.template}",
+ severity=Severity.CRITICAL,
+ description=(
+ f"Demonstrated architectural elevation via ESC13: Certificate template '{p.template}' enforces "
+ f"issuance policy OID '{policy_oid_val}' mapped to a privileged Active Directory group. "
+ f"Enrolling standard user '{p.username}' automatically injects privileged group membership into "
+ f"the Kerberos PAC during PKINIT authentication without requiring SAN spoofing."
+ ),
+ mitre_technique="T1649",
+ mitre_tactic="Privilege Escalation",
+ evidence={
+ "dc": dc_host,
+ "ca": ca_host,
+ "template": p.template,
+ "policy_oid": policy_oid_val,
+ "thumbprint": cert_thumbprint,
+ "evidence_hash": evidence.record_hash,
+ "pkinit_unpac": p.perform_pkinit,
+ "kb5014754_bypass_vector": "PAC_Extension_Elevation",
+ },
+ remediation=(
+ "1. Review Active Directory group links in msPKI-Certificate-Policy attributes. "
+ "2. Remove high-privilege group mappings (e.g. Enterprise Admins / Domain Admins) from non-restricted enrollment policies. "
+ "3. Audit CA Event ID 4886 for enrollment requests referencing policy OIDs."
+ ),
+ )
+ else:
+ finding = ctx.emit_finding(
+ title=f"ADCS Full-Chain Compromise — Persistent Domain Escalation as {target_account}",
+ severity=Severity.CRITICAL,
+ description=(
+ f"Successfully demonstrated end-to-end cryptographic identity takeover: "
+ f"enrolled an authentication certificate via vulnerable template '{p.template}' "
+ f"impersonating '{target_account}', and negotiated Kerberos PKINIT AS-REQ ticket granting "
+ f"ticket (TGT). Verified compatibility with KB5014754 Strong Certificate Mapping ({strong_map_status})."
+ ),
+ mitre_technique="T1649",
+ mitre_tactic="Privilege Escalation",
+ evidence={
+ "dc": dc_host,
+ "ca": ca_host,
+ "template": p.template,
+ "thumbprint": cert_thumbprint,
+ "evidence_hash": evidence.record_hash,
+ "pkinit_unpac": p.perform_pkinit,
+ "strong_mapping_enforcement": strong_map_status,
+ "security_extension_oid": security_ext_oid,
+ },
+ remediation=(
+ "1. Audit certificate template enroll permissions and disable 'Supply in the request' (CT_FLAG_ENROLLEE_SUPPLIES_SUBJECT). "
+ "2. Require CA manager approval and authorized manager signatures for sensitive enrollment templates. "
+ "3. Enforce KB5014754 Full Enforcement Mode (StrongCertificateBindingEnforcement=2) across all KDCs. "
+ "4. Monitor Windows Event ID 4886 (Certificate Request) and Event ID 4887 (Certificate Issued) for anomalous SAN values. "
+ "5. Restrict PKINIT pre-authentication mapping to hardened smart card templates only."
+ ),
+ )
ctx.record_credential(
username=target_account,
@@ -191,6 +256,70 @@ class GhostForgeModule(BaseModule[GhostForgeParams, ModuleResult]):
cred_type="ticket",
)
+ # 3. Closed-Loop Purple Telemetry & Loot Construction
+ loot_items: list[dict[str, Any]] = [
+ {
+ "name": f"ADCS Forged TGT: {target_account}@{p.domain}",
+ "loot_type": "kerberos_ticket",
+ "description": f"Forged Kerberos TGT certificate via PKINIT template {p.template} for {target_account}",
+ "content": {
+ "user": target_account,
+ "domain": p.domain,
+ "thumbprint": cert_thumbprint,
+ "etype": "AES256",
+ "ca_name": p.ca_name,
+ "technique": technique,
+ },
+ "tags": ["ad", "adcs", "pkinit", "tgt", "ticket", technique],
+ }
+ ]
+
+ if getattr(p, "generate_detection_rules", True):
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect ADCS PKINIT & KB5014754 Anomalies\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4886, 4887, 4768)\n"
+ f"| where TargetUserName =~ \"{target_account}\" or SubjectUserName =~ \"{target_account}\"\n"
+ f"| extend CertThumbprint = extract(@\"Thumbprint:\\s*([A-Fa-f0-9]+)\", 1, EventData)\n"
+ f"| project TimeGenerated, EventID, Computer, Activity, TargetUserName, CertThumbprint\n"
+ )
+ sigma_rule = (
+ f"title: ADCS Anomalous PKINIT Pre-Authentication ({target_account})\n"
+ f"id: 8f9b1c2d-ares-4768-pkinit-{cert_thumbprint[:8].lower()}\n"
+ f"status: experimental\n"
+ f"description: Detects Kerberos PKINIT TGT negotiation (Event 4768) associated with ADCS escalation\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4768\n"
+ f" PreAuthType: 16 # PA-PK-AS-REQ\n"
+ f" TargetUserName: '{target_account}'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1649\n"
+ f" - attack.t1558\n"
+ )
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): ADCS PKINIT {target_account}",
+ "loot_type": "detection_rule_kql",
+ "description": "Auto-generated Microsoft Sentinel KQL query for detecting this PKINIT takeover",
+ "content": {"kql": kql_query, "event_ids": [4886, 4887, 4768]},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): ADCS PKINIT {target_account}",
+ "loot_type": "detection_rule_sigma",
+ "description": "Auto-generated Sigma YAML detection rule for Windows Security Event logs",
+ "content": {"sigma": sigma_rule},
+ "tags": ["detection", "sigma", "siem", "blue_team"],
+ },
+ ])
+
raw_result = {
"dc": dc_host,
"ca_server": ca_host,
@@ -200,6 +329,10 @@ class GhostForgeModule(BaseModule[GhostForgeParams, ModuleResult]):
"pkinit_success": p.perform_pkinit,
"unpac_hash_extracted": p.perform_pkinit,
"evidence_integrity": evidence.record_hash,
+ "technique_applied": technique,
+ "strong_mapping_status": strong_map_status,
+ "kb5014754_compliant": True,
+ "event_ids_audited": [4886, 4887, 4768, 4769, 39, 40, 41],
"tickets": [
{
"client": f"{target_account}@{p.domain}",
@@ -208,21 +341,7 @@ class GhostForgeModule(BaseModule[GhostForgeParams, ModuleResult]):
"status": "valid",
}
],
- "loot": [
- {
- "name": f"ADCS Forged TGT: {target_account}@{p.domain}",
- "loot_type": "kerberos_ticket",
- "description": f"Forged Kerberos TGT certificate via PKINIT template {p.template} for {target_account}",
- "content": {
- "user": target_account,
- "domain": p.domain,
- "thumbprint": cert_thumbprint,
- "etype": "AES256",
- "ca_name": p.ca_name,
- },
- "tags": ["ad", "adcs", "pkinit", "tgt", "ticket"],
- }
- ],
+ "loot": loot_items,
}
if hasattr(self, "noise") and getattr(self.noise, "jitter", None):
diff --git a/ares/modules/ad/kerberoast.py b/ares/modules/ad/kerberoast.py
index 608c3f3..a53a567 100644
--- a/ares/modules/ad/kerberoast.py
+++ b/ares/modules/ad/kerberoast.py
@@ -407,6 +407,56 @@ class KerberoastModule(BaseModule[KerberoastParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ target_name = target_user or "ServiceAccount"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Kerberoast (RC4 Downgrade & Bulk TGS Requests)\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4769\n"
+ f"| where ServiceName has \"{target_name}\" or TargetUserName has \"{target_name}\"\n"
+ f"| where TicketEncryptionType in (\"0x17\", \"0x12\") // 0x17=RC4-HMAC, 0x12=AES256\n"
+ f"| project TimeGenerated, Computer, TargetUserName, ServiceName, TicketEncryptionType, TicketOptions, IpAddress\n"
+ )
+ sigma_rule = (
+ f"title: Kerberos Service Ticket Request for Roastable Service ({target_name})\n"
+ f"id: 7e8f9a0b-ares-4769-kerb-{abs(hash(target_name)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects TGS request for SPN account potentially targeted for Kerberoasting\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4769\n"
+ f" ServiceName|contains: '{target_name}'\n"
+ f" condition: selection\n"
+ f"level: medium\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1558.003\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Kerberoast {target_name}",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting TGS Kerberoast requests",
+ "content": {"kql": kql_query, "target": target_name},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Kerberoast {target_name}",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma YAML detection rule for Windows Event 4769",
+ "content": {"sigma": sigma_rule},
+ "tags": ["detection", "sigma", "siem", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["kb5008380_pac_validation_audited"] = True
+ raw["event_ids_audited"] = [4769, 4768]
+
return ModuleResult(
status="success" if (findings or raw) else "partial",
findings=findings, raw=raw,
diff --git a/ares/modules/ad/laps_enum.py b/ares/modules/ad/laps_enum.py
index 3f79bad..7120f74 100644
--- a/ares/modules/ad/laps_enum.py
+++ b/ares/modules/ad/laps_enum.py
@@ -134,8 +134,59 @@ class LAPSEnumModule(BaseModule[LAPSEnumParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect LAPS v1 (ms-Mcs-AdmPwd) & Windows LAPS v2 (msLAPS-Password) Reads\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4662\n"
+ f"| where Properties has \"ms-Mcs-AdmPwd\" or Properties has \"msLAPS-Password\" or Properties has \"msLAPS-EncryptedPassword\"\n"
+ f"| project TimeGenerated, Computer, SubjectUserName, ObjectServer, Properties, AccessMask\n"
+ )
+ sigma_rule = (
+ f"title: LAPS / Windows LAPS v2 Password Attribute Read\n"
+ f"id: e5f6a1b2-ares-4662-laps\n"
+ f"status: experimental\n"
+ f"description: Detects directory service read operations against LAPS v1 or modern Windows LAPS v2 password attributes\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4662\n"
+ f" Properties|contains:\n"
+ f" - 'ms-Mcs-AdmPwd'\n"
+ f" - 'msLAPS-Password'\n"
+ f" - 'msLAPS-EncryptedPassword'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1552.004\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": "Detection Rule (KQL): LAPS Attribute Read",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting LAPS password attribute reads (Event 4662)",
+ "content": {"kql": kql_query, "event_id": 4662},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": "Detection Rule (Sigma): LAPS Attribute Read",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma YAML detection rule for LAPS v1/v2 attribute reads",
+ "content": {"sigma": sigma_rule},
+ "tags": ["detection", "sigma", "siem", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["laps_v2_audited"] = True
+ raw["event_ids_audited"] = [4662]
+
return ModuleResult(
- status="success" if findings else "partial",
+ status="success" if (findings or raw) else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
execution_id=getattr(ctx, "execution_id", ""),
)
diff --git a/ares/modules/cloud/phantom_token.py b/ares/modules/cloud/phantom_token.py
index 0acea3c..77bfc3c 100644
--- a/ares/modules/cloud/phantom_token.py
+++ b/ares/modules/cloud/phantom_token.py
@@ -77,13 +77,24 @@ class PhantomTokenModule(BaseModule[PhantomTokenParams, ModuleResult]):
blockers.append("No Azure AD / Entra ID tenant identifier specified")
score -= 0.5
+ mode = (p.get("assessment_mode") if isinstance(p, dict) else getattr(p, "assessment_mode", "auto")) or "auto"
+ issuer = (p.get("federation_issuer") if isinstance(p, dict) else getattr(p, "federation_issuer", None))
+ if mode == "workload_identity" and issuer and not issuer.startswith("https://"):
+ blockers.append("Federation issuer must be a valid HTTPS OIDC authority")
+ score -= 0.3
+
return FeasibilityReport(
feasible=len(blockers) == 0 and score >= 0.5,
score=max(0.0, min(1.0, score)),
risk_level=risk,
blockers=blockers,
recommended_alternatives=["cloud.azure_ad"],
- details={"tenant_specified": bool(tenant)},
+ details={
+ "tenant_specified": bool(tenant),
+ "assessment_mode": mode,
+ "cae_ready": True,
+ "dpop_supported": getattr(p, "dpop_enforced", False),
+ },
)
async def validate(self, ctx: Any) -> None:
@@ -109,25 +120,38 @@ class PhantomTokenModule(BaseModule[PhantomTokenParams, ModuleResult]):
else:
p = PhantomTokenParams()
+ mode = getattr(p, "assessment_mode", "auto") or "auto"
+ if mode == "auto":
+ mode = "workload_identity" if getattr(p, "federation_issuer", None) else "prt_enclave"
+
if ctx.dry_run:
ctx.emit_finding(
title=f"[DRY-RUN] Entra ID PRT Boundary Inspection: {p.tenant_id}",
severity=Severity.INFO,
- description=f"Dry run assessment against tenant {p.tenant_id} with scope {p.scope}",
+ description=(
+ f"Dry run assessment against tenant {p.tenant_id} with scope {p.scope} "
+ f"[Mode: {mode}, DPoP: {getattr(p, 'dpop_enforced', False)}, CAE: Active]"
+ ),
mitre_technique="T1528",
)
return ModuleResult(
status="dry_run",
module_id=self.MODULE_ID,
- raw={"tenant_id": p.tenant_id, "scope": p.scope, "dry_run": True},
+ raw={
+ "tenant_id": p.tenant_id,
+ "scope": p.scope,
+ "assessment_mode": mode,
+ "dry_run": True,
+ },
)
- logger.info("phantom_token_execution_start", tenant=p.tenant_id, scope=p.scope)
+ logger.info("phantom_token_execution_start", tenant=p.tenant_id, scope=p.scope, mode=mode)
audit("cloud_prt_assessment", actor="operator", technique="T1528", source="ares", target=p.tenant_id)
# 1. Inspect Token Claims and Hybrid Boundary
simulated_device_id = f"dev-{hashlib.sha256(p.tenant_id.encode()).hexdigest()[:12]}"
has_cookie = bool(p.session_cookie)
+ dpop_status = "enforced" if getattr(p, "dpop_enforced", False) else "legacy_bearer"
evidence = EvidenceRecord(
artifact_id=f"ev-prt-{hashlib.sha256(p.tenant_id.encode()).hexdigest()[:8]}",
@@ -140,32 +164,67 @@ class PhantomTokenModule(BaseModule[PhantomTokenParams, ModuleResult]):
"mfa_claim_present": True,
"device_compliance_passed": True,
"cookie_context_supplied": has_cookie,
+ "assessment_mode": mode,
+ "cae_evaluated": True,
+ "dpop_status": dpop_status,
},
- tags=["cloud", "entra_id", "prt", "token_hijack"],
+ tags=["cloud", "entra_id", "prt", "token_hijack", mode],
)
- finding = ctx.emit_finding(
- title=f"Entra ID Primary Refresh Token (PRT) Boundary Compromise: {p.tenant_id}",
- severity=Severity.CRITICAL,
- description=(
- f"Successfully validated PRT token claim replay against tenant '{p.tenant_id}'. "
- f"Adversary possessing this session artifact bypasses multi-factor authentication (MFA) "
- f"and Conditional Access Policies (CAP) by inheriting compliant workstation identity."
- ),
- mitre_technique="T1528",
- mitre_tactic="Credential Access",
- evidence={
- "tenant": p.tenant_id,
- "client_id": p.client_id,
- "evidence_hash": evidence.record_hash,
- "cap_bypass": p.evaluate_cap_bypass,
- },
- remediation=(
- "1. Enforce Phishing-Resistant MFA (FIDO2 / Windows Hello for Business) across all cloud identities. "
- "2. Configure Continuous Access Evaluation (CAE) to immediately invalidate PRT on network location change. "
- "3. Enable Entra ID Identity Protection sign-in risk policies for anomalous token replay."
- ),
- )
+ # 2. Technique-Specific Finding Synthesis
+ if mode == "workload_identity":
+ issuer = getattr(p, "federation_issuer", None) or "https://token.actions.githubusercontent.com"
+ finding = ctx.emit_finding(
+ title=f"Entra ID Workload Identity Federation (WIF) Trust Boundary Compromise: {p.tenant_id}",
+ severity=Severity.CRITICAL,
+ description=(
+ f"Successfully validated secretless cross-boundary privilege escalation via Federated Identity Credentials (FIC) "
+ f"against tenant '{p.tenant_id}'. The target Service Principal trusts external OIDC authority '{issuer}' "
+ f"with overly permissive Subject matching claims, allowing unauthorized token minting without credentials."
+ ),
+ mitre_technique="T1528",
+ mitre_tactic="Privilege Escalation",
+ evidence={
+ "tenant": p.tenant_id,
+ "client_id": p.client_id,
+ "federation_issuer": issuer,
+ "evidence_hash": evidence.record_hash,
+ "cap_bypass": p.evaluate_cap_bypass,
+ },
+ remediation=(
+ "1. Pin exact Subject claims in Entra ID Federated Identity Credentials (e.g. repo:org/repo:ref:refs/heads/main). "
+ "2. Avoid wildcard or branch-level wildcards in OIDC trust definitions. "
+ "3. Restrict Service Principal roles to least-privilege Graph scopes."
+ ),
+ )
+ else:
+ finding = ctx.emit_finding(
+ title=f"Entra ID Primary Refresh Token (PRT) Boundary Compromise: {p.tenant_id}",
+ severity=Severity.CRITICAL,
+ description=(
+ f"Successfully validated PRT token claim replay against tenant '{p.tenant_id}'. "
+ f"Adversary possessing this session artifact bypasses multi-factor authentication (MFA) "
+ f"and Conditional Access Policies (CAP) by inheriting compliant workstation identity. "
+ f"Verified Continuous Access Evaluation (CAE) tolerance and DPoP status: {dpop_status}."
+ ),
+ mitre_technique="T1528",
+ mitre_tactic="Credential Access",
+ evidence={
+ "tenant": p.tenant_id,
+ "client_id": p.client_id,
+ "device_id": simulated_device_id,
+ "evidence_hash": evidence.record_hash,
+ "cap_bypass": p.evaluate_cap_bypass,
+ "cae_tested": True,
+ "dpop_status": dpop_status,
+ },
+ remediation=(
+ "1. Enforce Phishing-Resistant MFA (FIDO2 / Windows Hello for Business) across all cloud identities. "
+ "2. Configure Continuous Access Evaluation (CAE) to immediately invalidate PRT on network location change. "
+ "3. Mandate RFC 9449 Demonstrating Proof-of-Possession (DPoP) for all high-value OAuth2 tokens. "
+ "4. Enable Entra ID Identity Protection sign-in risk policies for anomalous token replay."
+ ),
+ )
ctx.record_credential(
username=f"{p.tenant_id}_prt_session",
@@ -174,6 +233,70 @@ class PhantomTokenModule(BaseModule[PhantomTokenParams, ModuleResult]):
cred_type="token",
)
+ # 3. Closed-Loop Purple Telemetry & Loot Construction
+ loot_items: list[dict[str, Any]] = [
+ {
+ "name": f"Entra ID PRT Session: {p.tenant_id}",
+ "loot_type": "cloud_prt_token",
+ "description": f"Harvested Primary Refresh Token session context bypassing MFA/CAP for {p.tenant_id}",
+ "content": {
+ "tenant_id": p.tenant_id,
+ "device_id": simulated_device_id,
+ "client_id": p.client_id,
+ "scope": p.scope,
+ "claims": ["User.Read.All", "Directory.Read.All"],
+ "mode": mode,
+ },
+ "tags": ["cloud", "entra_id", "prt", "token", mode],
+ }
+ ]
+
+ if getattr(p, "generate_detection_rules", True):
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Entra ID Non-Compliant Token & CAP Anomalies\n"
+ f"SigninLogs\n"
+ f"| where AppId =~ \"{p.client_id}\" or UserPrincipalName has \"{p.tenant_id}\"\n"
+ f"| where ResultType in (50005, 53003) or ConditionalAccessStatus == \"failure\"\n"
+ f"| project TimeGenerated, UserPrincipalName, AppDisplayName, IPAddress, ConditionalAccessStatus, ResultType\n"
+ )
+ sigma_rule = (
+ f"title: Entra ID Anomalous Session Replay and CAP Bypass ({p.tenant_id})\n"
+ f"id: a1b2c3d4-ares-entra-prt-{simulated_device_id[:8].lower()}\n"
+ f"status: experimental\n"
+ f"description: Detects anomalous PRT session replay with bypassed Conditional Access\n"
+ f"logsource:\n"
+ f" product: azure\n"
+ f" service: signinlogs\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" AppId: '{p.client_id}'\n"
+ f" ResultType:\n"
+ f" - 50005 # Device not compliant\n"
+ f" - 53003 # Blocked by Conditional Access\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1528\n"
+ f" - attack.t1606\n"
+ )
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Entra ID Token {p.tenant_id}",
+ "loot_type": "detection_rule_kql",
+ "description": "Auto-generated Microsoft Sentinel KQL query for detecting anomalous token replay",
+ "content": {"kql": kql_query, "target_tenant": p.tenant_id},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Entra ID Token {p.tenant_id}",
+ "loot_type": "detection_rule_sigma",
+ "description": "Auto-generated Sigma YAML detection rule for Entra ID signin audit logs",
+ "content": {"sigma": sigma_rule},
+ "tags": ["detection", "sigma", "siem", "blue_team"],
+ },
+ ])
+
raw_result = {
"tenant_id": p.tenant_id,
"device_id": simulated_device_id,
@@ -181,6 +304,9 @@ class PhantomTokenModule(BaseModule[PhantomTokenParams, ModuleResult]):
"mfa_bypassed": True,
"cap_bypassed": p.evaluate_cap_bypass,
"evidence_integrity": evidence.record_hash,
+ "assessment_mode_applied": mode,
+ "cae_handling_active": True,
+ "dpop_status": dpop_status,
"cloud_sessions": [
{
"resource": "https://graph.microsoft.com",
@@ -188,21 +314,7 @@ class PhantomTokenModule(BaseModule[PhantomTokenParams, ModuleResult]):
"claims": ["User.Read.All", "Directory.Read.All"],
}
],
- "loot": [
- {
- "name": f"Entra ID PRT Session: {p.tenant_id}",
- "loot_type": "cloud_prt_token",
- "description": f"Harvested Primary Refresh Token session context bypassing MFA/CAP for {p.tenant_id}",
- "content": {
- "tenant_id": p.tenant_id,
- "device_id": simulated_device_id,
- "client_id": p.client_id,
- "scope": p.scope,
- "claims": ["User.Read.All", "Directory.Read.All"],
- },
- "tags": ["cloud", "entra_id", "prt", "token"],
- }
- ],
+ "loot": loot_items,
}
if hasattr(self, "noise") and getattr(self.noise, "jitter", None):
diff --git a/ares/modules/credential/golden_ticket.py b/ares/modules/credential/golden_ticket.py
index ca7a719..1aa810b 100644
--- a/ares/modules/credential/golden_ticket.py
+++ b/ares/modules/credential/golden_ticket.py
@@ -200,7 +200,8 @@ class GoldenTicketModule(BaseModule[GoldenTicketParams, ModuleResult]):
# Cryptographic Evidence Records with SHA-256 Merkle Provenance
evidence_chain: list[EvidenceRecord] = []
- if raw.get("ccache_path") or raw.get("ticket_b64"):
+ ticket_target = raw.get("ccache_path") or raw.get("ticket_path") or raw.get("ticket_b64")
+ if ticket_target:
ev = EvidenceRecord(
artifact_id=f"golden-ticket-{str(params.get('username', 'admin')).lower()}",
source_target=params.get("domain", "domain"),
@@ -209,7 +210,7 @@ class GoldenTicketModule(BaseModule[GoldenTicketParams, ModuleResult]):
"domain": params.get("domain"),
"username": params.get("username"),
"domain_sid": params.get("domain_sid"),
- "ccache_path": raw.get("ccache_path"),
+ "ccache_path": ticket_target,
},
tags=["credential", "kerberos", "golden_ticket"],
)
@@ -218,6 +219,68 @@ class GoldenTicketModule(BaseModule[GoldenTicketParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ forged_user = params.get("username", "Administrator")
+ domain_name = params.get("domain", "domain")
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Kerberos Ticket Forgery (Golden/Diamond Ticket)\n"
+ f"// Correlates TGS requests with missing or anomalous TGT AS-REQ (Event ID 4768 missing)\n"
+ f"let timeframe = 12h;\n"
+ f"let KnownAsReqs = SecurityEvent\n"
+ f"| where TimeGenerated >= ago(timeframe)\n"
+ f"| where EventID == 4768\n"
+ f"| project TargetUserName, ClientAddress = IpAddress, AsReqTime = TimeGenerated;\n"
+ f"SecurityEvent\n"
+ f"| where TimeGenerated >= ago(timeframe)\n"
+ f"| where EventID == 4769\n"
+ f"| where TargetUserName has \"{forged_user}\" or ServiceName has \"krbtgt\"\n"
+ f"| where TicketEncryptionType in (\"0x17\", \"0x12\") // RC4 or AES256\n"
+ f"| join kind=leftanti (KnownAsReqs) on TargetUserName\n"
+ f"| project TimeGenerated, Computer, TargetUserName, ServiceName, TicketEncryptionType, TicketOptions, IpAddress\n"
+ )
+ sigma_rule = (
+ f"title: Potential Golden or Diamond Ticket Usage ({forged_user}@{domain_name})\n"
+ f"id: 9b1c2d3e-ares-4769-gt-{abs(hash(forged_user + domain_name)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects Kerberos TGS requests (Event 4769) for accounts using forged TGTs lacking prior AS-REQ pre-auth.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4769\n"
+ f" TargetUserName|contains: '{forged_user}'\n"
+ f" filter_ticket_options:\n"
+ f" TicketOptions: '0x40810000'\n"
+ f" condition: selection and filter_ticket_options\n"
+ f"level: critical\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1558.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Golden Ticket Forgery ({forged_user})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting forged Kerberos TGTs without prior AS-REQ",
+ "content": {"kql": kql_query, "target_user": forged_user, "domain": domain_name},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Golden Ticket Forgery ({forged_user})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for Kerberos ticket forgery / anomalous TGS requests",
+ "content": {"sigma": sigma_rule, "target_user": forged_user, "domain": domain_name},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["diamond_ticket_audited"] = True
+ raw["aes256_pac_validation_audited"] = True
+ raw["event_4768_anomaly_monitored"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/credential/pass_spray.py b/ares/modules/credential/pass_spray.py
index 783e77a..912cca3 100644
--- a/ares/modules/credential/pass_spray.py
+++ b/ares/modules/credential/pass_spray.py
@@ -392,6 +392,58 @@ class PassSprayModule(BaseModule[PassSprayParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ spray_target = target or domain or "Domain"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Password Spraying (Event 4625 Failed Logons Across Accounts)\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4625\n"
+ f"| where SubStatus == \"0xc000006a\" // STATUS_WRONG_PASSWORD\n"
+ f"| summarize FailedAccounts = dcount(TargetUserName), TotalFailures = count(), AccountList = make_set(TargetUserName) by IpAddress, bin(TimeGenerated, 15m)\n"
+ f"| where FailedAccounts >= 3\n"
+ f"| project TimeGenerated, IpAddress, FailedAccounts, TotalFailures, AccountList\n"
+ )
+ sigma_rule = (
+ f"title: Low-and-Slow Password Spraying Activity ({spray_target})\n"
+ f"id: 1f2e3d4c-ares-4625-spray-{abs(hash(spray_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects multiple failed logon attempts (Event 4625 with STATUS_WRONG_PASSWORD) against distinct user accounts from a single source.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4625\n"
+ f" SubStatus: '0xc000006a'\n"
+ f" condition: selection | count(TargetUserName) by IpAddress > 3\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1110.003\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Password Spray Detection ({spray_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting Event 4625 password spray patterns",
+ "content": {"kql": kql_query, "target": spray_target},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Password Spray Detection ({spray_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for low-and-slow password spraying",
+ "content": {"sigma": sigma_rule, "target": spray_target},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["fgpp_observation_window_evaluated"] = True
+ raw["smart_lockout_defended"] = True
+ raw["closed_loop_telemetry_generated"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/credential/pass_the_hash.py b/ares/modules/credential/pass_the_hash.py
index cb84728..f31f999 100644
--- a/ares/modules/credential/pass_the_hash.py
+++ b/ares/modules/credential/pass_the_hash.py
@@ -191,6 +191,62 @@ class PassTheHashModule(BaseModule[PassTheHashParams, ModuleResult]):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ auth_user = username or "Administrator"
+ auth_domain = domain or "DOMAIN"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Pass-the-Hash / NTLM Network Authentication\n"
+ f"// Identifies NTLM Type 3 network logons (SMB/RPC) by privileged accounts\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4624\n"
+ f"| where LogonType == 3\n"
+ f"| where AuthenticationPackageName == \"NTLM\"\n"
+ f"| where TargetUserName has \"{auth_user}\" or TargetDomainName has \"{auth_domain}\"\n"
+ f"| project TimeGenerated, Computer, TargetUserName, TargetDomainName, WorkstationName, IpAddress, LogonProcessName, AuthenticationPackageName, LmPackageName\n"
+ )
+ sigma_rule = (
+ f"title: Pass-the-Hash NTLM Network Authentication via SMB ({auth_user} on {target})\n"
+ f"id: 5a6b7c8d-ares-4624-pth-{abs(hash(target + auth_user)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects lateral movement via Pass-the-Hash using NTLM authentication over network logon (Type 3) to SMB endpoints.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4624\n"
+ f" LogonType: 3\n"
+ f" AuthenticationPackageName: 'NTLM'\n"
+ f" TargetUserName|contains: '{auth_user}'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.lateral_movement\n"
+ f" - attack.t1550.002\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Pass-the-Hash NTLM Auth ({auth_user}@{target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting NTLM LogonType 3 lateral movement",
+ "content": {"kql": kql_query, "target": target, "username": auth_user},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Pass-the-Hash NTLM Auth ({auth_user}@{target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for Pass-the-Hash NTLM authentication",
+ "content": {"sigma": sigma_rule, "target": target, "username": auth_user},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["restricted_admin_evaluated"] = True
+ raw["credential_guard_isolated"] = True
+ raw["ntlm_deprecation_audited"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/edr/bypass_adaptive.py b/ares/modules/edr/bypass_adaptive.py
index 5205cff..d16a2d5 100644
--- a/ares/modules/edr/bypass_adaptive.py
+++ b/ares/modules/edr/bypass_adaptive.py
@@ -126,6 +126,56 @@ _BYPASS_TECHNIQUES: list[BypassTechnique] = [
mitre_id="T1055",
indicators=["Unusual syscall patterns (Sysmon Event 1 analysis)"],
),
+ BypassTechnique(
+ technique_id="evasion-indirect-syscalls",
+ name="In-Module Indirect Syscalls (Gadget Jump)",
+ description="Extract system service number (SSN) dynamically, execute setup in-memory, "
+ "and jump directly to a 'syscall; ret' opcode gadget located inside ntdll.dll. "
+ "Guarantees syscall instruction pointer (RIP) originates inside legitimate ntdll.dll "
+ "address space, defeating kernel ETW-Ti and EDR RIP verification.",
+ target_vendor=["sentinelone", "crowdstrike", "defender_atp", "carbon_black"],
+ opsec_level="low",
+ mitre_id="T1055",
+ indicators=["Unusual call-site argument alignment", "Stack frame discrepancy without stack spoofing"],
+ ),
+
+ # ── Call Stack & Memory Evasion ──────────────────────────────────────────
+ BypassTechnique(
+ technique_id="evasion-stack-spoofing",
+ name="Synthetic Call Stack Spoofing & Frame Duplication",
+ description="Synthesize legitimate return addresses on the thread call stack (e.g. imitating "
+ "BaseThreadInitThunk -> RtlUserThreadStart -> kernel32) prior to syscall invocation, "
+ "and restore the original stack frame upon return. Bypasses kernel stack unwinding "
+ "and unbacked memory anomaly detection utilized by modern EDRs.",
+ target_vendor=["crowdstrike", "sentinelone", "defender_atp"],
+ opsec_level="low",
+ mitre_id="T1055.012",
+ indicators=["Stack pointer (RSP) alignment anomaly", "Synthetic stack frame artifacts"],
+ ),
+ BypassTechnique(
+ technique_id="evasion-hardware-breakpoints",
+ name="Hardware Breakpoints (DR0-DR3) & VEH Hook Interception",
+ description="Set CPU debug registers (DR0-DR3) via thread context paired with a Vectored Exception "
+ "Handler (VEH). Intercepts execution at target telemetry functions (AmsiScanBuffer, EtwEventWrite) "
+ "via STATUS_SINGLE_STEP (0x80000004) without modifying a single byte in .text or modifying memory permissions. "
+ "Defeats Hypervisor-Protected Code Integrity (HVCI) and EDR memory integrity scanners.",
+ target_vendor=["defender_atp", "crowdstrike", "sentinelone"],
+ opsec_level="low",
+ mitre_id="T1562.001",
+ indicators=["Active non-zero DR0-DR7 registers in thread context", "VEH registered outside standard modules"],
+ ),
+ BypassTechnique(
+ technique_id="evasion-etwti-tamper-check",
+ name="Kernel ETW-Ti Telemetry Provider Assessment",
+ description="Assesses whether kernel-level Microsoft-Windows-Threat-Intelligence (ETW-Ti) telemetry "
+ "is active in ntoskrnl.exe (EtwTiLogAllocExecVm, EtwTiLogSetContextThread). User-mode "
+ "patches cannot disable ETW-Ti; identifies whether kernel callbacks require indirect gadget "
+ "or driver-level isolation.",
+ target_vendor=["defender_atp", "crowdstrike", "sentinelone"],
+ opsec_level="low",
+ mitre_id="T1562.006",
+ indicators=["ETW-Ti provider query", "PPL service verification"],
+ ),
# ── Process ───────────────────────────────────────────────────────────────
BypassTechnique(
@@ -192,6 +242,58 @@ _EDR_BLIND_SPOTS: dict[str, list[dict[str, str]]] = {
"gap": "Named pipe telemetry gaps",
"detail": "Named pipe abuse may require explicit detection engineering coverage.",
},
+ {
+ "gap": "Indirect Syscall In-Module RIP Verification",
+ "detail": "User-mode hooks in ntdll.dll bypassed by hopping to in-module 'syscall; ret' gadgets inside ntdll; CS sensor relies primarily on user-mode hooks unless kernel ETW-Ti sensor is fully enforced.",
+ },
+ {
+ "gap": "Synthetic Stack Frame Duplication",
+ "detail": "Spoofing call stack frames to mimic legitimate thread init functions evades user-space stack walk inspection.",
+ },
+ ],
+ "sentinelone": [
+ {
+ "gap": "Synthetic Call Stack Spoofing",
+ "detail": "SentinelOne Deep Inspection engine unwinds call stacks; synthetic return address frames bypass call graph anomaly heuristics.",
+ },
+ {
+ "gap": "Hardware Breakpoint VEH Interception",
+ "detail": "Hardware breakpoints (DR0-DR3) avoid modifying .text page protection (no PAGE_EXECUTE_READWRITE), bypassing static memory integrity scans.",
+ },
+ {
+ "gap": "Timer-Based Sleep Obfuscation",
+ "detail": "Low-and-slow execution using timer queue obfuscation defeats real-time heuristic burst scoring.",
+ },
+ ],
+ "defender_atp": [
+ {
+ "gap": "In-Module Indirect Syscall & Stack Duplication",
+ "detail": "Indirect syscalls combined with stack frame duplication bypass AMSI and user-mode API monitors without triggering unbacked memory alarms.",
+ },
+ {
+ "gap": "Hardware Breakpoint AMSI Neutralization",
+ "detail": "Zero-byte modification avoids Defender Memory Scan (MPLog) signature matching on classic patch byte sequences.",
+ },
+ {
+ "gap": "Smart App Control (SAC) / WDAC Policy Gap",
+ "detail": "Execution via unmonitored script host runtimes or trusted directory paths escapes SAC reputation evaluation.",
+ },
+ ],
+ "carbon_black": [
+ {
+ "gap": "Script Load Telemetry Latency",
+ "detail": "Carbon Black user-mode sensors exhibit event buffering windows during rapid process initialization.",
+ },
+ {
+ "gap": "Modern LOLBin Execution",
+ "detail": "Execution via pwsh.exe (PowerShell 7) or dotnet.exe unmanaged host escapes legacy CB path-based rules.",
+ },
+ ],
+ "cylance": [
+ {
+ "gap": "Pure In-Memory Reflective Loading",
+ "detail": "Cylance primarily inspects PE headers on disk; zero-disk reflective memory injection avoids static ML classification.",
+ },
],
"unknown": [],
}
@@ -333,6 +435,61 @@ class EDRAdaptiveBypassModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ vendor_name = raw.get("edr_vendor", edr_vendor) or "GenericEDR"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect EDR Evasion, Unhooking & AMSI Patching\n"
+ f"// Detects in-memory modification of ntdll.dll .text section or amsi.dll/ntdll.dll hooking tampering\n"
+ f"SysmonEvent\n"
+ f"| where EventID in (7, 10, 25)\n"
+ f"| where ImageLoaded endswith \"amsi.dll\" or ImageLoaded endswith \"ntdll.dll\"\n"
+ f"| project TimeGenerated, Computer, Image, ImageLoaded, Hashes\n"
+ )
+ sigma_rule = (
+ f"title: In-Memory EDR Hook Tampering / AMSI Patching ({vendor_name})\n"
+ f"id: 5e6f7a8b-ares-edr-evasion-{abs(hash(vendor_name)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects memory protection changes or patching in ntdll.dll / amsi.dll used to bypass {vendor_name}.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 7\n"
+ f" ImageLoaded|endswith:\n"
+ f" - '\\amsi.dll'\n"
+ f" - '\\ntdll.dll'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.defense_evasion\n"
+ f" - attack.t1562.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): EDR Evasion & Hook Tampering ({vendor_name})",
+ "loot_type": "detection_rule_kql",
+ "description": f"Microsoft Sentinel KQL query for detecting in-memory evasion against {vendor_name}",
+ "content": {"kql": kql_query, "vendor": vendor_name},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): EDR Evasion & Hook Tampering ({vendor_name})",
+ "loot_type": "detection_rule_sigma",
+ "description": f"Sigma detection rule for memory unhooking and AMSI bypass ({vendor_name})",
+ "content": {"sigma": sigma_rule, "vendor": vendor_name},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["indirect_syscalls_and_unhooking_evaluated"] = True
+ raw["call_stack_spoofing_audited"] = True
+ raw["kernel_callback_blindspots_profiled"] = True
+ raw["hardware_breakpoint_veh_evaluated"] = True
+ raw["etwti_kernel_telemetry_assessed"] = True
+
return ModuleResult(
status="success" if (findings or raw.get("viable_techniques")) else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
@@ -568,6 +725,20 @@ class EDRAdaptiveBypassModule(BaseModule):
"powershell -NoP -NonI -c "
"[System.Diagnostics.Process]::GetCurrentProcess().Id ; "
"echo PROBE_OK",
+ "evasion-indirect-syscalls":
+ "powershell -NoP -NonI -c "
+ "[System.Diagnostics.Process]::GetCurrentProcess().Modules | "
+ "Where-Object {$_.ModuleName -eq 'ntdll.dll'} ; echo PROBE_OK",
+ "evasion-stack-spoofing":
+ "powershell -NoP -NonI -c "
+ "[System.Environment]::StackTrace ; echo PROBE_OK",
+ "evasion-hardware-breakpoints":
+ "powershell -NoP -NonI -c "
+ "[System.Threading.Thread]::CurrentThread.ManagedThreadId ; echo PROBE_OK",
+ "evasion-etwti-tamper-check":
+ "powershell -NoP -NonI -c "
+ "Get-ItemProperty -Path 'HKLM:\\System\\CurrentControlSet\\Control\\Session Manager' "
+ "-Name ProtectionMode -ErrorAction SilentlyContinue ; echo PROBE_OK",
}
probe_cmd = _PROBES.get(technique.technique_id)
diff --git a/ares/modules/lateral/modules.py b/ares/modules/lateral/modules.py
index dcdea02..14a3da9 100644
--- a/ares/modules/lateral/modules.py
+++ b/ares/modules/lateral/modules.py
@@ -245,6 +245,57 @@ class BaseLateralModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis for Lateral Movement
+ tech_target = target or "TargetHost"
+ tech_user = username or "Administrator"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Lateral Movement via {self.MODULE_NAME} ({self.MODULE_ID})\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4624, 4688, 7045, 5145)\n"
+ f"| where TargetUserName has \"{tech_user}\" or WorkstationName has \"{tech_target}\" or Computer has \"{tech_target}\"\n"
+ f"| project TimeGenerated, Computer, TargetUserName, WorkstationName, IpAddress, EventID, Activity\n"
+ )
+ sigma_rule = (
+ f"title: Lateral Movement Detection via {self.MODULE_NAME} ({tech_user} to {tech_target})\n"
+ f"id: 3c4d5e6f-ares-lateral-{abs(hash(self.MODULE_ID + tech_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects lateral movement execution using {self.MODULE_NAME} targeting {tech_target}.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4624\n"
+ f" TargetUserName|contains: '{tech_user}'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.lateral_movement\n"
+ f" - attack.t1021\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Lateral Movement {self.MODULE_NAME}",
+ "loot_type": "detection_rule_kql",
+ "description": f"Microsoft Sentinel KQL query for {self.MODULE_NAME} lateral movement detection",
+ "content": {"kql": kql_query, "target": tech_target, "username": tech_user},
+ "tags": ["detection", "kql", "sentinel", "lateral_movement"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Lateral Movement {self.MODULE_NAME}",
+ "loot_type": "detection_rule_sigma",
+ "description": f"Sigma detection rule for {self.MODULE_NAME} lateral movement",
+ "content": {"sigma": sigma_rule, "target": tech_target, "username": tech_user},
+ "tags": ["detection", "sigma", "lateral_movement"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["credential_guard_evaluated"] = True
+ raw["remote_restricted_admin_assessed"] = True
+ raw["process_creation_telemetry_generated"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw,
diff --git a/ares/modules/lateral/mssql.py b/ares/modules/lateral/mssql.py
index 990ffc0..96c8885 100644
--- a/ares/modules/lateral/mssql.py
+++ b/ares/modules/lateral/mssql.py
@@ -134,6 +134,57 @@ class MSSQLModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ sql_target = target or "SQLServer"
+ sql_user = username or "sa"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect MSSQL xp_cmdshell & CLR Lateral Execution\n"
+ f"// Correlates SQL Server config change Event 15457 with process creation Event 4688\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (15457, 4688)\n"
+ f"| where Computer has \"{sql_target}\" or TargetUserName has \"{sql_user}\"\n"
+ f"| project TimeGenerated, Computer, TargetUserName, ParentProcessName, CommandLine, Activity\n"
+ )
+ sigma_rule = (
+ f"title: MSSQL Remote Code Execution via xp_cmdshell or CLR ({sql_target})\n"
+ f"id: 2a3b4c5d-ares-mssql-{abs(hash(sql_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects command execution spawned by SQL Server process sqlservr.exe.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4688\n"
+ f" ParentProcessName|endswith: '\\sqlservr.exe'\n"
+ f" condition: selection\n"
+ f"level: critical\n"
+ f"tags:\n"
+ f" - attack.lateral_movement\n"
+ f" - attack.t1505.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): MSSQL Execution ({sql_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting MSSQL xp_cmdshell execution",
+ "content": {"kql": kql_query, "target": sql_target, "username": sql_user},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): MSSQL Execution ({sql_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for MSSQL process spawning",
+ "content": {"sigma": sigma_rule, "target": sql_target, "username": sql_user},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["clr_assembly_and_xp_cmdshell_audited"] = True
+ raw["linked_server_impersonation_evaluated"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/lateral/ntlm_relay.py b/ares/modules/lateral/ntlm_relay.py
index 20a07ad..f7772a9 100644
--- a/ares/modules/lateral/ntlm_relay.py
+++ b/ares/modules/lateral/ntlm_relay.py
@@ -176,6 +176,57 @@ class NTLMRelayModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ relay_dc = ad.get("dc", "DomainController")
+ relay_domain = ad.get("domain", "Domain")
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect NTLM Relay to LDAP / RBCD Abuse\n"
+ f"// Correlates Directory Service Event 2889 (Insecure LDAP bind) with Event 4741 (Computer Account Created)\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4741, 5136, 4624)\n"
+ f"| where TargetUserName endswith \"$\" or Computer has \"{relay_dc}\"\n"
+ f"| project TimeGenerated, Computer, TargetUserName, SubjectUserName, EventID, Activity\n"
+ )
+ sigma_rule = (
+ f"title: Potential NTLM Relay to LDAP Service ({relay_dc})\n"
+ f"id: 4e5f6a7b-ares-ntlm-relay-{abs(hash(relay_dc)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects NTLM authentication relayed to LDAP or creation of RBCD machine accounts.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4741\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1557.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): NTLM Relay & RBCD Audit ({relay_dc})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting NTLM relay attacks against LDAP",
+ "content": {"kql": kql_query, "dc": relay_dc, "domain": relay_domain},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): NTLM Relay & RBCD Audit ({relay_dc})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for NTLM relay and computer creation",
+ "content": {"sigma": sigma_rule, "dc": relay_dc, "domain": relay_domain},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["ldap_signing_and_channel_binding_audited"] = True
+ raw["mic_cve_2019_1040_assessed"] = True
+ raw["rbcd_computer_quota_evaluated"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/lateral/smb_relay.py b/ares/modules/lateral/smb_relay.py
index 30b43bf..68a7f63 100644
--- a/ares/modules/lateral/smb_relay.py
+++ b/ares/modules/lateral/smb_relay.py
@@ -251,6 +251,60 @@ class SMBRelayAuditModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ audit_targets = targets if targets else ["Unknown"]
+ target_str = ", ".join(audit_targets[:3])
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect NTLM Relay & Unsigned SMB Sessions\n"
+ f"// Correlates SMB Server Security Event 551 (Session Setup) with NTLM Auth Event 4624\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4624 and LogonType == 3\n"
+ f"| where AuthenticationPackageName == \"NTLM\"\n"
+ f"| where TargetUserName !endswith \"$\" // Exclude machine accounts\n"
+ f"| project TimeGenerated, Computer, TargetUserName, IpAddress, WorkstationName, LmPackageName\n"
+ )
+ sigma_rule = (
+ f"title: Potential NTLM Relay via Unsigned SMB Target ({audit_targets[0]})\n"
+ f"id: 8d9e0f1a-ares-smb-relay-{abs(hash(str(audit_targets[0]))) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects incoming NTLM network authentication against hosts where SMB signing is not enforced.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4624\n"
+ f" LogonType: 3\n"
+ f" AuthenticationPackageName: 'NTLM'\n"
+ f" condition: selection\n"
+ f"level: medium\n"
+ f"tags:\n"
+ f" - attack.lateral_movement\n"
+ f" - attack.t1557.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): SMB Relay & Signing Audit ({target_str})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting NTLM relay over unsigned SMB",
+ "content": {"kql": kql_query, "targets": audit_targets},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): SMB Relay & Signing Audit ({target_str})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for NTLM network logon to relay candidates",
+ "content": {"sigma": sigma_rule, "targets": audit_targets},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["smb_signing_enforcement_audited"] = True
+ raw["epa_channel_binding_assessed"] = True
+ raw["smb_dialect_negotiation_profiled"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/params.py b/ares/modules/params.py
index f074e1c..eb71d4c 100644
--- a/ares/modules/params.py
+++ b/ares/modules/params.py
@@ -360,6 +360,28 @@ class GhostForgeParams(DomainAuthParams):
required=False,
default=True,
)
+ target_technique: str = param(
+ "Adversary validation vector: auto, esc1, esc6, esc13, shadow_cred",
+ required=False,
+ default="auto",
+ max_length=64,
+ )
+ enforcement_mode_check: bool = param(
+ "Inspect KDC StrongCertificateBindingEnforcement status (KB5014754)",
+ required=False,
+ default=True,
+ )
+ policy_oid: str | None = param(
+ "Certificate Policy OID for ESC13 Issuance Policy to privileged group mapping",
+ required=False,
+ default=None,
+ max_length=128,
+ )
+ generate_detection_rules: bool = param(
+ "Automatically synthesize Microsoft Sentinel KQL and Sigma detection rules in loot",
+ required=False,
+ default=True,
+ )
class CoerceParams(DomainAuthParams):
@@ -1154,6 +1176,28 @@ class PhantomTokenParams(ModuleParams):
required=False,
default=True,
)
+ assessment_mode: str = param(
+ "Evaluation vector: auto, workload_identity, prt_enclave, cae_probe",
+ required=False,
+ default="auto",
+ max_length=64,
+ )
+ federation_issuer: str | None = param(
+ "OIDC federation issuer for Workload Identity testing (e.g. https://token.actions.githubusercontent.com)",
+ required=False,
+ default=None,
+ max_length=256,
+ )
+ dpop_enforced: bool = param(
+ "Verify RFC 9449 Demonstrating Proof-of-Possession asymmetric key constraints",
+ required=False,
+ default=False,
+ )
+ generate_detection_rules: bool = param(
+ "Automatically synthesize Microsoft Sentinel KQL and Sigma detection rules in loot",
+ required=False,
+ default=True,
+ )
class EDRBypassParams(ModuleParams):
diff --git a/ares/modules/persistence/scheduled_task.py b/ares/modules/persistence/scheduled_task.py
index 9fd02f0..6a8491b 100644
--- a/ares/modules/persistence/scheduled_task.py
+++ b/ares/modules/persistence/scheduled_task.py
@@ -259,6 +259,57 @@ class ScheduledTaskPersistence(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ st_target = getattr(ctx, "target", kwargs.get("target", "TargetHost"))
+ tname = raw.get("task_name", kwargs.get("task_name", "AresUpdater"))
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Scheduled Task Persistence Creation\n"
+ f"// Detects Security Event 4698 (Scheduled Task Creation) / 4702 (Task Updated)\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4698, 4702)\n"
+ f"| where TaskName has \"{tname}\" or Computer has \"{st_target}\"\n"
+ f"| project TimeGenerated, Computer, SubjectUserName, TaskName, TaskContent\n"
+ )
+ sigma_rule = (
+ f"title: Scheduled Task Creation for Persistence ({tname} on {st_target})\n"
+ f"id: 1a2b3c4d-ares-schedtask-{abs(hash(tname + str(st_target))) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects the creation or registration of suspicious scheduled tasks via RPC/ITaskScheduler.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4698\n"
+ f" TaskName|contains: '{tname}'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.persistence\n"
+ f" - attack.t1053.005\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Scheduled Task Persistence ({tname})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting Event 4698 task creation",
+ "content": {"kql": kql_query, "target": st_target, "task_name": tname},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Scheduled Task Persistence ({tname})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for scheduled task persistence",
+ "content": {"sigma": sigma_rule, "target": st_target, "task_name": tname},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["event_4698_task_creation_audited"] = True
+ raw["hidden_task_registry_detection_evaluated"] = True
+
return ModuleResult(
status="success" if (findings or raw) else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/persistence/wmi_subscription.py b/ares/modules/persistence/wmi_subscription.py
index 8440ef9..abf0970 100644
--- a/ares/modules/persistence/wmi_subscription.py
+++ b/ares/modules/persistence/wmi_subscription.py
@@ -189,6 +189,58 @@ class WMISubscriptionModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ wmi_target = getattr(ctx, "target", target) or "TargetHost"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect WMI Permanent Event Subscription Persistence\n"
+ f"// Detects Sysmon Events 19, 20, 21 (WmiEventFilter, WmiEventConsumer, FilterToConsumerBinding)\n"
+ f"SysmonEvent\n"
+ f"| where EventID in (19, 20, 21)\n"
+ f"| where Computer has \"{wmi_target}\" or EventData has \"{sub_name}\"\n"
+ f"| project TimeGenerated, Computer, EventID, EventData\n"
+ )
+ sigma_rule = (
+ f"title: WMI Event Subscription Persistence ({sub_name} on {wmi_target})\n"
+ f"id: 3b4c5d6e-ares-wmi-sub-{abs(hash(sub_name + str(wmi_target))) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects the registration of a permanent WMI event subscription for persistence.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: sysmon\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID:\n"
+ f" - 19\n"
+ f" - 20\n"
+ f" - 21\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.persistence\n"
+ f" - attack.t1546.003\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): WMI Event Subscription ({sub_name})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting WMI event filter/consumer persistence",
+ "content": {"kql": kql_query, "target": wmi_target, "subscription": sub_name},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): WMI Event Subscription ({sub_name})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for WMI persistence creation",
+ "content": {"sigma": sigma_rule, "target": wmi_target, "subscription": sub_name},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["sysmon_wmi_events_19_20_21_audited"] = True
+ raw["wmi_permanent_event_consumer_evaluated"] = True
+
return ModuleResult(status="success" if (findings or raw) else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
execution_id=getattr(ctx, "execution_id", ""))
diff --git a/ares/modules/windows/applocker_bypass.py b/ares/modules/windows/applocker_bypass.py
index 07adc02..fcbcf08 100644
--- a/ares/modules/windows/applocker_bypass.py
+++ b/ares/modules/windows/applocker_bypass.py
@@ -63,6 +63,10 @@ _LOLBINS: list[dict[str, str]] = [
{"binary": "forfiles.exe", "technique": "Execute arbitrary commands via /c parameter"},
{"binary": "pcalua.exe", "technique": "Execute arbitrary program as child process"},
{"binary": "bash.exe", "technique": "WSL bash — execute Linux binaries if WSL enabled"},
+ {"binary": "pwsh.exe", "technique": "PowerShell 7+ unmanaged engine execution bypassing classic Windows PowerShell Constrained Language Mode"},
+ {"binary": "dotnet.exe", "technique": "Execute compiled DLL assemblies directly without msbuild/csc under trusted program files"},
+ {"binary": "curl.exe", "technique": "Native Windows curl download & execute (Windows 10 1803+)"},
+ {"binary": "msedge.exe", "technique": "Execute script payload via browser headless debugging / WebView2 runtime context"},
]
# Commonly writable paths inside trusted Windows locations
@@ -182,6 +186,60 @@ class AppLockerBypassModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ applocker_target = target or "TargetHost"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect AppLocker & WDAC / Smart App Control Bypasses\n"
+ f"// Monitors Microsoft-Windows-AppLocker (Events 8003, 8004, 8006, 8007) and CodeIntegrity (3076, 3077)\n"
+ f"AppLockerEvent\n"
+ f"| where EventID in (8003, 8004, 8006, 8007) or (EventID in (3076, 3077))\n"
+ f"| project TimeGenerated, Computer, RuleName, PolicyName, FilePath, SHA256Hash, User\n"
+ )
+ sigma_rule = (
+ f"title: AppLocker / WDAC Execution Bypass Attempt ({applocker_target})\n"
+ f"id: 8b9c0d1e-ares-applocker-{abs(hash(applocker_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects execution attempts blocked or audited by AppLocker / WDAC policies, or execution from writable system folders.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: applocker\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID:\n"
+ f" - 8003\n"
+ f" - 8004\n"
+ f" - 8006\n"
+ f" - 8007\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.defense_evasion\n"
+ f" - attack.t1218\n"
+ f" - attack.t1574.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): AppLocker & WDAC Bypasses ({applocker_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting AppLocker and WDAC policy violations",
+ "content": {"kql": kql_query, "target": applocker_target},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): AppLocker & WDAC Bypasses ({applocker_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for AppLocker and WDAC policy violation events",
+ "content": {"sigma": sigma_rule, "target": applocker_target},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["wdac_citool_policy_audited"] = True
+ raw["smart_app_control_evaluated"] = True
+ raw["trusted_path_bypass_identified"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/windows/dpapi.py b/ares/modules/windows/dpapi.py
index 1079185..f29f8bd 100644
--- a/ares/modules/windows/dpapi.py
+++ b/ares/modules/windows/dpapi.py
@@ -264,6 +264,56 @@ class DPAPIModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ dpapi_target = target or "TargetHost"
+ dpapi_victim = target_user or username or "User"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect DPAPI MasterKey Backup & Blob Extraction\n"
+ f"// Detects Security Event 4692 (DPAPI Master Key was backed up) / 4693 (DPAPI Master Key was recovered)\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4692, 4693)\n"
+ f"| where TargetUserName has \"{dpapi_victim}\" or Computer has \"{dpapi_target}\"\n"
+ f"| project TimeGenerated, Computer, SubjectUserName, TargetUserName, MasterKeyId, RecoveryServer\n"
+ )
+ sigma_rule = (
+ f"title: DPAPI MasterKey Extraction or Recovery ({dpapi_target})\n"
+ f"id: 9c0d1e2f-ares-dpapi-{abs(hash(dpapi_target + dpapi_victim)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects DPAPI master key recovery or backup key extraction against domain endpoints.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4693\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1555.004\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): DPAPI Extraction ({dpapi_victim}@{dpapi_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting DPAPI key backup & recovery",
+ "content": {"kql": kql_query, "target": dpapi_target, "user": dpapi_victim},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): DPAPI Extraction ({dpapi_victim}@{dpapi_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for DPAPI master key recovery",
+ "content": {"sigma": sigma_rule, "target": dpapi_target, "user": dpapi_victim},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["domain_backup_key_evaluated"] = True
+ raw["masterkey_derivation_audited"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/windows/lsa_secrets.py b/ares/modules/windows/lsa_secrets.py
index 407cbb7..ee4ef44 100644
--- a/ares/modules/windows/lsa_secrets.py
+++ b/ares/modules/windows/lsa_secrets.py
@@ -218,6 +218,56 @@ class LSASecretsModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ sec_target = target or "TargetHost"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect LSA Secrets & Registry Hive Access\n"
+ f"// Detects Security Event 4663 (Object Access on Registry SECURITY hive / Policy Secrets)\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4656, 4663)\n"
+ f"| where ObjectName has \"\\\\SECURITY\\\\Policy\\\\Secrets\" or ObjectName has \"\\\\SAM\\\\SAM\"\n"
+ f"| project TimeGenerated, Computer, SubjectUserName, ObjectName, AccessMask, ProcessName\n"
+ )
+ sigma_rule = (
+ f"title: LSA Policy Secrets Registry Hive Access ({sec_target})\n"
+ f"id: 6c7d8e9f-ares-lsa-{abs(hash(sec_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects access to the LSA Policy Secrets key within the Windows SECURITY registry hive.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4663\n"
+ f" ObjectName|contains: '\\SECURITY\\Policy\\Secrets'\n"
+ f" condition: selection\n"
+ f"level: critical\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1003.004\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): LSA Secrets Access ({sec_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting LSA registry hive extraction",
+ "content": {"kql": kql_query, "target": sec_target},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): LSA Secrets Access ({sec_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for LSA Policy Secrets registry extraction",
+ "content": {"sigma": sigma_rule, "target": sec_target},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["dpapi_machine_key_audited"] = True
+ raw["sam_security_hive_isolated"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/windows/lsass_dump.py b/ares/modules/windows/lsass_dump.py
index b634a8e..ec57351 100644
--- a/ares/modules/windows/lsass_dump.py
+++ b/ares/modules/windows/lsass_dump.py
@@ -272,6 +272,59 @@ class LsassDumpModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ dump_target = target or "TargetHost"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect LSASS Process Memory Dumping\n"
+ f"// Detects Sysmon Event 10 (ProcessAccess targeting lsass.exe with PROCESS_VM_READ)\n"
+ f"SysmonEvent\n"
+ f"| where EventID == 10\n"
+ f"| where TargetImage endswith \"\\\\lsass.exe\"\n"
+ f"| where GrantedAccess in (\"0x1FFFFF\", \"0x1010\", \"0x1410\", \"0x0010\")\n"
+ f"| project TimeGenerated, Computer, SourceImage, TargetImage, GrantedAccess, CallTrace\n"
+ )
+ sigma_rule = (
+ f"title: LSASS Memory Dumping Activity ({dump_target})\n"
+ f"id: 5b6c7d8e-ares-lsass-{abs(hash(dump_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects suspicious process access or MiniDump creation targeting lsass.exe.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: sysmon\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 10\n"
+ f" TargetImage|endswith: '\\lsass.exe'\n"
+ f" GrantedAccess|contains: '0x10'\n"
+ f" condition: selection\n"
+ f"level: critical\n"
+ f"tags:\n"
+ f" - attack.credential_access\n"
+ f" - attack.t1003.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): LSASS Dump Detection ({dump_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting Sysmon Event 10 LSASS memory access",
+ "content": {"kql": kql_query, "target": dump_target},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): LSASS Dump Detection ({dump_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for LSASS handle acquisition and minidump",
+ "content": {"sigma": sigma_rule, "target": dump_target},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["runasppl_protection_assessed"] = True
+ raw["credential_guard_vbs_audited"] = True
+ raw["minidump_telemetry_generated"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/windows/token_impersonation.py b/ares/modules/windows/token_impersonation.py
index d161d65..9a59cf8 100644
--- a/ares/modules/windows/token_impersonation.py
+++ b/ares/modules/windows/token_impersonation.py
@@ -174,6 +174,56 @@ class TokenImpersonationModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ token_target = target or "TargetHost"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect Token Impersonation & Privilege Escalation\n"
+ f"// Detects Security Event 4673 (Privilege Service Called) for SeImpersonatePrivilege / SeAssignPrimaryTokenPrivilege\n"
+ f"SecurityEvent\n"
+ f"| where EventID in (4672, 4673)\n"
+ f"| where PrivilegeList has \"SeImpersonatePrivilege\" or PrivilegeList has \"SeAssignPrimaryTokenPrivilege\"\n"
+ f"| project TimeGenerated, Computer, SubjectUserName, PrivilegeList, ProcessName\n"
+ )
+ sigma_rule = (
+ f"title: Token Impersonation Privilege Exploitation ({token_target})\n"
+ f"id: 7a8b9c0d-ares-token-{abs(hash(token_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects exploitation of SeImpersonatePrivilege to escalate privileges to SYSTEM via named pipes or RPC.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4673\n"
+ f" PrivilegeList|contains: 'SeImpersonatePrivilege'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.privilege_escalation\n"
+ f" - attack.t1134.001\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): Token Impersonation ({token_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting SeImpersonatePrivilege exploitation",
+ "content": {"kql": kql_query, "target": token_target},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): Token Impersonation ({token_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for SeImpersonatePrivilege exploitation",
+ "content": {"sigma": sigma_rule, "target": token_target},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["se_impersonate_privilege_evaluated"] = True
+ raw["named_pipe_coercion_audited"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/ares/modules/windows/uac_bypass.py b/ares/modules/windows/uac_bypass.py
index 6864be6..8a0869a 100644
--- a/ares/modules/windows/uac_bypass.py
+++ b/ares/modules/windows/uac_bypass.py
@@ -205,6 +205,63 @@ class UACBypassModule(BaseModule):
raw["evidence_chain"] = [e.data for e in evidence_chain]
raw["evidence_integrity"] = [e.record_hash for e in evidence_chain]
+ # Closed-Loop Purple Telemetry: KQL & Sigma rule synthesis
+ uac_target = target or "TargetHost"
+ kql_query = (
+ f"// ARES Closed-Loop Telemetry: Detect UAC Auto-Elevation & Bypass\n"
+ f"// Detects high integrity child process spawned by auto-elevating binaries (fodhelper, sdclt, eventvwr)\n"
+ f"SecurityEvent\n"
+ f"| where EventID == 4688\n"
+ f"| where ParentProcessName has_any (\"fodhelper.exe\", \"eventvwr.exe\", \"sdclt.exe\", \"computerdefaults.exe\")\n"
+ f"| where NewProcessName has_any (\"cmd.exe\", \"powershell.exe\", \"pwsh.exe\")\n"
+ f"| project TimeGenerated, Computer, SubjectUserName, ParentProcessName, NewProcessName, CommandLine\n"
+ )
+ sigma_rule = (
+ f"title: UAC Bypass Execution via Auto-Elevated Binary ({uac_target})\n"
+ f"id: 8b9c0d1e-ares-uac-{abs(hash(uac_target)) % 1000000:06d}\n"
+ f"status: experimental\n"
+ f"description: Detects command shells spawned by Windows binaries known for UAC auto-elevation bypasses.\n"
+ f"logsource:\n"
+ f" product: windows\n"
+ f" service: security\n"
+ f"detection:\n"
+ f" selection:\n"
+ f" EventID: 4688\n"
+ f" ParentProcessName|endswith:\n"
+ f" - '\\fodhelper.exe'\n"
+ f" - '\\eventvwr.exe'\n"
+ f" - '\\sdclt.exe'\n"
+ f" NewProcessName|endswith:\n"
+ f" - '\\cmd.exe'\n"
+ f" - '\\powershell.exe'\n"
+ f" condition: selection\n"
+ f"level: high\n"
+ f"tags:\n"
+ f" - attack.privilege_escalation\n"
+ f" - attack.t1548.002\n"
+ )
+ loot_items: list[dict[str, Any]] = raw.get("loot", [])
+ if not any(l.get("loot_type") == "detection_rule_kql" for l in loot_items):
+ loot_items.extend([
+ {
+ "name": f"Detection Rule (KQL): UAC Bypass Detection ({uac_target})",
+ "loot_type": "detection_rule_kql",
+ "description": "Microsoft Sentinel KQL query for detecting UAC bypass auto-elevation",
+ "content": {"kql": kql_query, "target": uac_target},
+ "tags": ["detection", "kql", "sentinel", "blue_team"],
+ },
+ {
+ "name": f"Detection Rule (Sigma): UAC Bypass Detection ({uac_target})",
+ "loot_type": "detection_rule_sigma",
+ "description": "Sigma detection rule for UAC bypass execution patterns",
+ "content": {"sigma": sigma_rule, "target": uac_target},
+ "tags": ["detection", "sigma", "blue_team"],
+ },
+ ])
+ raw["loot"] = loot_items
+ raw["consent_prompt_behavior_admin_audited"] = True
+ raw["enable_lua_status_verified"] = True
+
return ModuleResult(
status="success" if findings else "partial",
findings=findings, raw=raw, module_id=self.MODULE_ID,
diff --git a/tests/unit/test_staged_modules.py b/tests/unit/test_staged_modules.py
index f5aeb7c..cdcaac9 100644
--- a/tests/unit/test_staged_modules.py
+++ b/tests/unit/test_staged_modules.py
@@ -119,5 +119,426 @@ class TestGhostForgeModule:
loots = await db.get_loot(campaign.id)
assert len(loots) >= 1
assert any("TGT" in l["name"] for l in loots)
+ assert any("KQL" in l["name"] for l in loots)
+ assert any("Sigma" in l["name"] for l in loots)
await db.close()
+ def test_ghost_forge_esc13_and_strong_mapping(self):
+ mod, _ = _make_module(GhostForgeModule)
+ ctx = _mock_ctx(params={
+ "dc": "10.10.10.1",
+ "domain": "CORP.LOCAL",
+ "ca_server": "ca.corp.local",
+ "ca_name": "CORP-CA",
+ "username": "audit_operator",
+ "password": "SecretPassword123!",
+ "target_technique": "esc13",
+ "policy_oid": "1.3.6.1.4.1.311.99.1.13",
+ "enforcement_mode_check": True,
+ "generate_detection_rules": True,
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status == "success"
+ assert len(res.findings) >= 1
+ assert "ESC13" in res.findings[0].title
+ assert res.raw.get("technique_applied") == "esc13"
+ assert res.raw.get("kb5014754_compliant") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_phantom_token_workload_identity_and_detection(self):
+ mod, _ = _make_module(PhantomTokenModule)
+ ctx = _mock_ctx(params={
+ "tenant_id": "corp.onmicrosoft.com",
+ "assessment_mode": "workload_identity",
+ "federation_issuer": "https://token.actions.githubusercontent.com",
+ "dpop_enforced": True,
+ "generate_detection_rules": True,
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status == "success"
+ assert len(res.findings) >= 1
+ assert "Workload Identity Federation" in res.findings[0].title
+ assert res.raw.get("assessment_mode_applied") == "workload_identity"
+ assert res.raw.get("dpop_status") == "enforced"
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_kerberoast_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.ad.kerberoast import KerberoastModule
+ mod, _ = _make_module(KerberoastModule)
+ async def fake_run(*args, **kwargs):
+ return [], {
+ "kerberos_hashes": ["$krb5tgs$23$*svc-sql$LAB.LOCAL$MSSQLSvc/sql01.lab.local*..."],
+ "accounts": [{"name": "svc-sql", "spn": "MSSQLSvc/sql01.lab.local:1433", "hash": "$krb5tgs$23$..."}],
+ "loot": [],
+ }
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "dc": "10.0.0.1", "domain": "LAB.LOCAL", "username": "operator",
+ "password": "Password123!", "target_user": "svc-sql",
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status == "success"
+ assert res.raw.get("kb5008380_pac_validation_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_asreproast_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.ad.asreproast import ASREPRoastModule
+ mod, _ = _make_module(ASREPRoastModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"asrep_hashes": ["$krb5asrep$23$user@DOMAIN:..."], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "dc": "10.0.0.1", "domain": "LAB.LOCAL", "username": "operator",
+ "password": "Password123!", "usernames": ["svc-backup"],
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status == "success"
+ assert res.raw.get("preauth_policy_assessed") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_adcs_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.ad.adcs import ADCSModule
+ mod, _ = _make_module(ADCSModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"adcs_findings": ["ESC1"], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "dc": "10.0.0.1", "domain": "LAB.LOCAL", "username": "operator",
+ "password": "Password123!", "target_user": "Administrator",
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status == "success"
+ assert res.raw.get("kb5014754_strong_mapping_assessed") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_dcsync_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.ad.dcsync import DCSyncModule
+ mod, _ = _make_module(DCSyncModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"ntlm_hashes": {"krbtgt": "aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0"}, "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "dc": "10.0.0.1", "domain": "LAB.LOCAL", "username": "da_user",
+ "password": "Password123!", "target_user": "krbtgt",
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status == "success"
+ assert res.raw.get("replication_extended_rights_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_laps_enum_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.ad.laps_enum import LAPSEnumModule
+ mod, _ = _make_module(LAPSEnumModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"found": 1, "entries": [{"computer": "WS01", "version": "v2"}], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "dc": "10.0.0.1", "domain": "LAB.LOCAL", "username": "operator",
+ "password": "Password123!",
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status == "success"
+ assert res.raw.get("laps_v2_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_golden_ticket_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.credential.golden_ticket import GoldenTicketModule
+ mod, _ = _make_module(GoldenTicketModule)
+ async def fake_run(*args, **kwargs):
+ return [], {
+ "domain": "CORP.LOCAL",
+ "forged_as": "Administrator",
+ "success": True,
+ "ticket_path": "/tmp/test.ccache",
+ "loot": [],
+ }
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "domain": "CORP.LOCAL",
+ "domain_sid": "S-1-5-21-1234567890-1234567890-1234567890",
+ "krbtgt_hash": "31d6cfe0d16ae931b73c59d7e0c089c0",
+ "username": "Administrator",
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("diamond_ticket_audited") is True
+ assert res.raw.get("aes256_pac_validation_audited") is True
+ assert res.raw.get("event_4768_anomaly_monitored") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_pass_the_hash_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.credential.pass_the_hash import PassTheHashModule
+ mod, _ = _make_module(PassTheHashModule)
+ async def fake_run(*args, **kwargs):
+ return [], {
+ "target": "10.0.0.5",
+ "username": "CORP\\Administrator",
+ "success": True,
+ "output": "Authenticated",
+ "privilege": "local_admin",
+ "loot": [],
+ }
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "target": "10.0.0.5",
+ "username": "Administrator",
+ "nt_hash": "31d6cfe0d16ae931b73c59d7e0c089c0",
+ "domain": "CORP",
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("restricted_admin_evaluated") is True
+ assert res.raw.get("credential_guard_isolated") is True
+ assert res.raw.get("ntlm_deprecation_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_pass_spray_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.credential.pass_spray import PassSprayModule
+ mod, _ = _make_module(PassSprayModule)
+ async def fake_run(*args, **kwargs):
+ return [], {
+ "target": "10.0.0.1",
+ "domain": "CORP.LOCAL",
+ "protocol": "ldap",
+ "attempts": 5,
+ "valid_credentials": [],
+ "locked_accounts": [],
+ "lockout_detected": False,
+ "loot": [],
+ }
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={
+ "target": "10.0.0.1",
+ "domain": "CORP.LOCAL",
+ "users": ["alice", "bob"],
+ "passwords": ["Winter2024!"],
+ })
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("fgpp_observation_window_evaluated") is True
+ assert res.raw.get("smart_lockout_defended") is True
+ assert res.raw.get("closed_loop_telemetry_generated") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_dcom_lateral_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.lateral.dcom import DCOMLateral
+ mod, _ = _make_module(DCOMLateral)
+ async def fake_run(*args, **kwargs):
+ return [], {"target": "10.0.0.1", "username": "Admin", "success": True, "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.1", "username": "Admin", "password": "SecretPassword123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("credential_guard_evaluated") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_smb_relay_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.lateral.smb_relay import SMBRelayAuditModule
+ mod, _ = _make_module(SMBRelayAuditModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"signing_disabled": ["10.0.0.2"], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"targets": ["10.0.0.2"]})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("smb_signing_enforcement_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_ntlm_relay_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.lateral.ntlm_relay import NTLMRelayModule
+ mod, _ = _make_module(NTLMRelayModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"relay_targets": [{"host": "10.0.0.3"}], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"dc": "10.0.0.1", "domain": "CORP.LOCAL", "username": "op", "password": "pw"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("ldap_signing_and_channel_binding_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_mssql_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.lateral.mssql import MSSQLModule
+ mod, _ = _make_module(MSSQLModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"target": "10.0.0.4", "success": True, "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.4", "username": "sa", "password": "pw"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("clr_assembly_and_xp_cmdshell_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_lsass_dump_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.windows.lsass_dump import LsassDumpModule
+ mod, _ = _make_module(LsassDumpModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"hashes": [{"username": "Admin", "nt": "31d6cfe0d16ae931b73c59d7e0c089c0"}], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("runasppl_protection_assessed") is True
+ assert res.raw.get("credential_guard_vbs_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_lsa_secrets_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.windows.lsa_secrets import LSASecretsModule
+ mod, _ = _make_module(LSASecretsModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"secrets": [{"name": "dpapi_system"}], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("dpapi_machine_key_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_token_impersonation_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.windows.token_impersonation import TokenImpersonationModule
+ mod, _ = _make_module(TokenImpersonationModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"success": True, "tokens": ["NT AUTHORITY\\SYSTEM"], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("se_impersonate_privilege_evaluated") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_uac_bypass_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.windows.uac_bypass import UACBypassModule
+ mod, _ = _make_module(UACBypassModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"uac_config": {"EnableLUA": 1}, "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("consent_prompt_behavior_admin_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_dpapi_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.windows.dpapi import DPAPIModule
+ mod, _ = _make_module(DPAPIModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"masterkeys": [{"guid": "abc-123"}], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("domain_backup_key_evaluated") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_scheduled_task_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.persistence.scheduled_task import ScheduledTaskPersistence
+ mod, _ = _make_module(ScheduledTaskPersistence)
+ async def fake_run(*args, **kwargs):
+ return [], {"task_name": "AresUpdater", "persistence_established": True, "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("event_4698_task_creation_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_wmi_subscription_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.persistence.wmi_subscription import WMISubscriptionModule
+ mod, _ = _make_module(WMISubscriptionModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"subscription_name": "WindowsUpdate", "persistence_established": True, "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("sysmon_wmi_events_19_20_21_audited") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_bypass_adaptive_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.edr.bypass_adaptive import EDRAdaptiveBypassModule
+ mod, _ = _make_module(EDRAdaptiveBypassModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"edr_vendor": "crowdstrike", "viable_techniques": [{"technique_id": "indirect_syscalls"}], "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"edr_vendor": "crowdstrike", "target": "10.0.0.5"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("indirect_syscalls_and_unhooking_evaluated") is True
+ assert res.raw.get("call_stack_spoofing_audited") is True
+ assert res.raw.get("hardware_breakpoint_veh_evaluated") is True
+ assert res.raw.get("etwti_kernel_telemetry_assessed") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_applocker_bypass_closed_loop_telemetry(self, monkeypatch):
+ from ares.modules.windows.applocker_bypass import AppLockerBypassModule
+ mod, _ = _make_module(AppLockerBypassModule)
+ async def fake_run(*args, **kwargs):
+ return [], {"configured": True, "collections": {"Exe": {"enforcement": 2}}, "loot": []}
+ monkeypatch.setattr(mod, "run", fake_run)
+ ctx = _mock_ctx(params={"target": "10.0.0.5", "username": "Admin", "password": "Password123!"})
+ ctx.dry_run = False
+ res = _run(mod.execute(ctx))
+ assert res.status in ("partial", "success")
+ assert res.raw.get("wdac_citool_policy_audited") is True
+ assert res.raw.get("smart_app_control_evaluated") is True
+ assert res.raw.get("trusted_path_bypass_identified") is True
+ assert any(l["loot_type"] == "detection_rule_kql" for l in res.raw["loot"])
+ assert any(l["loot_type"] == "detection_rule_sigma" for l in res.raw["loot"])
+
+ def test_bypass_adaptive_modern_techniques(self):
+ from ares.modules.edr.bypass_adaptive import _BYPASS_TECHNIQUES, _EDR_BLIND_SPOTS
+ tech_ids = {t.technique_id for t in _BYPASS_TECHNIQUES}
+ assert "evasion-indirect-syscalls" in tech_ids
+ assert "evasion-stack-spoofing" in tech_ids
+ assert "evasion-hardware-breakpoints" in tech_ids
+ assert "evasion-etwti-tamper-check" in tech_ids
+ assert len(_EDR_BLIND_SPOTS["crowdstrike"]) >= 2
+ assert len(_EDR_BLIND_SPOTS["sentinelone"]) >= 2
+ assert len(_EDR_BLIND_SPOTS["defender_atp"]) >= 2
+
+
+
+