Integrating Wazuh with Shuffle SOAR for Security Orchestration
Introduction
Security Orchestration, Automation, and Response (SOAR) platforms have become essential components of modern security operations. Shuffle is a general-purpose security automation platform that extends Wazuh’s capabilities by enabling automated responses across any device or technology that Shuffle integrates with.
The Wazuh-Shuffle integration, introduced in Wazuh 4.4, provides:
- 🔄 Automated Response: Execute complex response workflows automatically
- 🎯 Multi-platform Integration: Respond using any technology Shuffle supports
- 📊 Advanced Orchestration: Chain multiple actions in sophisticated workflows
- ⚡ Real-time Processing: Immediate response to security events
- 🛠️ Flexible Configuration: Customize responses based on alert criteria
Architecture Overview
Integration Flow
flowchart TB
subgraph "Wazuh Manager"
W1[Alert Generation]
W2[Rule Engine]
W3[Integration Module]
W4[Webhook Sender]
end
subgraph "Shuffle SOAR"
S1[Webhook Receiver]
S2[Workflow Engine]
S3[Action Executor]
S4[Response Tracker]
end
subgraph "Response Systems"
R1[Active Directory]
R2[Email/SMS]
R3[Firewall Rules]
R4[Ticket Systems]
R5[Chat Platforms]
end
subgraph "Security Events"
E1[Credential Dumping]
E2[Brute Force Attacks]
E3[Malware Detection]
E4[Policy Violations]
end
E1 --> W1
E2 --> W1
E3 --> W1
E4 --> W1
W1 --> W2
W2 --> W3
W3 --> W4
W4 -->|JSON Alert| S1
S1 --> S2
S2 --> S3
S3 --> R1
S3 --> R2
S3 --> R3
S3 --> R4
S3 --> R5
S4 --> W1
style S2 fill:#ff6b6b
style S3 fill:#51cf66
style W4 fill:#4dabf7
Key Components
- Webhook Integration: JSON-based communication between Wazuh and Shuffle
- Workflow Engine: Orchestrates multi-step response processes
- Action Modules: Execute specific responses (AD, email, firewall, etc.)
- Correlation Engine: Link related events across different systems
Basic Configuration
Phase 1: Shuffle Setup
Deploy Shuffle Instance
Option 1: Docker Deployment
# Clone Shuffle repositorygit clone https://github.com/Shuffle/Shufflecd Shuffle
# Start Shuffle with Docker Composedocker-compose up -d
# Access Shuffle at http://localhost:3001Option 2: Shuffle Cloud (SaaS)
- Visit shuffler.io
- Create an account
- Access dashboard directly
Create Basic Workflow
-
Create New Workflow:
- Navigate to Shuffle dashboard
- Click “Create Workflow”
- Name: “Wazuh Integration Test”
-
Add Webhook Trigger:
- Click “Triggers” tab
- Drag “Webhook” to workspace
- Rename to “Wazuh Alerts”
- Copy the webhook URI (format:
https://YOUR_SHUFFLE_URL/api/v1/hooks/webhook_ID) - Start the webhook
-
Add Response Action:
- Drag “Shuffle Tools” app to workspace
- Rename to “Receive_Wazuh_alerts”
- Set call option to “$exec”
- Connect webhook to this action
- Save workflow
Phase 2: Wazuh Server Configuration
Add integration configuration to /var/ossec/etc/ossec.conf:
<ossec_config> <integration> <name>shuffle</name> <hook_url>https://YOUR_SHUFFLE_URL/api/v1/hooks/HOOK_ID</hook_url> <level>3</level> <alert_format>json</alert_format> </integration></ossec_config>Configuration Options:
<name>: Integration identifier (must be “shuffle”)<hook_url>: Webhook URI from Shuffle<level>: Minimum alert level to forward<alert_format>: Format for alert data (json/xml)
Alternative Filtering Options:
<!-- Forward specific rule ID --><rule_id>92026</rule_id>
<!-- Forward specific rule group --><group>authentication_failed</group>
<!-- Forward from specific location --><event_location>server1</event_location>Phase 3: Test Integration
-
Restart Wazuh Manager:
Terminal window sudo systemctl restart wazuh-manager -
Generate Test Alert:
Terminal window # Create test eventssudo systemctl restart wazuh-manager -
Verify in Shuffle:
- Click “Show executions” in Shuffle
- Select any execution to view Wazuh alert data
- Confirm JSON payload contains expected fields
Advanced Use Case: SAM Credential Dumping Response
Scenario Overview
When Wazuh detects Windows SAM database credential dumping, we want to automatically:
- Disable the compromised user account in Active Directory
- Send notification to security team
- Create incident ticket
- Block the source IP
Infrastructure Requirements
| Component | Purpose |
|---|---|
| Windows Server 2022 | Domain controller with Active Directory |
| Windows 11 Endpoint | Monitored system with Sysmon |
| Wazuh Agents | Installed on both systems |
| Shuffle SOAR | Orchestration platform |
Phase 1: Windows Endpoint Configuration
Install and Configure Sysmon
# Download SysmonInvoke-WebRequest -Uri "https://download.sysinternals.com/files/Sysmon.zip" -OutFile "Sysmon.zip"Expand-Archive -Path "Sysmon.zip" -DestinationPath "."
# Download Sysmon configurationInvoke-WebRequest -Uri "https://raw.githubusercontent.com/SwiftOnSecurity/sysmon-config/master/sysmonconfig-export.xml" -OutFile "sysmonconfig.xml"
# Install Sysmon.\sysmon64.exe -accepteula -i .\sysmonconfig.xmlConfigure Wazuh Agent
Add to C:\Program Files (x86)\ossec-agent\ossec.conf:
<localfile> <location>Microsoft-Windows-Sysmon/Operational</location> <log_format>eventchannel</log_format></localfile>Restart Wazuh agent:
Restart-Service -Name wazuhPhase 2: Advanced Shuffle Workflow
Create Enhanced Workflow
-
Create Workflow: “Registry SAM Dump Response”
-
Add Webhook Trigger: Copy URI for Wazuh configuration
-
Add Username Extraction Tool:
Terminal window # Extract username from Wazuh alertecho '$exec.all_fields.data.win.eventdata.user' | rev | cut -d'\' -f1 | rev -
Add Active Directory Integration:
- Drag “Active Directory” app to workspace
- Click “AUTHENTICATE ACTIVE DIRECTORY”
- Configure connection:
- Server: Your DC IP/hostname
- Username: Domain admin account
- Password: Domain admin password
- Base DN:
CN=Users,DC=yourdomain,DC=local
- Select “Disable user” action
- Set Samaccountname to
$extract_username
-
Add Notification Actions:
Email Notification:
{"to": "security@company.com","subject": "CRITICAL: Credential Dumping Detected","body": "User $extract_username attempted credential dumping. Account disabled."}Slack Integration:
{"channel": "#security-alerts","message": "🚨 CREDENTIAL DUMP ALERT 🚨\nUser: $extract_username\nHost: $exec.all_fields.agent.name\nTime: $exec.all_fields.timestamp\nAction: Account disabled automatically"} -
Add Incident Creation:
{"title": "Credential Dumping Incident","description": "SAM database dump detected","severity": "Critical","assignee": "security-team","tags": ["credential-dumping", "sam", "windows"]}
Advanced Workflow Logic
# Pseudo-code for enhanced workflowdef process_sam_dump_alert(alert): # Extract user information username = extract_username(alert.user_field) hostname = alert.agent.name timestamp = alert.timestamp
# Skip if user is in exclusion list excluded_users = ["domain_admin", "service_account"] if username in excluded_users: return "User excluded from automatic response"
# Disable Active Directory account try: ad_result = disable_ad_user(username) if ad_result.success: log_action("Account disabled successfully", username) else: log_error("Failed to disable account", username) escalate_to_admin(username, "Disable failed") except Exception as e: log_error(f"AD operation failed: {str(e)}", username)
# Create incident ticket incident = create_incident({ "title": f"Credential Dumping by {username}", "description": f"SAM dump detected on {hostname}", "severity": "Critical", "details": { "username": username, "hostname": hostname, "timestamp": timestamp, "action_taken": "Account disabled" } })
# Send notifications send_email_alert(username, hostname, incident.id) send_slack_notification(username, hostname)
# Additional security actions if is_persistent_attack(alert.src_ip): block_ip_address(alert.src_ip) quarantine_host(hostname)
return "Response completed successfully"Phase 3: Wazuh Server Configuration
Configure specific rule forwarding to Shuffle:
<ossec_config> <integration> <name>shuffle</name> <hook_url>https://YOUR_SHUFFLE_URL/api/v1/hooks/HOOK_ID</hook_url> <rule_id>92026</rule_id> <alert_format>json</alert_format> </integration></ossec_config>Rule 92026: Built-in Wazuh rule for Windows registry SAM dump detection
Phase 4: Testing the Complete Workflow
Simulate SAM Dump Attack
# Run as administrator on Windows 11 endpoint# This triggers Wazuh rule 92026reg save hklm\sam c:\temp\samVerify Response Chain
- Wazuh Detection: Check alerts.log for rule 92026
- Shuffle Execution: Verify workflow execution in Shuffle dashboard
- AD Account Status: Confirm user account is disabled
- Notifications: Check email and Slack for alerts
- Incident Creation: Verify ticket was created
Expected Alert Flow
{ "rule": { "id": "92026", "level": 12, "description": "Windows registry hive was saved to file" }, "data": { "win": { "eventdata": { "user": "DOMAIN\\wazuhuser", "processName": "reg.exe" } } }, "agent": { "name": "WIN11-ENDPOINT" }}Multi-Platform Response Workflows
Brute Force Attack Response
Workflow: "Brute Force Response"Trigger: "rule.groups:authentication_failed AND frequency>=5"Actions: 1. Extract source IP 2. Check IP reputation (VirusTotal/AbuseIPDB) 3. If malicious: - Block IP on firewall - Add to threat intel feeds 4. If internal IP: - Disable user account - Quarantine host - Alert security team 5. Create incident with timelineMalware Detection Response
Workflow: "Malware Response"Trigger: "rule.groups:malware"Actions: 1. Isolate infected host 2. Collect forensic artifacts 3. Scan other hosts for same IoCs 4. Update antivirus signatures 5. Create incident report 6. Notify stakeholdersData Exfiltration Response
Workflow: "Data Exfiltration Response"Trigger: "rule.groups:data_loss"Actions: 1. Block outbound connections 2. Identify affected data 3. Revoke user credentials 4. Notify legal/compliance team 5. Initiate breach procedures 6. Document timelineAdvanced Integration Techniques
Conditional Workflows
{ "workflow": "Conditional Response", "conditions": { "if": "$exec.all_fields.rule.level >= 10", "then": "execute_critical_response", "else": "execute_standard_response" }, "actions": { "critical_response": [ "disable_user_account", "isolate_host", "notify_ciso" ], "standard_response": [ "log_incident", "notify_analyst" ] }}Multi-Stage Orchestration
# Orchestration exampleclass SecurityOrchestrator: def handle_alert(self, alert): # Stage 1: Immediate containment containment_result = self.contain_threat(alert)
# Stage 2: Investigation if containment_result.success: investigation = self.investigate_threat(alert)
# Stage 3: Response escalation if investigation.severity == "Critical": self.escalate_response(alert, investigation)
# Stage 4: Recovery recovery_plan = self.create_recovery_plan(alert) self.execute_recovery(recovery_plan)
# Stage 5: Lessons learned self.update_playbooks(alert, investigation)API Integration Examples
ServiceNow Integration
def create_servicenow_incident(alert_data): """Create incident in ServiceNow"""
payload = { "short_description": f"Security Alert: {alert_data['rule']['description']}", "description": f"Wazuh alert triggered at {alert_data['timestamp']}", "urgency": map_alert_level_to_urgency(alert_data['rule']['level']), "category": "Security", "subcategory": "Intrusion", "u_alert_source": "Wazuh", "u_rule_id": alert_data['rule']['id'] }
response = requests.post( f"{servicenow_url}/api/now/table/incident", auth=(username, password), headers={"Content-Type": "application/json"}, json=payload )
return response.json()Splunk Integration
def send_to_splunk(alert_data): """Send alert data to Splunk for correlation"""
splunk_payload = { "event": alert_data, "source": "wazuh", "sourcetype": "wazuh_alert", "index": "security" }
response = requests.post( f"{splunk_url}/services/collector/event", headers={ "Authorization": f"Splunk {splunk_token}", "Content-Type": "application/json" }, json=splunk_payload )
return response.status_code == 200Monitoring and Metrics
Workflow Performance Tracking
def track_workflow_metrics(): """Track SOAR workflow performance"""
metrics = { "total_workflows_executed": 0, "successful_executions": 0, "failed_executions": 0, "average_execution_time": 0, "most_triggered_workflows": [], "error_patterns": [] }
# Collect from Shuffle API workflows = shuffle_client.get_workflow_executions()
for workflow in workflows: metrics["total_workflows_executed"] += 1
if workflow.status == "SUCCESS": metrics["successful_executions"] += 1 else: metrics["failed_executions"] += 1 metrics["error_patterns"].append(workflow.error)
# Calculate success rate success_rate = (metrics["successful_executions"] / metrics["total_workflows_executed"]) * 100
return metrics, success_rateAlert Processing Statistics
def generate_soar_report(): """Generate SOAR effectiveness report"""
report = { "period": "Last 30 days", "total_alerts_processed": 0, "automated_responses": 0, "manual_interventions": 0, "response_times": { "avg_containment_time": 0, "avg_investigation_time": 0, "avg_recovery_time": 0 }, "top_response_actions": [], "effectiveness_metrics": { "false_positive_rate": 0, "containment_success_rate": 0, "mttr": 0 # Mean Time to Resolution } }
return reportSecurity Considerations
Secure Integration
-
API Authentication:
Terminal window # Use strong API keysexport SHUFFLE_API_KEY="strong-random-key-here"# Rotate keys regularlyshuffle_client.rotate_api_key() -
Network Security:
Terminal window # Restrict network accessiptables -A OUTPUT -p tcp -d shuffle.company.com --dport 443 -j ACCEPTiptables -A OUTPUT -p tcp --dport 443 -j DROP -
Credential Management:
# Use secure credential storagecredentials:active_directory:username: ${AD_USERNAME}password: ${AD_PASSWORD}email:api_key: ${EMAIL_API_KEY}
Audit and Compliance
def audit_soar_actions(): """Audit all SOAR actions for compliance"""
audit_log = { "timestamp": datetime.now().isoformat(), "action": "user_account_disabled", "performer": "shuffle_automation", "target": "user@company.com", "reason": "credential_dumping_detected", "authorization": "auto_policy_violation", "success": True }
# Send to audit system send_to_audit_log(audit_log)
# Compliance reporting generate_compliance_report(audit_log)Troubleshooting Guide
Common Integration Issues
Webhook Not Receiving Alerts
# Check Wazuh integration statusgrep "shuffle" /var/ossec/logs/ossec.log
# Test webhook connectivitycurl -X POST -H "Content-Type: application/json" \ -d '{"test": "data"}' \ https://YOUR_SHUFFLE_URL/api/v1/hooks/HOOK_IDWorkflow Execution Failures
# Debug Shuffle workflowdef debug_workflow_execution(execution_id): """Debug failed workflow execution"""
execution = shuffle_client.get_execution(execution_id)
print(f"Execution ID: {execution.id}") print(f"Status: {execution.status}") print(f"Error: {execution.error}") print(f"Steps: {len(execution.steps)}")
for step in execution.steps: if step.status == "FAILURE": print(f"Failed Step: {step.name}") print(f"Error: {step.error}")Authentication Issues
# Test Active Directory connectionldapsearch -x -H ldap://your-dc.company.com \ -D "username@domain.com" \ -W -b "DC=company,DC=com"
# Verify permissionsnet user testuser /domainPerformance Optimization
-
Workflow Optimization:
optimization_tips:- Use parallel execution where possible- Cache frequent API calls- Implement error handling- Use appropriate timeouts- Monitor resource usage -
Alert Filtering:
<!-- Only forward high-priority alerts --><integration><name>shuffle</name><hook_url>https://shuffle.company.com/api/v1/hooks/hook_id</hook_url><level>8</level><group>authentication_failed,malware,data_loss</group></integration>
Best Practices
Workflow Design
- Modular Design: Create reusable workflow components
- Error Handling: Implement proper error handling and rollback procedures
- Testing: Test workflows in staging environment first
- Documentation: Document workflow logic and dependencies
- Version Control: Track workflow changes and versions
Security Operations
- Graduated Response: Implement escalating response levels
- Human Oversight: Include manual approval for critical actions
- Audit Trail: Log all automated actions for compliance
- Rollback Procedures: Plan for reversing automated actions
- Regular Reviews: Periodically review and update workflows
Performance Management
- Resource Monitoring: Track CPU, memory, and network usage
- Execution Time: Monitor workflow completion times
- Success Rates: Track workflow success/failure ratios
- Alert Volume: Monitor and tune alert forwarding rules
- Capacity Planning: Plan for scaling as environment grows
Conclusion
Integrating Wazuh with Shuffle SOAR creates a powerful security automation platform that:
- 🚀 Accelerates Response: Automate immediate responses to security threats
- 📈 Improves Efficiency: Handle more alerts with fewer resources
- 🎯 Reduces Human Error: Consistent, automated response procedures
- 📊 Enhances Visibility: Comprehensive audit trail of all actions
- 🔄 Enables Scalability: Handle growing security event volumes
This integration represents the evolution of security operations from reactive to proactive, enabling security teams to respond at machine speed while maintaining human oversight and control.
Key Takeaways
- Start Simple: Begin with basic workflows and add complexity gradually
- Test Thoroughly: Validate workflows in safe environments before production
- Monitor Continuously: Track performance and effectiveness metrics
- Maintain Security: Protect credentials and audit all actions
- Iterate and Improve: Regularly review and enhance workflows based on results
Resources
Automate your security operations with Wazuh and Shuffle SOAR! 🔄🛡️