WAZUH - TRIVY
WAZUH - AMBASSADORS
🐳🛡️ Integración de Wazuh con Trivy para la Detección de Vulnerabilidades en Contenedores
En esta práctica se aborda la seguridad en entornos contenerizados, integrando Wazuh con Trivy (Aqua Security) para la detección de vulnerabilidades en imágenes Docker y sistemas en ejecución. El objetivo es identificar riesgos de forma temprana, antes de que estos lleguen a entornos de producción.
El laboratorio se compone de una infraestructura donde Wazuh 4.11 (Manager, Indexer y Dashboard) actúa como plataforma central de monitorización, mientras que un endpoint Ubuntu 24.04 con agente Wazuh y Trivy se encarga de realizar los análisis de seguridad sobre contenedores.
En el lado del SIEM, se crean decoders y reglas personalizadas para interpretar los resultados de Trivy y generar alertas basadas en vulnerabilidades detectadas. Finalmente, se construyen visualizaciones y dashboards en Wazuh Dashboard, permitiendo analizar el estado de seguridad de los contenedores de forma gráfica.
Esta práctica demuestra cómo integrar el análisis de vulnerabilidades dentro de un flujo de monitorización continua y pipelines CI/CD, mejorando significativamente la postura de seguridad.
🧰 Tecnologías empleadas
Wazuh
Wazuh actúa como plataforma SIEM/XDR encargada de:
-
Recopilar resultados de escaneos.
-
Correlacionar eventos.
-
Generar alertas de seguridad.
-
Visualizar vulnerabilidades.
Su flexibilidad permite integrar herramientas externas como Trivy mediante scripts y módulos personalizados.
Trivy (Aqua Security)
Trivy es un escáner de vulnerabilidades moderno que analiza:
-
Imágenes Docker
-
Sistemas de archivos
-
Dependencias de software
-
Configuraciones erróneas
Se basa en bases de datos actualizadas de CVEs y permite detectar:
-
Vulnerabilidades críticas, altas, medias y bajas
-
Paquetes inseguros
-
Configuraciones vulnerables
Docker
Ubuntu 24.04 (Endpoint)
El endpoint Ubuntu actúa como nodo de análisis:
-
Ejecuta Trivy
-
Ejecuta scripts automatizados
-
Envía resultados a Wazuh
Wazuh Dashboard
Permite visualizar los resultados mediante:
-
Discover (exploración de logs)
-
Dashboards personalizados
-
Visualizaciones gráficas
🎯 Objetivos de la práctica
-
Comprender los riesgos asociados a imágenes de contenedores.
-
Desplegar un entorno de análisis con Wazuh y Trivy.
-
Instalar y configurar Docker en el endpoint.
-
Analizar imágenes de contenedores con Trivy.
-
Automatizar escaneos mediante scripts personalizados.
-
Integrar resultados en Wazuh mediante el módulo Command.
-
Crear decoders y reglas personalizadas.
-
Generar alertas basadas en vulnerabilidades.
-
Visualizar resultados en dashboards.
-
Integrar el análisis en procesos de monitorización continua.
🧩 Aspectos clave de la práctica
🔐 Seguridad en contenedores: concepto clave
-
Librerías vulnerables
-
Software desactualizado
-
Dependencias con CVEs conocidos
El problema principal es que estas vulnerabilidades se despliegan junto con el contenedor si no se detectan previamente.
🔍 Escaneo de vulnerabilidades con Trivy
Trivy analiza imágenes identificando:
-
Paquetes instalados
-
Versiones vulnerables
-
CVEs asociados
-
Nivel de severidad
Este análisis permite conocer el riesgo real antes de desplegar un contenedor.
⚙️ Automatización mediante script personalizado
Se desarrolla un script que:
-
Ejecuta escaneos de Trivy
-
Procesa los resultados
-
Genera salida estructurada
Este paso es clave para integrar herramientas externas con Wazuh.
🔗 Integración con Wazuh (Command Module)
Wazuh ejecuta el script de forma automatizada:
-
Recoge resultados del escaneo
-
Los envía al Manager
-
Permite correlación con otros eventos
Esto convierte un escaneo puntual en monitorización continua.
🧠 Decoders y reglas personalizadas
En el Wazuh Manager:
-
Se crean decoders para interpretar la salida de Trivy
-
Se definen reglas que clasifican vulnerabilidades según severidad
Esto permite generar alertas como:
-
Vulnerabilidades críticas
-
Exposición a CVEs conocidos
-
Riesgos en imágenes en uso
📊 Visualización en Wazuh Dashboard
Se construyen:
-
Búsquedas en Discover
-
Visualizaciones por severidad
-
Dashboards personalizados
Esto permite:
-
Analizar tendencias
-
Identificar imágenes más vulnerables
-
Priorizar acciones de mitigación
🔄 Integración en monitorización continua y CI/CD
Uno de los puntos más importantes de la práctica es entender que:
-
El escaneo no debe ser puntual
-
Debe integrarse en pipelines de despliegue
-
Debe ejecutarse de forma recurrente
Esto permite detectar vulnerabilidades antes de producción.
🧪 Validación del flujo completo
Para validar el sistema:
-
Se descargan imágenes Docker.
-
Trivy analiza las imágenes.
-
El script procesa los resultados.
-
Wazuh recoge la información.
-
Se generan alertas basadas en vulnerabilidades.
-
Se visualizan los datos en el dashboard.
Esto confirma el funcionamiento completo del sistema.
🔍 ¿Por qué es importante esta práctica?
-
Cómo detectar vulnerabilidades antes del despliegue
-
Cómo integrar herramientas DevSecOps en un SIEM
-
Cómo automatizar análisis de seguridad
-
Cómo priorizar riesgos basados en severidad
-
Cómo mejorar la postura de seguridad en entornos cloud y contenedores
Es una práctica clave en entornos modernos DevOps y SOC.
✅ Resultados esperados
-
Entorno Wazuh completamente operativo.
-
Endpoint con Docker y Trivy funcionando.
-
Escaneo de imágenes realizado correctamente.
-
Script automatizado ejecutándose.
-
Integración funcional con Wazuh.
-
Alertas generadas según vulnerabilidades.
-
Dashboards mostrando el estado de seguridad.
-
Comprensión completa del flujo:Escaneo → Procesamiento → Detección → Visualización → Monitorización continua
🔗 Enlaces de interés
DOCUMENTACIÓN
⚙️ Estructura de red
🐳🛡️ Integrating Wazuh with Trivy for Container Vulnerability Detection
This practice focuses on improving container security by integrating Wazuh with Trivy (Aqua Security) to detect vulnerabilities in Docker images and runtime environments. The objective is to identify risks early, before they impact production systems.
The lab environment consists of a Wazuh 4.11 deployment (Manager, Indexer, and Dashboard) and an Ubuntu 24.04 endpoint with a Wazuh agent and Trivy installed. This endpoint is responsible for performing vulnerability scans on container images.
The workflow begins with installing Docker and pulling container images for analysis. Trivy is then installed and used to scan these images for vulnerabilities.
A custom bash script is developed to automate Trivy scans and produce structured output. This script is integrated into Wazuh using the Command module, enabling automated execution and centralized result collection.
On the Wazuh server side, custom decoders and rules are created to interpret Trivy output and generate alerts based on detected vulnerabilities.
Finally, the Wazuh Dashboard is used to explore the data through Discover, as well as to build visualizations and dashboards that provide a clear view of container security posture.
This practice demonstrates how to integrate vulnerability scanning into continuous monitoring and CI/CD pipelines, enabling early risk detection and strengthening overall security posture.
This practice focuses on improving container security by integrating Wazuh with Trivy (Aqua Security) to detect vulnerabilities in Docker images and runtime environments. The objective is to identify risks early, before they impact production systems.
The lab environment consists of a Wazuh 4.11 deployment (Manager, Indexer, and Dashboard) and an Ubuntu 24.04 endpoint with a Wazuh agent and Trivy installed. This endpoint is responsible for performing vulnerability scans on container images.
The workflow begins with installing Docker and pulling container images for analysis. Trivy is then installed and used to scan these images for vulnerabilities.
A custom bash script is developed to automate Trivy scans and produce structured output. This script is integrated into Wazuh using the Command module, enabling automated execution and centralized result collection.
On the Wazuh server side, custom decoders and rules are created to interpret Trivy output and generate alerts based on detected vulnerabilities.
Finally, the Wazuh Dashboard is used to explore the data through Discover, as well as to build visualizations and dashboards that provide a clear view of container security posture.
This practice demonstrates how to integrate vulnerability scanning into continuous monitoring and CI/CD pipelines, enabling early risk detection and strengthening overall security posture.
🧰 Technologies Used
Wazuh
Wazuh acts as a SIEM/XDR platform responsible for:
-
Collecting scan results
-
Correlating events
-
Generating security alerts
-
Visualizing vulnerabilities
Its flexibility allows integration with external tools like Trivy through scripts and custom modules.
Wazuh acts as a SIEM/XDR platform responsible for:
-
Collecting scan results
-
Correlating events
-
Generating security alerts
-
Visualizing vulnerabilities
Its flexibility allows integration with external tools like Trivy through scripts and custom modules.
Trivy (Aqua Security)
Trivy is a modern vulnerability scanner capable of analyzing:
-
Docker images
-
Filesystems
-
Software dependencies
-
Misconfigurations
It leverages continuously updated CVE databases to detect:
-
Critical, high, medium, and low vulnerabilities
-
Insecure packages
-
Misconfigurations
Trivy is a modern vulnerability scanner capable of analyzing:
-
Docker images
-
Filesystems
-
Software dependencies
-
Misconfigurations
It leverages continuously updated CVE databases to detect:
-
Critical, high, medium, and low vulnerabilities
-
Insecure packages
-
Misconfigurations
Docker
Docker is used to manage container images and environments.
Container images represent a critical attack surface if they include vulnerable software or outdated dependencies.
Docker is used to manage container images and environments.
Container images represent a critical attack surface if they include vulnerable software or outdated dependencies.
Ubuntu 24.04 (Endpoint)
The Ubuntu endpoint acts as the scanning node:
-
Executes Trivy scans
-
Runs automation scripts
-
Sends results to Wazuh
The Ubuntu endpoint acts as the scanning node:
-
Executes Trivy scans
-
Runs automation scripts
-
Sends results to Wazuh
Wazuh Dashboard
The dashboard provides visualization capabilities through:
-
Discover (log exploration)
-
Custom dashboards
-
Graphical visualizations
The dashboard provides visualization capabilities through:
-
Discover (log exploration)
-
Custom dashboards
-
Graphical visualizations
🎯 Objectives of the Practice
-
Understand risks associated with container images.
-
Deploy a vulnerability analysis environment with Wazuh and Trivy.
-
Install and configure Docker on the endpoint.
-
Scan container images using Trivy.
-
Automate scans with custom scripts.
-
Integrate scan results into Wazuh using the Command module.
-
Create custom decoders and rules.
-
Generate alerts based on detected vulnerabilities.
-
Visualize results using dashboards.
-
Integrate vulnerability scanning into continuous monitoring workflows.
-
Understand risks associated with container images.
-
Deploy a vulnerability analysis environment with Wazuh and Trivy.
-
Install and configure Docker on the endpoint.
-
Scan container images using Trivy.
-
Automate scans with custom scripts.
-
Integrate scan results into Wazuh using the Command module.
-
Create custom decoders and rules.
-
Generate alerts based on detected vulnerabilities.
-
Visualize results using dashboards.
-
Integrate vulnerability scanning into continuous monitoring workflows.
🧩 Key Aspects of the Practice
🔐 Container Security Fundamentals
Containers are not inherently secure.
A container image may include:
-
Vulnerable libraries
-
Outdated software
-
Dependencies with known CVEs
If not analyzed beforehand, these vulnerabilities are deployed alongside the application.
Containers are not inherently secure.
A container image may include:
-
Vulnerable libraries
-
Outdated software
-
Dependencies with known CVEs
If not analyzed beforehand, these vulnerabilities are deployed alongside the application.
🔍 Vulnerability Scanning with Trivy
Trivy analyzes container images by identifying:
-
Installed packages
-
Vulnerable versions
-
Associated CVEs
-
Severity levels
This allows security teams to assess risk before deployment.
Trivy analyzes container images by identifying:
-
Installed packages
-
Vulnerable versions
-
Associated CVEs
-
Severity levels
This allows security teams to assess risk before deployment.
⚙️ Automation with Custom Script
A custom script is developed to:
-
Execute Trivy scans
-
Process results
-
Generate structured output
This step is essential for integrating third-party tools with Wazuh.
A custom script is developed to:
-
Execute Trivy scans
-
Process results
-
Generate structured output
This step is essential for integrating third-party tools with Wazuh.
🔗 Integration with Wazuh (Command Module)
Wazuh executes the script automatically:
-
Collects scan results
-
Sends data to the Manager
-
Enables correlation with other events
This transforms isolated scans into continuous monitoring.
Wazuh executes the script automatically:
-
Collects scan results
-
Sends data to the Manager
-
Enables correlation with other events
This transforms isolated scans into continuous monitoring.
🧠 Custom Decoders and Rules
On the Wazuh Manager:
-
Decoders are created to parse Trivy output
-
Rules classify vulnerabilities based on severity
This enables alerts such as:
-
Critical vulnerabilities
-
Exposure to known CVEs
-
Risk in active container images
On the Wazuh Manager:
-
Decoders are created to parse Trivy output
-
Rules classify vulnerabilities based on severity
This enables alerts such as:
-
Critical vulnerabilities
-
Exposure to known CVEs
-
Risk in active container images
📊 Visualization in Wazuh Dashboard
The dashboard includes:
-
Discover queries
-
Severity-based visualizations
-
Custom dashboards
This enables:
-
Trend analysis
-
Identification of high-risk images
-
Prioritization of remediation efforts
The dashboard includes:
-
Discover queries
-
Severity-based visualizations
-
Custom dashboards
This enables:
-
Trend analysis
-
Identification of high-risk images
-
Prioritization of remediation efforts
🔄 Integration into Continuous Monitoring and CI/CD
A key takeaway from this practice is that vulnerability scanning should not be:
-
A one-time process
-
Manual or isolated
Instead, it should be:
-
Continuous
-
Automated
-
Integrated into CI/CD pipelines
This ensures vulnerabilities are detected before reaching production.
A key takeaway from this practice is that vulnerability scanning should not be:
-
A one-time process
-
Manual or isolated
Instead, it should be:
-
Continuous
-
Automated
-
Integrated into CI/CD pipelines
This ensures vulnerabilities are detected before reaching production.
🧪 End-to-End Validation
To validate the workflow:
-
Docker images are pulled.
-
Trivy scans the images.
-
The script processes results.
-
Wazuh ingests the data.
-
Alerts are generated based on vulnerabilities.
-
Data is visualized in dashboards.
This confirms the full pipeline is operational.
To validate the workflow:
-
Docker images are pulled.
-
Trivy scans the images.
-
The script processes results.
-
Wazuh ingests the data.
-
Alerts are generated based on vulnerabilities.
-
Data is visualized in dashboards.
This confirms the full pipeline is operational.
🔍 Why This Practice Is Important
The adoption of containers has significantly increased, along with associated risks.
This practice demonstrates:
-
How to detect vulnerabilities before deployment
-
How to integrate DevSecOps tools into a SIEM
-
How to automate security analysis
-
How to prioritize risks based on severity
-
How to improve security posture in cloud-native environments
It is highly relevant for modern DevOps, DevSecOps, and SOC environments.
The adoption of containers has significantly increased, along with associated risks.
This practice demonstrates:
-
How to detect vulnerabilities before deployment
-
How to integrate DevSecOps tools into a SIEM
-
How to automate security analysis
-
How to prioritize risks based on severity
-
How to improve security posture in cloud-native environments
It is highly relevant for modern DevOps, DevSecOps, and SOC environments.
✅ Expected Results
-
Fully operational Wazuh environment
-
Endpoint with Docker and Trivy properly configured
-
Successful vulnerability scanning of images
-
Automated script execution
-
Functional integration with Wazuh
-
Alerts generated based on detected vulnerabilities
-
Dashboards displaying security posture
-
Full understanding of the pipeline:
Scan → Process → Detect → Visualize → Continuous Monitoring
-
Fully operational Wazuh environment
-
Endpoint with Docker and Trivy properly configured
-
Successful vulnerability scanning of images
-
Automated script execution
-
Functional integration with Wazuh
-
Alerts generated based on detected vulnerabilities
-
Dashboards displaying security posture
-
Full understanding of the pipeline:
Scan → Process → Detect → Visualize → Continuous Monitoring

Comentarios
Publicar un comentario