Detecting unauthorized processes

Netcat is a computer networking utility that functions as a back-end tool that allows for port scanning and port listening. This POC shows how Wazuh is capable of detecting if Netcat is running on a monitored host.

Check our documentation to learn more about the command monitoring capabilities of Wazuh.


Configure your environment as follows to test the POC.

  1. Add the following configuration block under the <localfile> section of the /var/ossec/etc/ossec.conf file at the monitored CentOS 8 endpoint. This is to periodically get a list of running processes.

            <alias>process list</alias>
            <command>ps -e -o pid,uname,command</command>
  2. Restart the Wazuh agent to load the changes.

    # systemctl restart wazuh-agent
  3. Install Netcat and required dependencies on the CentOS 8 endpoint.

    # yum install nmap-ncat
  4. Add following rules to /var/ossec/etc/rules/local_rules.xml at the Wazuh manager.

    <group name="ossec,">
        <rule id="100050" level="0">
            <match>^ossec: output: 'process list'</match>
            <description>List of running processes.</description>
        <rule id="100051" level="7" ignore="900">
            <match>nc -l</match>
            <description>Netcat listening for incoming connections.</description>

Steps to generate alerts

  1. Log into the monitored CentOS 8 system and run nc -l 8000 for 30 seconds.

Query the alerts

You can visualize the alert data in the Wazuh Kibana plugin. To do this, go to the Security events module and add the filters in the search bar to query the alerts.

  • OR 100051)