Skip to main content

Automation and SOAR

Automation is critical for scaling SOC operations and reducing response times. This layer combines security orchestration (Cortex SOAR) with infrastructure automation (Terraform/PyInfra) to enable rapid, consistent responses to security events and efficient infrastructure management.
Automation reduces manual work, eliminates human error, and enables your team to focus on complex investigations while repetitive tasks are handled automatically.

Architecture Overview

Cortex SOAR

Security orchestration for investigation and response automation

Infrastructure as Code

Terraform and PyInfra for automated infrastructure management

Cortex SOAR Platform

Cortex is the automation engine that powers TheHive, providing analyzers for enrichment and responders for automated actions.

Core Concepts

Observable Enrichment:Analyzers automatically enrich observables with contextual information:
  • Threat Intelligence: VirusTotal, MISP, OTX
  • Reputation: AbuseIPDB, URLhaus, PhishTank
  • Sandboxing: Joe Sandbox, Cuckoo, ANY.RUN
  • DNS/WHOIS: PassiveTotal, DomainTools
  • File Analysis: YARA, ClamAV, PEFile
  • Network: Shodan, Censys, MaxMind GeoIP

Analyzer Configuration

Start with free analyzers (AbuseIPDB, OTX, MISP) and gradually add commercial services (VirusTotal, PassiveTotal) based on investigation needs and budget.
IP Address Analyzers:
  • AbuseIPDB_1: IP reputation and reports
  • GreyNoise: Internet scanner identification
  • IPVoid: Multi-engine reputation check
  • MaxMind GeoIP: Geographic location
  • Shodan: Internet exposure scanning
  • Tor Project: Tor exit node detection
File Hash Analyzers:
  • VirusTotal: Multi-AV scanning
  • MISP: Threat intelligence correlation
  • MalwareBazaar: Known malware repository
  • HybridAnalysis: Sandbox analysis
URL/Domain Analyzers:
  • URLhaus: Malware distribution URLs
  • PhishTank: Phishing URL database
  • Google Safe Browsing: URL safety
  • Censys: Certificate and host analysis
Create custom analyzers for internal tools:

Responder Configuration

Responders can make destructive changes (block IPs, quarantine hosts, disable accounts). Always test in a lab environment and implement approval workflows for critical actions.
Firewall Integration:

Automation Workflows

Chain multiple analyzers and responders for complete automation:
Observable Added → Automatic Enrichment:
  1. IP address added to case
  2. Run AbuseIPDB analyzer (reputation)
  3. Run GreyNoise analyzer (scanner detection)
  4. Run Shodan analyzer (exposure check)
  5. Run MaxMind analyzer (geolocation)
  6. If malicious score > threshold:
    • Run firewall block responder
    • Send Slack notification
    • Create blocking task
Email Observable → Automated Response:
  1. URL extracted from phishing email
  2. Run URLhaus analyzer
  3. Run PhishTank analyzer
  4. Run VirusTotal analyzer
  5. If confirmed phishing:
    • Report to email gateway
    • Block sender domain
    • Search for similar emails
    • Notify affected users
File Hash → Sandbox Analysis:
  1. File hash observable created
  2. Run VirusTotal analyzer
  3. If unknown or suspicious:
    • Submit to Joe Sandbox
    • Submit to Hybrid Analysis
  4. If confirmed malicious:
    • Quarantine affected hosts
    • Search for hash in environment
    • Update antivirus signatures
    • Block at proxy/firewall

Infrastructure as Code (IaC)

Terraform Automation

Terraform manages SOC infrastructure deployment and configuration:

PyInfra Automation

PyInfra provides Python-based configuration management:
Use PyInfra for complex configuration tasks that benefit from Python’s flexibility, while Terraform handles infrastructure provisioning.

Integration Patterns

Automated Incident Response

Detection

IDS/SIEM detects threat → Creates alert

Enrichment

Cortex analyzers gather intelligence

Decision

Automated scoring determines severity

Response

Cortex responders execute containment

Continuous Deployment

Best Practices

  • Start conservative: Begin with analyzers only, add responders gradually
  • Test thoroughly: Validate in lab before production deployment
  • Implement approvals: Require human approval for destructive actions
  • Monitor job failures: Alert on analyzer/responder errors
  • Document workflows: Maintain runbooks for automated procedures
  • Rate limiting: Prevent API quota exhaustion
  • Version control: Store all Terraform/PyInfra code in Git
  • Code review: Require peer review for infrastructure changes
  • State management: Use remote backends with locking
  • Secrets management: Never commit credentials, use vaults
  • Modular design: Create reusable modules and roles
  • Testing: Validate configurations before applying
  • Least privilege: Grant minimum necessary permissions
  • Audit logging: Log all automated actions
  • Credential rotation: Regularly update API keys and passwords
  • Network segmentation: Isolate automation systems
  • Change management: Follow approval processes for automation changes

Metrics and Monitoring

Track automation effectiveness:
  • Analyzer success/failure rates
  • Average enrichment time
  • Responder execution success
  • API quota utilization
  • Time saved through automation
  • Manual intervention frequency

Official Documentation

Cortex Documentation

Official Cortex documentation and analyzer catalog

Terraform Docs

Complete Terraform documentation and provider registry

PyInfra Documentation

PyInfra operations reference and examples

Cortex Analyzers

Open-source analyzer and responder repository

Next Steps

  1. Review Operations Guide for automation best practices
  2. Explore Incident Handling playbooks for automation opportunities
  3. Check Threat Detection strategies for automated enrichment workflows