hunting-for-dns-based-persistence
Hunts for DNS-based persistence mechanisms such as DNS hijacking, dangling CNAME records enabling subdomain takeover, wildcard DNS abuse, and unauthorized zone or NS delegation changes, using passive DNS history (SecurityTrails API), Route53/Azure DNS/Cloudflare audit logs, and zone transfer analysis. Use when investigating suspected DNS hijacking or subdomain takeover, or when threat hunting for DNS record tampering that persists across credential rotations and endpoint reimaging.
- License 许可
- Apache-2.0
- 最近更新
- 2026-08-31
- Stars
- ★ 3.6w
- Forks
- 4.4k
01 前言 Front Matter
- name
- hunting-for-dns-based-persistence
- tags
- [ "dns", "persistence", "threat-hunting", "passive-dns", "dns-hijacking", "subdomain-takeover", "securitytrails" ]
- author
- mahipal
- domain
- cybersecurity
- license
- Apache-2.0
- version
- 1.0
- nist_csf
- [ "DE.CM-01", "DE.AE-02", "DE.AE-07", "ID.RA-05" ]
- subdomain
- threat-hunting
- description
- Hunts for DNS-based persistence mechanisms such as DNS hijacking, dangling CNAME records enabling subdomain takeover, wildcard DNS abuse, and unauthorized zone or NS delegation changes, using passive DNS history (SecurityTrails API), Route53/Azure DNS/Cloudflare audit logs, and zone transfer analysis. Use when investigating suspected DNS hijacking or subdomain takeover, or when threat hunting for DNS record tampering that persists across credential rotations and endpoint reimaging.
- mitre_attack
- [ "T1046", "T1057", "T1082", "T1083", "T1547" ]
02 资源文件 45
- 许可证LICENSE11.0 KB
- 参考文档references/adaptation.md5.6 KB
- 参考文档references/api-reference.md2.6 KB
- 参考文档references/daily.md7.8 KB
- 参考文档references/feature-map/F01-server-status.md18.5 KB
- 参考文档references/feature-map/F02-auth-and-sessions.md41.6 KB
- 参考文档references/feature-map/F03-deferred-init.md48.3 KB
- 参考文档references/feature-map/F04-conversation-lifecycle.md70.3 KB
- 参考文档references/feature-map/F05-run-pause-interrupt.md61.5 KB
- 参考文档references/feature-map/F06-conversation-events.md56.5 KB
- 参考文档references/feature-map/F07-session-socket.md52.0 KB
- 参考文档references/feature-map/F08-confirmation-security-secrets.md58.6 KB
- 参考文档references/feature-map/F09-model-switching-plugins.md67.5 KB
- 参考文档references/feature-map/F10-fork-navigate-condense-ask.md48.1 KB
- 参考文档references/feature-map/F11-goals.md47.0 KB
- 参考文档references/feature-map/F12-runtime-and-credentials.md84.3 KB
- 参考文档references/feature-map/F13-bash.md57.9 KB
- 参考文档references/feature-map/F14-files.md64.2 KB
- 参考文档references/feature-map/F15-git.md62.6 KB
- 参考文档references/feature-map/F16-workspace-serving-and-vscode.md46.4 KB
- 参考文档references/feature-map/F17-workspaces-registry.md53.7 KB
- 参考文档references/feature-map/F18-settings-and-secrets.md76.7 KB
- 参考文档references/feature-map/F19-mcp.md64.0 KB
- 参考文档references/feature-map/F20-llm-profiles.md79.1 KB
- 参考文档references/feature-map/F21-agent-profiles.md81.4 KB
- 参考文档references/feature-map/F22-meta-profiles.md53.5 KB
- 参考文档references/feature-map/F23-llm-catalog-and-connections.md63.8 KB
- 参考文档references/feature-map/F24-openai-subscription.md37.7 KB
- 参考文档references/feature-map/F25-skills.md69.3 KB
- 参考文档references/feature-map/F26-plugins.md70.0 KB
- 参考文档references/feature-map/F27-hooks-subagents-tools.md79.0 KB
- 参考文档references/feature-map/F28-canvas-extensions.md83.3 KB
- 参考文档references/feature-map/F29-app-backend-bridge.md82.0 KB
- 参考文档references/feature-map/F30-openai-gateway.md80.1 KB
- 参考文档references/feature-map/F31-persistence-and-limits.md62.7 KB
- 参考文档references/feature-map/F32-webhooks-and-telemetry.md66.0 KB
- 参考文档references/feature-map/F33-sdk-remote-client.md126.8 KB
- 参考文档references/feature-map/F34-typescript-client.md101.7 KB
- 参考文档references/feature-map/README.md15.8 KB
- 参考文档references/maintenance.md8.1 KB
- 参考文档references/mapping.md22.1 KB
- 参考文档references/report.md2.4 KB
- 脚本scripts/agent.py6.6 KB
- 脚本scripts/control_agent_server.py239.4 KB
- 脚本scripts/control-agent-server836 B
03 SKILL.md 正文
Hunting for DNS-based Persistence
Overview
Attackers establish DNS-based persistence by hijacking DNS records, creating unauthorized subdomains, abusing wildcard DNS entries, or modifying NS delegations to redirect traffic through attacker-controlled infrastructure. These techniques survive credential rotations, endpoint reimaging, and traditional remediation because DNS changes persist independently of compromised hosts. Detection requires passive DNS historical analysis, zone file auditing, and monitoring for unauthorized record modifications. This skill covers hunting methodologies using SecurityTrails passive DNS API, DNS audit logs from Route53/Azure DNS/Cloudflare, and zone transfer analysis.
When to Use
- When investigating security incidents that require hunting for dns based persistence
- When building detection rules or threat hunting queries for this domain
- When SOC analysts need structured procedures for this analysis type
- When validating security monitoring coverage for related attack techniques
Prerequisites
- SecurityTrails API key (free tier provides 50 queries/month)
- Access to DNS provider audit logs (Route53, Azure DNS, Cloudflare, or on-premises DNS)
- Python 3.9+ with requests library
- DNS zone file access or AXFR capability for internal zones
- Historical DNS baseline for comparison
Steps
Step 1: Baseline DNS Records
Export current DNS zone records and establish baseline for all authorized A, AAAA, CNAME, MX, NS, and TXT records.
Step 2: Query Passive DNS History
Use SecurityTrails API to retrieve historical DNS records and identify unauthorized changes, new subdomains, and CNAME records pointing to decommissioned services (dangling CNAMEs).
Step 3: Detect Anomalies
Compare current records against baseline to identify unauthorized modifications, wildcard records that resolve all subdomains, NS delegation changes, and MX record hijacking.
Step 4: Investigate Findings
Correlate DNS anomalies with threat intelligence feeds, check resolution targets against known malicious infrastructure, and validate record ownership.
Expected Output
JSON report listing DNS anomalies with record type, historical changes, risk severity, and remediation recommendations for each finding.
04 同仓库更多 Skills
verifying-build-provenance-with-slsa-sigstore
Verifies artifact signatures and SLSA provenance using Sigstore's cosign (verify, verify-attestation, verify-blob-attestation) and slsa-verifier (verify-artifact), enforcing keyless OIDC builder identity and source repo against SLSA Build levels. Use in CI/CD before deploying artifacts, when consuming third-party attestations, establishing a SLSA Build L3 pipeline, or confirming provenance during incident response or admission control.
validating-tpm-measured-boot-attestation
Verifies TPM 2.0 measured-boot integrity and remote attestation with tpm2-tools -- reading PCRs (tpm2_pcrread), replaying the boot event log, generating and checking signed quotes (tpm2_quote/tpm2_checkquote), and sealing secrets to a PCR policy. Use to confirm a system booted trusted firmware/kernel for Zero Trust device posture, detect boot-chain tampering via PCR drift, or build a golden-value baseline for fleet attestation.
validating-backup-integrity-for-recovery
Validates backup integrity through cryptographic hash verification, automated restore testing, corruption detection, and recoverability checks to confirm backups are reliable for disaster recovery and ransomware response. Use before relying on backups for recovery, when building post-backup validation pipelines, auditing backup infrastructure for compliance, or checking immutable/air-gapped backups for silent corruption or tampering.
triaging-windows-with-kape
Runs KAPE (Kroll Artifact Parser and Extractor) to collect targeted forensic artifacts (registry hives, $MFT, event logs, prefetch, browser data) via Targets and parse them with Modules wrapping Eric Zimmerman's EZ Tools (PECmd, MFTECmd, RECmd). Use during early incident containment/triage when full disk imaging is impractical but a defensible, parseable Windows artifact set is needed quickly, including at-scale remote collection.
triaging-vulnerabilities-with-ssvc-framework
Triages and prioritizes vulnerabilities with CISA's Stakeholder-Specific Vulnerability Categorization (SSVC) decision tree, weighing exploitation status (via the CISA KEV catalog and FIRST EPSS API), technical impact, automatability, and mission prevalence to output Track/Track*/Attend/Act decisions. Use when prioritizing vulnerability scan results (OpenVAS, Nessus, Qualys) for remediation planning beyond raw CVSS scores.
triaging-security-incident
Performs initial triage of security incidents using the NIST SP 800-61r3 and SANS PICERL frameworks, classifying incident type, assigning priority by business impact, and routing to the appropriate response team. Use when a SIEM/EDR alert needs human classification, concurrent alerts must be prioritized, or a user report or threat-intel IOC match requires initial incident categorization.