<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Gibin K John on Medium]]></title>
        <description><![CDATA[Stories by Gibin K John on Medium]]></description>
        <link>https://medium.com/@gibinkjohnofficial?source=rss-5fa42d777a8d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*n3PZ2vZuCHLFraAkdBe96Q.jpeg</url>
            <title>Stories by Gibin K John on Medium</title>
            <link>https://medium.com/@gibinkjohnofficial?source=rss-5fa42d777a8d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 18:34:24 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gibinkjohnofficial/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Creating Custom Wazuh Dashboard [DL Series-8]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/creating-custom-wazuh-dashboard-dl-series-7-9d4cf73e316f?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9d4cf73e316f</guid>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[sysmon]]></category>
            <category><![CDATA[suricata]]></category>
            <category><![CDATA[cyber]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Sun, 26 Jan 2025 12:36:42 GMT</pubDate>
            <atom:updated>2025-01-26T13:01:37.344Z</atom:updated>
            <content:encoded><![CDATA[<p>As we conclude the <em>Detection Lab</em> series, we arrive at an essential component of effective threat detection and analysis: building a custom Wazuh dashboard. This chapter ties together the insights and configurations from previous articles, providing a centralized, intuitive, and actionable view of your security environment.</p><h3>Why Customize Your Dashboard?</h3><p>A well-designed dashboard does more than display data; it simplifies decision-making. With custom visualizations, security teams can:</p><ul><li><strong>Focus on critical alerts</strong>: Highlight high-priority threats and anomalies.</li><li><strong>Improve response time</strong>: Enable quick access to actionable data.</li><li><strong>Streamline workflows</strong>: Reduce noise and provide clear insights into specific metrics.</li></ul><h3>Prerequisites</h3><p>Before diving into customization, ensure you have:</p><ul><li>A functional Wazuh environment.</li><li>Logs flowing from multiple sources, such as Linux, macOS, Windows, or network monitoring tools like Suricata.</li></ul><p>If you’ve followed the series, you should already have these components in place.</p><h3>Planning Your Dashboard</h3><p>Before creating visualizations, identify your key performance indicators (KPIs). Some useful metrics include:</p><ul><li><strong>Agent Status</strong>: Number of connected/disconnected agents.</li><li><strong>Threat Trends</strong>: Frequency and types of alerts over time.</li><li><strong>Source-Specific Insights</strong>: Custom views for o365, SSH, or Suricata logs.</li></ul><h3>Let me take you through 3 dashboards that I created for this detection lab series.</h3><h4>1. High &amp; Critical Alerts Dashboard</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yc02s6220i4DMOaJBG1CSg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8awQ7fn4oP7xtLcj0-bmqw.png" /></figure><p>This dashboard focuses on high-severity and critical-severity alerts that require immediate attention. It includes the following visualizations to ensure comprehensive monitoring:</p><ul><li><strong>EPS Count (Gauge): </strong>This gauge visualizes the average Events Per Second (EPS) count. It provides a real-time overview of log activity, helping identify baseline performance and potential anomalies.</li><li><strong>Top 3 Agents by Log Count (Pie Chart): </strong>By highlighting the top three agents with the highest log counts, this chart helps pinpoint potential sources of unusual activity during EPS spikes.</li><li><strong>Event — Location (Stacked Bar Chart): </strong>This visualization categorizes events by location, offering valuable context for investigating EPS spikes and tracking region-specific activities.</li><li><strong>Disconnected &amp; Active Agents (Metric): </strong>A quick status of count of disconnected and active agents, aiding in operational monitoring and ensuring system coverage.</li><li><strong>High Alerts and Critical Alerts (Data Table):</strong> Displays alerts with rule levels categorized as high (10–12) and critical (13–15). This table ensures that no critical alerts are missed and security analysts can quickly identify the most severe issues.</li><li><strong>Successful Login: Non-Native (Critical)</strong> and <strong>O365 Successful Login: Non-Native (Critical) (Data Table): </strong>These actionable tables flag critical non-native logins. They are vital for detecting unauthorized access via SSH and O365, helping identify account compromise scenarios promptly.</li><li><strong>Discover Tab: </strong>This tab provides the ability to dive deeper into specific alerts, facilitating targeted investigations and allowing precise filtering of data for detailed analysis.</li></ul><h4>2. SSH Events Dashboard</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aKAxBCrJd_zRBTYA-i4a8w.png" /></figure><p>This dashboard focuses on monitoring SSH-related events to enhance security and detect potential unauthorized access attempts. It includes the following visualizations to provide comprehensive oversight of SSH activity:</p><ul><li><strong>Login Attempts: Non-native GeoLocation (Pie Chart)</strong>: Identifies login attempts originating from non-native geolocations, highlighting potential threats.</li><li><strong>Successful Login: Non-Native (Critical) (Data Table)</strong>: Lists critical successful login events from non-native locations, aiding in quick identification of account compromises.</li><li><strong>Login Attempts: Top 10 Usernames (Pie Chart)</strong>: Displays the most frequently targeted usernames, helping identify brute force attempts.</li><li><strong>Top IPs of Successful Logins (Bar Chart)</strong>: Highlights IP addresses responsible for successful logins, providing insights into potentially suspicious sources.</li><li>• <strong>SSH Alerts (Data Table)</strong>: Consolidates all alerts related to SSH activities for centralized monitoring and efficient incident response.</li></ul><h4>3. O365 Compromise Detection</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iUJFFjd0IxXaisQ5Q65zRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mnk7FlzlDJcxSvY0GgKqrg.png" /></figure><p>This dashboard is designed to detect and investigate potential compromises within O365 environments. It includes the following visualizations to provide clear insights into activities and alerts:</p><ul><li><strong>Event Timeline (Vertical Bar)</strong>: Maps key O365 operations — such as UserLoggedIn, ModifyFolderPermissions, and FileAccessed — on a timeline to simplify the analysis of post-compromise activities.</li><li><strong>O365 Triggered Alerts (Data Table)</strong>: Lists all triggered alerts for centralized and efficient monitoring of suspicious activities.</li><li><strong>Failed &amp; Success Logon Details (Data Table)</strong>: Captures details of failed and successful logon attempts, assisting in the identification of unauthorized access.</li><li><strong>Discover Tab</strong>: Highlights important fields like DeviceProperties.Value and ExtendedProperties.Value, which are essential for investigating unauthorized access facilitated by agents like Raccoon and Axios.</li></ul><h3>Like this, you can custom build dashboards as per your use cases. Like this, we come to the end of Detection Lab.</h3><h3>Acknowledgments</h3><p>I want to express my gratitude to those who made this series possible:</p><ul><li><strong>Ashish Bansal</strong>: For motivating me to initiate this project.</li><li><strong>Santiago Bassett</strong>: CEO of Wazuh, for providing this powerful tool.</li><li><strong>The Wazuh Community</strong>: For the extensive documentation and invaluable support.</li><li><strong>Microsoft</strong>: For making Sysmon available for Linux.</li><li><strong>The Open Information Security Foundation (OISF)</strong>: For the high-performance network IDS, IPS, and network security monitoring engine, Suricata.</li><li><strong>My Readers</strong>: Thank you for following along on this journey.</li></ul><h3>Final Thoughts</h3><p>I hope this <em>Detection Lab</em> series inspires and helps cybersecurity aspirants and professionals broaden their knowledge of the defensive side of the cyber world. Together, we can enhance our skills, contribute to the community, and build a safer digital environment.</p><p>Check out the links to the complete series in this article here: <a href="https://medium.com/@gibinkjohnofficial/how-a-missed-opportunity-inspired-my-detection-lab-journey-b2c1a4ad836f?source=user_profile_page---------0-------------5fa42d777a8d---------------">How a Missed Opportunity Inspired My Detection Lab Journey</a></p><p>Feel free to connect with me for any discussions related to cybersecurity — I would love to learn more and exchange ideas with you. Let’s keep growing and pushing the boundaries of what’s possible!</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9d4cf73e316f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Suricata Log Parsing using jq [DL Series-7]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/parsing-json-logs-with-jq-dl-series-7-5e6512ef5d07?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/5e6512ef5d07</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[jq]]></category>
            <category><![CDATA[wazuh]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Fri, 24 Jan 2025 19:32:52 GMT</pubDate>
            <atom:updated>2025-01-25T07:08:03.646Z</atom:updated>
            <content:encoded><![CDATA[<p>In this seventh part of the ‘Detection Lab’ series, we focus on the powerful JSON parsing tool jq. Logs are the backbone of any security monitoring system, and efficiently parsing them is essential for actionable insights. In this article, you will learn the basics of jq, understand its role in log parsing for security engineers, and apply it to Suricata logs. By the end, you’ll have a firm grasp of using jq to extract meaningful data from JSON logs to enhance your security operations workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NqzvY4FaOy6CyziPNCDxew.png" /></figure><h3>What is jq?</h3><p>jq is a lightweight and flexible command-line tool for processing JSON data. It allows you to parse, filter, transform, and extract specific information from complex JSON structures. For security engineers, working with tools like Wazuh, Suricata, or Sysmon, which produce JSON-formatted logs, jq becomes indispensable.</p><h4>How Can jq Help a Security Engineer?</h4><ul><li><strong>Efficient Analysis:</strong> Extract meaningful information quickly from large datasets, such as identifying the source IP from a bulk log file.</li><li><strong>Custom Queries:</strong> Focus on fields relevant to specific incidents or investigations.</li><li><strong>Integration: </strong>Seamlessly integrate with scripts or monitoring pipelines. For example, jq can be used in active response scripts to dynamically process JSON data, such as extracting file paths from VirusTotal alerts for automated remediation.</li><li><strong>Log Verification:</strong> Check if logs are properly collected and contain the expected fields. For instance, use jq &#39;has(&quot;alert&quot;)&#39; to verify the presence of an alert field in the log data.</li></ul><p>To install jq:</p><pre>sudo apt-get install jq</pre><h4>Basics of jq</h4><p>jq works by applying filters to JSON data. Here’s a simple breakdown of how it works:</p><pre>jq [options] &#39;filter&#39; &lt;input_file&gt;</pre><p>• <strong>[options]</strong>: Optional flags that modify how jq works (e.g., -c for compact output).</p><p>• <strong>‘filter’</strong>: The jq filter used to select or modify data.</p><p>• <strong>&lt;input_file&gt;</strong>: The file or data being processed.</p><h3><strong>Using jq for Parsing Suricata Log Sample</strong></h3><blockquote><strong>Selecting Events Containing Alerts</strong></blockquote><pre>jq -c &#39;select(.alert)&#39; /var/log/suricata/eve.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wxP6FyAw4BP02KaLkSfvUQ.png" /></figure><blockquote><strong>Command Breakdown</strong></blockquote><p>• <strong>jq -c</strong>: Enables compact output, showing each JSON object on a single line.</p><p>• <strong>select(.alert)</strong>: Filters events where the .alert field exists.</p><p>• <strong>/var/log/suricata/eve.json</strong>: The Suricata log file being parsed.</p><p>This extracts all events that include alert-related information, such as signatures and timestamps.</p><blockquote><strong>Filtering TLS Events with Matching Subject and Issuer DN</strong></blockquote><pre>jq &#39;select(.event_type==&quot;tls&quot; and .tls.subject==.tls.issuerdn)&#39; /var/log/suricata/eve.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rmew4kRFZZNjDypBtZEtUw.png" /></figure><blockquote><strong>Command Breakdown</strong></blockquote><p>• <strong>select(.event_type==”tls”)</strong>: Filters events where event_type is tls.</p><p>• <strong>.tls.subject==.tls.issuerdn</strong>: Ensures that the certificate’s subject matches the issuerdn, indicating a self-signed certificate.</p><p>This identifies potential anomalies where certificates are self-issued.</p><blockquote><strong>Finding Established SSH Flows</strong></blockquote><pre>jq &#39;select(.event_type==&quot;flow&quot; and .flow.state==&quot;established&quot; and .flow.age&lt;1800 and .app_proto==&quot;ssh&quot;)&#39; /var/log/suricata/eve.json</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WQEdH_lDsKbWb-SsZY83ig.png" /></figure><blockquote><strong>Command Breakdown</strong></blockquote><ul><li><strong>select(.event_type==”flow”)</strong>: Filters for flow-related events.</li><li><strong>.flow.state==”established”</strong>: Matches established connections.</li><li><strong>.flow.age&lt;1800</strong>: Filters flows active for less than 30 minutes.</li><li>.<strong>app_proto==”ssh”</strong>: Identifies flows using the SSH protocol.</li></ul><p>This identifies active and recent SSH connections, detecting ongoing or unauthorized access.</p><blockquote><strong>Detecting Dshield Alerts</strong></blockquote><pre>jq -c &#39;select(.event_type==&quot;alert&quot;)&#39; /var/log/suricata/eve.json | jq -c &#39;select(.alert.signature | contains(&quot;Dshield&quot;))&#39;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XmwoNdDteNmfXN4HWUlokw.png" /></figure><p><strong>Command Breakdown</strong></p><p>• <strong>select(.alert.signature | contains(“Dshield”))</strong>: Matches alerts where the signature contains the word “Dshield.”</p><p>This identifies alerts related to Dshield, a threat intelligence source, enabling detection of potential malicious activity.</p><blockquote><strong>Counting Alerts by Source IP</strong></blockquote><pre>jq -c &#39;select(.event_type==&quot;alert&quot; and .signature==&quot;ET DROP Dshield Block Listed Source group 1&quot;)&#39; /var/log/suricata/eve.json | jq .src_ip | sort | uniq -c</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jPT1pe7L-L4vsrXt5OHObw.png" /></figure><blockquote><strong>Command Breakdown</strong></blockquote><p>• <strong>.signature==”ET DROP Dshield Block Listed Source group 1&quot;</strong>: Matches specific alerts.</p><p>• <strong>jq .src_ip</strong>: Extracts the src_ip field from the matched events.</p><p>• <strong>sort | uniq -c</strong>: Counts occurrences of each unique source IP.</p><p>This identifies the frequency of specific alert activity by source IP, highlighting patterns of malicious sources.</p><blockquote><strong>Avoiding Null or Empty Alert Signatures</strong></blockquote><pre>jq &#39;.alert.signature | select(.!=null)&#39; /var/log/suricata/eve.json | uniq -c</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P-E7_qN1NsgncfBs5veWeQ.png" /></figure><blockquote><strong>Command Breakdown</strong></blockquote><p>• <strong>select(.!=null)</strong>: Ensures only non-null values are included.</p><p>This identifies meaningful alert signatures, filtering out irrelevant or incomplete data.</p><blockquote><strong>Investigating Specific Alert Details</strong></blockquote><pre>jq -r &#39;select(.alert.signature == &quot;ET CINS Active Threat Intelligence Poor Reputation IP group 28&quot;) |<br>       .timestamp + &quot; &quot; + .src_ip + &quot; &quot; + (.src_port | tostring) + &quot; &quot; + .dest_ip + &quot; &quot; + (.dest_port | tostring) + &quot; &quot; + .alert.signature&#39; /var/log/suricata/eve.json | while read line; do<br>    read timestamp sip dip sp dp signature &lt;&lt;&lt;$(echo $line);     <br>    echo &quot;timestamp = $timestamp --- srcip = $sip --- dstip = $dip --- srcport = $sp --- dstport = $dp --- signature = $signature&quot;; <br>done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GId7WIYDolpq21W2E59B-w.png" /></figure><blockquote><strong>Command Breakdown</strong></blockquote><p><strong>Part 1: Using jq to Extract Data</strong></p><p>This function filters the events to only include those where the alert signature matches “ET CINS Active Threat Intelligence Poor Reputation IP group 28.”</p><p>The part .timestamp + “ “ + .src_ip + “ “ + (.src_port | tostring) + “ “ + .dest_ip + “ “ + (.dest_port | tostring) + “ “ + .alert.signature formats the output by combining key fields for investigation. The src_port and dest_port are converted into strings using the | tostring pipe to ensure the port numbers are treated as text.</p><p><strong>Part 2: Piping the Output to while read Loop</strong></p><blockquote><strong>| while read line; do</strong></blockquote><p>The output from the previous jq command is passed into this while loop. The loop processes each line of the input one by one.</p><p>• <strong>read line</strong>: Reads a single line of input into the variable line.</p><blockquote><strong>read timestamp sip dip sp dp signature &lt;&lt;&lt;$(echo $line)</strong></blockquote><p>This line splits the contents of $line into multiple variables.</p><p>• <strong>read timestamp sip dip sp dp signature</strong>: Reads and assigns the space-separated values from $line to the variables timestamp, sip(source IP), dip (destination IP), sp (source port), dp (destination port), and signature.</p><p>• <strong>&lt;&lt;&lt;$(echo $line)</strong>: This syntax sends the contents of $line to the read command. The &lt;&lt;&lt; operator feeds the string into read, effectively splitting it based on spaces.</p><blockquote><strong>echo “timestamp = $timestamp — — srcip = $sip — — dstip = $dip — — srcport = $sp — — dstport = $dp — — signature = $signature”;</strong></blockquote><p>This prints out the values of the variables in a readable format, making the output easy to interpret.</p><p>• It uses the echo command to format and print the values of the variables with labels (e.g., timestamp, srcip, dstip, etc.), showing the data for each alert.</p><blockquote><strong>done</strong></blockquote><p>This marks the end of the while loop. Once all lines have been processed, the loop ends, and the script finishes executing.</p><blockquote><strong>Investigating Specific Alert Details — Download in .csv</strong></blockquote><pre>jq -r &#39;select(.alert.signature == &quot;ET CINS Active Threat Intelligence Poor Reputation IP group 28&quot;) |<br>       .timestamp + &quot; &quot; + .src_ip + &quot; &quot; + (.src_port | tostring) + &quot; &quot; + .dest_ip + &quot; &quot; + (.dest_port | tostring) + &quot; &quot; + .alert.signature&#39; /var/log/suricata/eve.json &gt;&gt; suricata_alerts.csv | while read line; do<br>    read timestamp sip dip sp dp signature &lt;&lt;&lt;$(echo $line);     echo &quot;timestamp = $timestamp --- srcip = $sip --- dstip = $dip --- srcport = $sp --- dstport = $dp --- signature = $signature&quot;; done</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RVuhsXR9upLxxuZLaEqEsw.png" /></figure><p>This will download the result in suricata_alerts.csv.</p><h3>Conclusion</h3><p>jq is an invaluable tool for security engineers dealing with JSON logs. By mastering its syntax and capabilities, you can streamline log parsing, reduce noise, and focus on actionable data.</p><blockquote><strong><em>Upcoming</em></strong></blockquote><p>In the next article of the <em>Detection Lab</em> series, we’ll dive into creating a customized Wazuh dashboard that transforms logs into meaningful insights. Whether you’re new to Wazuh or looking to enhance your existing setup, this article will guide you through configuring dashboards to visualize security events, streamline monitoring, and drive more effective incident response. Stay tuned as we unlock the full potential of Wazuh’s visualization tools!</p><p><strong>Check out the next article here:</strong> The post will be available on 26/01/2025. <em>Stay tuned!</em></p><p>Feel free to ask questions or share your feedback in the comments section — I’d love to hear from you! You can also connect with me on <a href="https://www.linkedin.com/in/gibinkjohn/"><strong>Gibin John</strong></a> to to clarify any doubts or continue the conversation.</p><p>Follow my Medium profile to stay updated on the full series: <a href="https://medium.com/@gibinkjohnofficial"><strong>Gibin John</strong></a>.</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5e6512ef5d07" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Suricata Integration with Wazuh[DL Series-6]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/suricata-integration-with-wazuh-dl-series-6-cfc959141eb2?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfc959141eb2</guid>
            <category><![CDATA[jq]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[suricata]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Thu, 23 Jan 2025 18:54:51 GMT</pubDate>
            <atom:updated>2025-01-25T07:09:06.326Z</atom:updated>
            <content:encoded><![CDATA[<p>Welcome to the 6th part of our Detection Lab(DL) series. In this article, we’ll explore Suricata, a powerful open-source intrusion detection and prevention system (IDS/IPS), and its integration into and its integration into Wazuh.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MOiS4YZjjfZjFKkg7bjOZQ.png" /></figure><h4>What is Suricata?</h4><p>Suricata is a high-performance, versatile, and open-source network threat detection engine developed by the Open Information Security Foundation (OISF). It functions as an intrusion detection system (IDS), intrusion prevention system (IPS), and network security monitoring (NSM) tool. Suricata is widely adopted for its ability to analyze network traffic in real-time, inspect protocols, and detect malicious activities using predefined rule sets.</p><h4>Key Features of Suricata</h4><ol><li><strong>Versatile IDS/IPS Functionality</strong>: Suricata functions as both an Intrusion Detection System (IDS) and an Intrusion Prevention System (IPS), providing real-time threat detection and the ability to block attacks based on predefined rules.</li><li><strong>SSL/TLS Traffic Inspection, File Transfer Monitoring, and DNS Traffic Analysis</strong>: Suricata also performs deep inspection of SSL/TLS encrypted traffic, monitors file transfer protocols like FTP, SMB, and HTTP for malicious activity, and analyzes DNS traffic to identify malicious domain queries, preventing data exfiltration and DNS-based attacks.</li><li><strong>Network Security Monitoring (NSM)</strong>: With full pcap capture support, Suricata provides in-depth traffic analysis, allowing security teams to monitor network activity thoroughly and investigate incidents with precision.</li><li><strong>Automatic Protocol Detection</strong>: Suricata can automatically identify various protocols like HTTP on any port, enhancing its ability to detect malware and Command-and-Control (C&amp;C) communications, even if attackers try to disguise them.</li><li><strong>Comprehensive Logging and Forensics</strong>: Suricata logs detailed HTTP requests, TLS/SSL exchanges, and DNS activities. It also supports file extraction from network flows, enabling further analysis for potential threats.</li></ol><h4>Installing and Configuring Suricata in the Detection Lab</h4><p>In our Detection Lab, we set up Suricata on a Linux endpoint running Ubuntu 22.04. Below are the steps to install and configure Suricata and integrate it with the Wazuh server.</p><blockquote><strong>Step 1: Install Suricata</strong></blockquote><p>First, add the official Suricata repository and install it:</p><pre>sudo add-apt-repository ppa:oisf/suricata-stable<br>sudo apt-get update<br>sudo apt-get install suricata -y</pre><blockquote><strong>Step 2: Download and Apply Emerging Threats Ruleset</strong></blockquote><p>Suricata uses rule sets to detect malicious activities. Download and extract the Emerging Threats ruleset:</p><pre>cd /tmp/ &amp;&amp; curl -LO https://rules.emergingthreats.net/open/suricata-6.0.8/emerging.rules.tar.gz<br>sudo tar -xvzf emerging.rules.tar.gz &amp;&amp; sudo mkdir /etc/suricata/rules &amp;&amp; sudo mv rules/*.rules /etc/suricata/rules/<br>sudo chmod 640 /etc/suricata/rules/*.rules</pre><blockquote><strong>Step 3: Configure Suricata</strong></blockquote><p>Identify your network interface by using this command:</p><pre>ip addr</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rf7TXIyFXKWZSqAEy9gJYA.png" /><figcaption>Sample Output</figcaption></figure><p>Open the suricata.yamlfile</p><pre>vi /etc/suricata/suricata.yaml</pre><p>Make the following changes</p><pre>HOME_NET: &quot;&lt;Linux EP_ip&gt;&quot;<br>EXTERNAL_NET: &quot;any&quot;<br><br>default-rule-path: /etc/suricata/rules<br>rule-files:<br>  - &quot;*.rules&quot;<br><br># Global stats configuration<br>stats:<br>  enabled: yes<br><br># Linux high-speed capture support<br>af-packet:<br>  - interface: enp0s3</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCR6SSFN7O97NICMHGJb1w.png" /></figure><blockquote><strong>Step 4: Enable Suricata Service</strong></blockquote><pre>sudo systemctl daemon-reload<br>sudo systemctl enable suricata.service<br>sudo systemctl start suricata.service</pre><blockquote><strong>Step 5: Configure Wazuh to Monitor Suricata Logs</strong></blockquote><p>Edit the Wazuh agent configuration file to read Suricata’s logs by adding the following configuration snippet:</p><pre>vi /var/ossec/etc/ossec.conf</pre><pre>&lt;localfile&gt;<br>    &lt;log_format&gt;json&lt;/log_format&gt;<br>    &lt;location&gt;/var/log/suricata/eve.json&lt;/location&gt;<br>&lt;/localfile&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vrqZ8nntED1-KTu4uqya9w.png" /></figure><p>Restart Wazuh agent</p><pre>sudo systemctl restart wazuh-agent.service</pre><h4>Test the Setup</h4><blockquote>Verify Suricata Installation</blockquote><p>To confirm that Suricata is running and logging events, use the following command to tail the fast.log file:</p><pre>tail -f /var/log/suricata/fast.log</pre><p>You should see output similar to below snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQNS8nAAISY0XNXUayhhRQ.png" /></figure><blockquote>Check Logs in the Wazuh Dashboard</blockquote><p>Navigate to the Wazuh dashboard and go to the <strong>Discover</strong> section. Add the following filter to display Suricata logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-4DDYFfU9ugOMYMlRvrsQ.png" /><figcaption>Searching Suricata Logs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Ln_wWwuSCIceQqqBYv95A.png" /><figcaption>Sample output</figcaption></figure><p>Once filter is applied, you should see Suricata events populated in the Wazuh dashboard as shown in the above snippet, confirming successful integration.</p><blockquote><strong><em>Acknowledgments</em></strong></blockquote><p>I extend my gratitude to the founder of Wazuh for creating an exceptional platform that empowers security professionals with robust monitoring and incident response capabilities. A special acknowledgment also goes to the Open Information Security Foundation (OISF) for developing Suricata, a powerful and versatile tool that has revolutionized network security monitoring and threat detection.</p><blockquote><strong><em>Upcoming</em></strong></blockquote><p>In our next article, we’ll dive into the power of jq — a versatile tool for parsing and processing JSON data. Using the Suricata logs we set up in this article, we’ll learn how to filter, format, and extract critical insights, turning raw logs into actionable intelligence for effective security monitoring.</p><p><strong>Check out the next article here:</strong> <a href="https://medium.com/@gibinkjohnofficial/parsing-json-logs-with-jq-dl-series-7-5e6512ef5d07">Suricata Log Parsing using jq [DL Series-7]</a></p><p>Feel free to ask questions or share your feedback in the comments section — I’d love to hear from you! You can also connect with me on <a href="https://www.linkedin.com/in/gibinkjohn/"><strong>Gibin John</strong></a> to to clarify any doubts or continue the conversation.</p><p>Follow my Medium profile to stay updated on the full series: <a href="https://medium.com/@gibinkjohnofficial"><strong>Gibin John</strong></a>.</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfc959141eb2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SysmonForLinux: Custom Decoders and Rules [DL Series-5]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/sysmonforlinux-custom-decoders-and-rules-dl-series-5-f4e1af318f7c?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f4e1af318f7c</guid>
            <category><![CDATA[cyber-security-awareness]]></category>
            <category><![CDATA[sysmon]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[wazuh-manager]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Thu, 23 Jan 2025 04:20:05 GMT</pubDate>
            <atom:updated>2025-01-23T04:20:05.893Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is Sysmon?</h3><p>Sysmon, short for System Monitor, is a Windows-native system service and device driver. It provides detailed information on process creations, network connections, and changes to file creation time. This information is vital for detecting malicious activities and understanding system behavior in depth. Originally built for the Windows ecosystem, Sysmon has become a staple in endpoint monitoring and threat hunting scenarios.</p><p>With Sysmon for Linux, Microsoft brings the same powerful monitoring capabilities to the Linux platform. It enables security professionals to track process activities and network events.</p><h3>How Sysmon Works on Linux</h3><p>Sysmon for Linux operates using eBPF (Extended Berkeley Packet Filter). eBPF allows developers to run sandboxed programs within the Linux kernel without requiring kernel source code modifications or the loading of additional kernel modules. This design makes Sysmon lightweight and efficient while providing real-time insights into system activities. By leveraging eBPF, Sysmon for Linux can monitor and capture:</p><ul><li>Process creation and termination.</li><li>Network connections.</li><li>File creation and deletion.</li></ul><h3>Installing Sysmon for Linux</h3><p>In our Detection Lab, we set up Sysmon on a Linux endpoint running Ubuntu 22.04.</p><h4>Register Microsoft Key and Feed</h4><pre>wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor &gt; microsoft.asc.gpg<br>sudo mv microsoft.asc.gpg /etc/apt/trusted.gpg.d/<br>wget -q https://packages.microsoft.com/config/debian/11/prod.list<br>sudo mv prod.list /etc/apt/sources.list.d/microsoft-prod.list</pre><h4>Modify Permissions for the Key</h4><pre>sudo chown root:root /etc/apt/trusted.gpg.d/microsoft.asc.gpg<br>sudo chown root:root /etc/apt/sources.list.d/microsoft-prod.list</pre><h4>Install Sysmon for Linux</h4><pre>sudo apt-get install apt-transport-https<br>sudo apt-get update<br>sudo apt-get install sysmonforlinux</pre><h4>Configure Sysmon</h4><pre>vim /opt/sysmon/config.xml</pre><p>Paste the following configuration:</p><pre>&lt;Sysmon schemaversion=&quot;4.22&quot;&gt;<br>  &lt;EventFiltering&gt;<br>    &lt;!-- Event ID 1 == ProcessCreate. Log all newly created processes --&gt;<br>    &lt;RuleGroup name=&quot;&quot; groupRelation=&quot;or&quot;&gt;<br>      &lt;ProcessCreate onmatch=&quot;exclude&quot;/&gt;<br>    &lt;/RuleGroup&gt;<br><br>    &lt;!-- Event ID 3 == NetworkConnect Detected. Log all network connections --&gt;<br>    &lt;RuleGroup name=&quot;&quot; groupRelation=&quot;or&quot;&gt;<br>      &lt;NetworkConnect onmatch=&quot;exclude&quot;/&gt;<br>    &lt;/RuleGroup&gt;<br><br>    &lt;!-- Event ID 5 == ProcessTerminate. Log all processes terminated --&gt;<br>    &lt;RuleGroup name=&quot;&quot; groupRelation=&quot;or&quot;&gt;<br>      &lt;ProcessTerminate onmatch=&quot;exclude&quot;/&gt;<br>    &lt;/RuleGroup&gt;<br><br>    &lt;!-- Event ID 9 == RawAccessRead. Log all raw access read --&gt;<br>    &lt;RuleGroup name=&quot;&quot; groupRelation=&quot;or&quot;&gt;<br>      &lt;RawAccessRead onmatch=&quot;exclude&quot;/&gt;<br>    &lt;/RuleGroup&gt;<br><br>    &lt;!-- Event ID 10 == ProcessAccess. Log all open process operations --&gt;<br>    &lt;RuleGroup name=&quot;&quot; groupRelation=&quot;or&quot;&gt;<br>      &lt;ProcessAccess onmatch=&quot;exclude&quot;/&gt;<br>    &lt;/RuleGroup&gt;<br><br>    &lt;!-- Event ID 11 == FileCreate. Log every file creation --&gt;<br>    &lt;RuleGroup name=&quot;&quot; groupRelation=&quot;or&quot;&gt;<br>      &lt;FileCreate onmatch=&quot;exclude&quot;/&gt;<br>    &lt;/RuleGroup&gt;<br><br>    &lt;!-- Event ID 23 == FileDelete. Log all files being deleted --&gt;<br>    &lt;RuleGroup name=&quot;&quot; groupRelation=&quot;or&quot;&gt;<br>      &lt;FileDelete onmatch=&quot;exclude&quot;/&gt;<br>    &lt;/RuleGroup&gt;<br>  &lt;/EventFiltering&gt;<br>&lt;/Sysmon&gt;</pre><h4>Validate the Configuration File</h4><p>Run the following command to validate and apply the configuration file:</p><pre>sysmon -accepteula -i /opt/sysmon/config.xml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HvEDmdVGn_o_fXFf2lEx0g.png" /></figure><h4>Test Sysmon Installation</h4><p>Check the logs to ensure Sysmon is running:</p><pre>grep -i sysmon /var/log/syslog</pre><p>You should see output similar to the following snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xSCJ2f_KsrvDIoK-Z4NmWA.png" /></figure><p>By following these steps, you can successfully install and configure Sysmon for Linux.</p><p>Now that we’ve set up SysmonForLinux on our Ubuntu endpoint, let’s focus on integrating it with Wazuh. By default, while SysmonForLinux logs events in real time to the syslog file, Wazuh can’t parse these logs because there is no default decoder for SysmonForLinux. <em>As illustrated in the snippet of the ruleset test below, no decoder is found.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P5twzZNeuOJJZoqToefSFg.png" /></figure><p>To address this, we will add a custom decoder for SysmonForLinux and custom rules to trigger Sysmon events.</p><p><strong>Steps to Integrate SysmonForLinux Logs</strong></p><h4>Add custom decoder</h4><p>The custom decoder allows Wazuh to understand the structure of SysmonForLinux logs by matching specific fields using regex. Here’s a brief explanation of the setup process:</p><p>→ Log into to Wazuh dashboard.</p><p>→ Click the menu icon (☰) in the upper-left corner to open the navigation menu. From the menu, select <strong>‘Decoders’</strong>.</p><p>→ Click on <strong>‘Add new decoders file’</strong> to create a new file for the decoder. Name the file <strong>sysmonforlinux.xml</strong>.</p><p>→ Copy and paste the decoder configuration from the <a href="https://raw.githubusercontent.com/OpenSecureCo/Demos/main/linux-sysmon.xml">GitHub repository</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_MBBpt9C-T6IKsJcBXDjfQ.png" /></figure><p>→ Save the file and restart the Wazuh Manager.</p><blockquote><strong>Explaining the SysmonForLinux Decoder</strong></blockquote><pre>&lt;decoder name=&quot;sysmon-linux&quot;&gt;  --&gt;<br>  &lt;program_name&gt;sysmon&lt;/program_name&gt;<br>&lt;/decoder&gt;</pre><ul><li>&lt;decoder name=”sysmon-linux”&gt;: This is the base decoder named sysmon-linux, which acts as a foundation for parsing Sysmon logs.</li><li>&lt;program_name&gt;sysmon&lt;/program_name&gt;: This specifies that logs with the program name sysmon should be matched to this decoder.</li></ul><pre>&lt;decoder name=&quot;sysmon-linux-child&quot;&gt;<br>  &lt;parent&gt;sysmon-linux&lt;/parent&gt;<br>  &lt;regex offset=&quot;after_parent&quot;&gt;\pEventID\p(\d+)\p/EventID\p&lt;/regex&gt;   <br>  &lt;order&gt;system.eventId&lt;/order&gt;<br>&lt;/decoder&gt;</pre><ul><li><strong>&lt;decoder name=”sysmon-linux-child”&gt;</strong>: This defines a child decoder, inheriting the base decoder’s configuration.</li><li><strong>&lt;parent&gt;sysmon-linux&lt;/parent&gt;</strong>: It specifies that this decoder is a child of the sysmon-linux decoder.</li><li><strong>&lt;regex offset=”after_parent”&gt;\pEventID\p(\d+)\p/EventID\p&lt;/regex&gt;</strong>: Regex is applied after the log has been matched by the parent (sysmon-linux), so the regex will look inside the log for specific details like EventID.</li><li><strong>(\d+)</strong>: \d Matches any digit (0–9). +: Means “one or more” of the preceding character (in this case, digits). and the parentheses() create a <strong>capture group</strong>, meaning the digits matched by \d+ will be captured. <em>For example, if the log contains EventID is 12, the regex would capture 12.</em></li><li>If the value to capture is alphanumeric or contains symbols (such as a GUID), we use a different regex pattern (\.+). The dot (.) in regex acts as a wildcard, matching any character except for whitespace. <em>For example, if the log contains processGuid is {ca2cb1ca-2265–6791–0000–000000000000}, the regex would capture {ca2cb1ca-2265–6791–0000–000000000000}.</em></li></ul><h4><strong>Add Custom Rules</strong></h4><p>Once the logs are decoded, rules are necessary to trigger alerts for specific events.</p><p>→ From the menu (☰), select <strong>‘Rules’</strong>.</p><p>→ Click on <strong>‘Add new rules file’</strong> to create a new file for the sysmon rules. Name the file <strong>sysmonforlinux.xml</strong>.</p><p>→ Copy and paste the rules configuration from the <a href="https://raw.githubusercontent.com/OpenSecureCo/Demos/main/sysmonforlinux-rules.xml">GitHub repository</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UtDWQSPhGwCsBa2JEfZAEg.png" /></figure><p>→ Save the file and restart the Wazuh Manager.</p><blockquote><strong>Explaining the SysmonForLinux rules</strong></blockquote><pre>&lt;group name=&quot;linux,sysmon,&quot;&gt;<br>    &lt;rule id=&quot;200150&quot; level=&quot;10&quot;&gt;<br>        &lt;decoded_as&gt;sysmon-linux&lt;/decoded_as&gt;<br>        &lt;field name=&quot;system.eventId&quot;&gt;\.+&lt;/field&gt;<br>        &lt;group&gt;sysmon_event1&lt;/group&gt;<br>        &lt;description&gt;Sysmon For Linux Event&lt;/description&gt;</pre><ul><li>The parent rule 200150 detects Sysmon for Linux events by matching logs decoded as sysmon-linux, identifying any system.eventId field with one or more characters (\.+), and grouping them under &lt;description&gt;Sysmon For Linux Event&lt;/description&gt;.</li></ul><pre><br>&lt;!--EventID = 1--&gt;<br>    &lt;rule id=&quot;200151&quot; level=&quot;10&quot;&gt;<br>        &lt;if_sid&gt;200150&lt;/if_sid&gt;<br>        &lt;field name=&quot;system.eventId&quot;&gt;^1$&lt;/field&gt;<br>        &lt;description&gt;Sysmon - Event 1: Process creation $(eventdata.image)&lt;/description&gt;<br>        &lt;group&gt;sysmon_event1&lt;/group&gt;<br>        &lt;mitre&gt;<br>         &lt;id&gt;T1204&lt;/id&gt;<br>        &lt;/mitre&gt;<br>        &lt;options&gt;no_full_log&lt;/options&gt;<br>    &lt;/rule&gt;</pre><ul><li><strong>&lt;rule id=”200151&quot; level=”10&quot;&gt;:</strong> The rule ID 200151 uniquely identifies this rule, and the level=”10&quot; specifies the severity of the alert generated when triggered.</li><li><strong>&lt;if_sid&gt;200150&lt;/if_sid&gt;:</strong> The current rule will only execute if the parent rule 200150 has already matched a log entry.</li><li><strong>&lt;field name=”system.eventId”&gt;^1$&lt;/field&gt;:</strong> It specifies a condition where the system.eventId field in the log must exactly match the value 1. The regex ^1$ ensures:</li><li>^ matches the beginning of the string.</li><li>1 matches the character “1”.</li><li>$ matches the end of the string.</li><li><strong>Dynamic Data Insertion</strong>: $(eventdata.image) in the &lt;description&gt; tag is a placeholder that pulls the value from the event’s eventdata.image field, which contains the name or path of the process that was created. This helps in identifying the specific process involved.</li></ul><h3>Validating Sysmon log parsing</h3><ul><li><strong>Verify Decoder: </strong>To ensure the decoder is parsing properly, begin by copying a raw Sysmon log entry from the syslog file on your Ubuntu endpoint. Use the following command to locate the log:</li></ul><pre>grep -i sysmon /var/log/syslog</pre><ul><li><strong>Wazuh’s Ruleset Feature</strong>: Next, use the Wazuh Ruleset Test feature. Paste the copied Sysmon log into the tool and verify that the decoder parses the log correctly. If the decoder is working as expected, you should see results similar to the following snippet.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Oqq11fYpxJZfXqUlFpJIUg.png" /></figure><ul><li><strong>Check Alerts in Discover</strong>: Finally, go to the Discover section in your Wazuh dashboard and search for the following query:</li></ul><pre>decoder.name: &quot;sysmon-linux&quot;</pre><p>If everything is working, you should see alerts similar to the snippet shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U9OYt99BejlHQdcXN6JXEQ.png" /></figure><p>By following these steps, you can successfully ingest Sysmon for Linux logs into Wazuh and trigger alerts for process creation and termination, network connections, or file creation and deletion, which will be helpful in threat-hunting scenarios.</p><blockquote><strong><em>Acknowledgments</em></strong></blockquote><p>I would like to express my sincere gratitude to the wazuh community for their continuous support and valuable contributions. Their knowledge and resources have been immensely helpful in shaping this article.</p><p>Special thanks to <a href="https://www.linkedin.com/in/taylor-walton-b772a6b2/"><strong>Taylor Walton</strong></a> from <a href="https://opensecure.medium.com/about"><strong>OpenSecure</strong></a> for the exceptional and well-explained videos on YouTube. His tutorials have provided invaluable insights that greatly enhanced my understanding of Wazuh Custom Decoders and Rules as well as for creating and sharing custom decoders and rules.</p><blockquote><strong><em>Upcoming</em></strong></blockquote><p>In our next article, we’ll dive deep into Suricata integration with Wazuh, exploring how this powerful intrusion detection and prevention system can enhance your security setup. From configuring Suricata to parsing its alerts with jq.</p><p><strong>Check out the next article here:</strong> The post will be available on 24/01/2025. <em>Stay tuned!</em></p><p>Feel free to ask questions or share your feedback in the comments section — I’d love to hear from you! You can also connect with me on <a href="https://www.linkedin.com/in/gibinkjohn/"><strong>Gibin John</strong></a> to to clarify any doubts or continue the conversation.</p><p>Follow my Medium profile to stay updated on the full series: <a href="https://medium.com/@gibinkjohnofficial"><strong>Gibin John</strong></a>.</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f4e1af318f7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automated Malware Detection and Response with VirusTotal API Integration [DL Series-4]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/automated-malware-detection-and-response-with-virustotal-api-integration-dl-series-4-a95c3092023e?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/a95c3092023e</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cyber-security-awareness]]></category>
            <category><![CDATA[virus-removal]]></category>
            <category><![CDATA[virus]]></category>
            <category><![CDATA[wazuh]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Tue, 21 Jan 2025 16:01:00 GMT</pubDate>
            <atom:updated>2025-01-23T06:44:14.151Z</atom:updated>
            <content:encoded><![CDATA[<h3>What is VirusTotal?</h3><p>VirusTotal is an online tool that scans files and URLs for viruses, worms, trojans, and other types of malware using multiple antivirus engines and website scanners to identify threats. It allows users to submit file hashes for analysis and report viewing, and provides APIs for seamless integration with other tools and workflows.</p><p>VirusTotal offers both free (Public API) and paid (Private API) services. The free version comes with restrictions like 500 requests per day and a limit of 4 requests per minute, which is sufficient for our Detection Lab. <em>The paid version (Private API) provides higher request limits, priority access, and additional features suitable for enterprise use.</em></p><h3>Detecting and Removing Malware Using VirusTotal Integration</h3><h3>Overview</h3><p>Wazuh uses the integrator module to connect to external APIs and alerting tools such as VirusTotal. This integration allows the Wazuh File Integrity Monitoring (FIM) module to monitor a directory for changes and the VirusTotal API to scan the files in the directory. Once VirusTotal flags a file as malicious, Wazuh triggers an active response script to remove it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UA6W-jeerqD9git7wDQ8Ig.png" /></figure><h3>How it works?</h3><blockquote><strong>File Monitoring by Wazuh FIM</strong></blockquote><p>Wazuh FIM (File Integrity Monitoring) is configured to monitor specific directories for changes, such as when a file is added, modified, or deleted and stores the file’s hash.</p><blockquote><strong>Change Detection and Alert Trigger</strong></blockquote><p>When Wazuh detects that a file has been added or modified, it triggers an alert that includes the file hash.</p><blockquote><strong>Sending the File Hash to VirusTotal</strong></blockquote><p>After the alert is triggered, Wazuh sends the file hash to VirusTotal via an HTTP POST request, asking VirusTotal to check its database for the file using the provided hash.</p><blockquote><strong>VirusTotal Database Check</strong></blockquote><p>VirusTotal then checks its database and analyzes the hash to see if it has any previous information on this file (whether it’s been analyzed by any antivirus engines).</p><p>VirusTotal responds with a JSON response containing the reputation of the file:</p><ul><li>Whether the file is clean.</li><li>Whether it has been flagged as malicious by any antivirus engines.</li></ul><blockquote><strong>Wazuh Processes the VirusTotal Response</strong></blockquote><p>Wazuh processes the response from VirusTotal and triggers a corresponding alert. These alerts could be:</p><ul><li><strong>No records found</strong> (i.e., VirusTotal has never seen the file before).</li><li><strong>No positives found</strong> (the file is clean).</li><li><strong>X engines flagged the file</strong> (i.e., the file is flagged as malicious by X number of antivirus engines).</li></ul><blockquote><strong>Active Response — Delete Malicious Files</strong></blockquote><ul><li>If the file is flagged as <strong>malicious</strong> by VirusTotal (e.g., <strong>X engines flagged it</strong> as malicious), Wazuh can take <strong>immediate action</strong> through its <strong>Active Response</strong> feature.</li><li><strong>Wazuh calls the </strong>remove-threat.sh<strong> </strong>script, which is configured to <strong>delete</strong> the malicious file from the system <strong>before it can execute</strong> or cause harm.</li><li>This prevents the file from running or spreading any further on the system, acting as a proactive defense measure.</li></ul><h3>Steps for Integration</h3><blockquote><strong>Step I: Create a VirusTotal Account</strong></blockquote><ol><li>Go to <a href="https://www.virustotal.com/gui/home/upload">VirusTotal</a> and sign up for an account.</li></ol><p>2. Retrieve your API key from your account dashboard.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vP3AFF-n6zju9CXhNlJgag.png" /></figure><blockquote>Step II: Configure Wazuh FIM on Ubuntu Endpoint</blockquote><p>1. Open the Wazuh configuration file.</p><pre>vi /var/ossec/etc/ossec.conf</pre><p>2. Locate the &lt;syscheck&gt; block and ensure &lt;disabled&gt; is set to no. Add the following to monitor the /root directory in real time.</p><pre>&lt;directories realtime=&quot;yes&quot;&gt;/root&lt;/directories&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*54LGyRVRzS6wuclIbrWxTQ.png" /></figure><p>3. Install jq for processing JSON inputs</p><pre>sudo apt update<br>sudo apt -y install jq</pre><p>4. Save the following script as /var/ossec/active-response/bin/remove-threat.sh to remove malicious files:</p><pre>#!/bin/bash<br><br>LOCAL=`dirname $0`;<br>cd $LOCAL<br>cd ../<br><br>PWD=`pwd`<br><br>read INPUT_JSON<br>FILENAME=$(echo $INPUT_JSON | jq -r .parameters.alert.data.virustotal.source.file)<br>COMMAND=$(echo $INPUT_JSON | jq -r .command)<br>LOG_FILE=&quot;${PWD}/../logs/active-responses.log&quot;<br><br>#------------------------ Analyze command -------------------------#<br>if [ ${COMMAND} = &quot;add&quot; ]<br>then<br> # Send control message to execd<br> printf &#39;{&quot;version&quot;:1,&quot;origin&quot;:{&quot;name&quot;:&quot;remove-threat&quot;,&quot;module&quot;:&quot;active-response&quot;},&quot;command&quot;:&quot;check_keys&quot;, &quot;parameters&quot;:{&quot;keys&quot;:[]}}\n&#39;<br><br> read RESPONSE<br> COMMAND2=$(echo $RESPONSE | jq -r .command)<br> if [ ${COMMAND2} != &quot;continue&quot; ]<br> then<br>  echo &quot;`date &#39;+%Y/%m/%d %H:%M:%S&#39;` $0: $INPUT_JSON Remove threat active response aborted&quot; &gt;&gt; ${LOG_FILE}<br>  exit 0;<br> fi<br>fi<br><br># Removing file<br>rm -f $FILENAME<br>if [ $? -eq 0 ]; then<br> echo &quot;`date &#39;+%Y/%m/%d %H:%M:%S&#39;` $0: $INPUT_JSON Successfully removed threat&quot; &gt;&gt; ${LOG_FILE}<br>else<br> echo &quot;`date &#39;+%Y/%m/%d %H:%M:%S&#39;` $0: $INPUT_JSON Error removing threat&quot; &gt;&gt; ${LOG_FILE}<br>fi<br><br>exit 0;</pre><p>5. Set Permissions for the Script:</p><pre>sudo chmod 750 /var/ossec/active-response/bin/remove-threat.sh<br>sudo chown root:wazuh /var/ossec/active-response/bin/remove-threat.sh</pre><p>6. Restart Wazuh Agent:</p><pre>sudo systemctl restart wazuh-agent</pre><blockquote>Step III: Configuration for Wazuh Server</blockquote><ol><li>Add the following cutom rules to /var/ossec/etc/rules/local_rules.xml to alert on file addition/modification in the root directory:</li></ol><pre>&lt;group name=&quot;syscheck,pci_dss_11.5,nist_800_53_SI.7,&quot;&gt;<br>    &lt;rule id=&quot;100200&quot; level=&quot;7&quot;&gt;<br>        &lt;if_sid&gt;550&lt;/if_sid&gt;<br>        &lt;field name=&quot;file&quot;&gt;/root&lt;/field&gt;<br>        &lt;description&gt;File modified in /root directory.&lt;/description&gt;<br>    &lt;/rule&gt;<br>    &lt;rule id=&quot;100201&quot; level=&quot;7&quot;&gt;<br>        &lt;if_sid&gt;554&lt;/if_sid&gt;<br>        &lt;field name=&quot;file&quot;&gt;/root&lt;/field&gt;<br>        &lt;description&gt;File added to /root directory.&lt;/description&gt;<br>    &lt;/rule&gt;<br>&lt;/group&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*q_a_6atPT07sovQ3gS0weQ.png" /></figure><p>2. Open the Wazuh configuration file.</p><pre>vi /var/ossec/etc/ossec.conf</pre><p>3. Add the following configuration</p><blockquote>VirusTotal<strong> </strong>Integration</blockquote><pre>    &lt;integration&gt;<br>        &lt;name&gt;virustotal&lt;/name&gt;<br>        &lt;api_key&gt;&lt;YOUR_VIRUS_TOTAL_API_KEY&gt;&lt;/api_key&gt;<br>        &lt;rule_id&gt;100200,100201&lt;/rule_id&gt;<br>        &lt;alert_format&gt;json&lt;/alert_format&gt;<br>    &lt;/integration&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TEus1nzQLkCdrioPZPsrBg.png" /></figure><blockquote>Enable Active Response</blockquote><pre>&lt;ossec_config&gt;<br>    &lt;command&gt;<br>        &lt;name&gt;remove-threat&lt;/name&gt;<br>        &lt;executable&gt;remove-threat.sh&lt;/executable&gt;<br>        &lt;timeout_allowed&gt;no&lt;/timeout_allowed&gt;<br>    &lt;/command&gt;<br><br>    &lt;active-response&gt;<br>        &lt;disabled&gt;no&lt;/disabled&gt;<br>        &lt;command&gt;remove-threat&lt;/command&gt;<br>        &lt;location&gt;local&lt;/location&gt;<br>        &lt;rules_id&gt;87105&lt;/rules_id&gt;<br>    &lt;/active-response&gt;<br>&lt;/ossec_config&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDPc8DJvd28B1wKv-vJFxQ.png" /></figure><p>4. Add the following custom active response rules to /var/ossec/etc/rules/local_rules.xml</p><pre>&lt;group name=&quot;virustotal,&quot;&gt;<br>    &lt;rule id=&quot;100092&quot; level=&quot;12&quot;&gt;<br>        &lt;if_sid&gt;657&lt;/if_sid&gt;<br>        &lt;match&gt;Successfully removed threat&lt;/match&gt;<br>        &lt;description&gt;$(parameters.program) removed threat located at $(parameters.alert.data.virustotal.source.file)&lt;/description&gt;<br>    &lt;/rule&gt;<br><br>    &lt;rule id=&quot;100093&quot; level=&quot;12&quot;&gt;<br>        &lt;if_sid&gt;657&lt;/if_sid&gt;<br>        &lt;match&gt;Error removing threat&lt;/match&gt;<br>        &lt;description&gt;Error removing threat located at $(parameters.alert.data.virustotal.source.file)&lt;/description&gt;<br>    &lt;/rule&gt;<br>&lt;/group&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3Ra8J9iAyoaVNWnOACKT3w.png" /></figure><p>5. Restart Wazuh Manager:</p><pre>sudo systemctl restart wazuh-manager</pre><h3>Test the Setup — Attack Emulation</h3><p>1. Download an EICAR test file to the /root directory on the Ubuntu endpoint:</p><pre>sudo curl -Lo /root/eicar.com https://secure.eicar.org/eicar.com &amp;&amp; sudo ls -lah /root/eicar.com</pre><p>2. Go to the Wazuh dashboard and type “eicar.com” in the search file. You should see results similar to the following example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UdeHLh0J7IKvXf6NCHkeVg.png" /></figure><p>By following these steps, you can successfully integrate VirusTotal with Wazuh, improving your ability to detect and respond to potential malware threats.</p><blockquote><strong><em>Acknowledgments</em></strong></blockquote><p>I would like to express my sincere gratitude to the wazuh community for their continuous support and valuable contributions. Their knowledge and resources have been immensely helpful in shaping this article.</p><p>A special thanks to <a href="https://www.linkedin.com/in/taylor-walton-b772a6b2/"><strong>Taylor Walton</strong></a> from <a href="https://opensecure.medium.com/about"><strong>OpenSecure</strong></a> for the exceptional and well-explained videos on YouTube. His tutorials have provided invaluable insights that greatly enhanced my understanding of Wazuh and its integration with other tools.</p><blockquote><strong><em>Upcoming</em></strong></blockquote><p>In our next article, we will take a deep dive into integrating Sysmon on a Linux machine, where we’ll walk through creating custom decoder and custom rules to trigger sysmon alerts.</p><p><strong>Check out the next article here:</strong> <a href="https://medium.com/@gibinkjohnofficial/sysmonforlinux-custom-decoders-and-rules-dl-series-5-f4e1af318f7c">SysmonForLinux: Custom Decoders and Rules [DL Series-5]</a></p><p>Feel free to ask questions or share your feedback in the comments section — I’d love to hear from you! You can also connect with me on <a href="https://www.linkedin.com/in/gibinkjohn/"><strong>Gibin John</strong></a> to to clarify any doubts or continue the conversation.</p><p>Follow my Medium profile to stay updated on the full series: <a href="https://medium.com/@gibinkjohnofficial"><strong>Gibin John</strong></a>.</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a95c3092023e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Agent Onboarding and Log Sources [DL Series-2]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/agent-onboarding-and-log-sources-dl-series-2-1b3f37ff6f3d?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b3f37ff6f3d</guid>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[sysmon]]></category>
            <category><![CDATA[audit]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 18:52:19 GMT</pubDate>
            <atom:updated>2025-01-20T03:35:54.647Z</atom:updated>
            <content:encoded><![CDATA[<p>This article dives into the agent onboarding process, including creating agent groups, enrolling agents, and understanding how log sources are managed in Wazuh.</p><blockquote><strong>Agent Groups in Wazuh</strong></blockquote><p>In Wazuh, agent groups are essential for organizing and managing agents. These groups allow administrators to assign agents based on criteria such as role, location, or type of system. By grouping agents, you can centralize management and apply tailored configurations, rules, and policies to different types of systems.</p><p>For instance, you may have separate agent groups for Linux servers, Windows desktops, or critical network infrastructure. This organization streamlines the process of applying specific settings to each group of devices, enhancing security and performance.</p><blockquote><strong>Default Agent Group</strong></blockquote><p>When new agents are enrolled in Wazuh, they are automatically placed into a default group. This “default” group is a general category designed to provide basic monitoring and security configurations until the agent can be assigned to a more specific group based on its role or system type.</p><blockquote><strong>Creating Custom Agent Groups</strong></blockquote><p>To better manage the devices in your environment, you can create customized agent groups based on your specific needs. Here’s how you can do it:</p><p>→ Log into the Wazuh Dashboard using your credentials</p><p>→ Navigate to Endpoint Groups by clicking the menu icon (☰) in the upper-left corner and selecting “Endpoint Groups”</p><p>→ Create a new group</p><p>→ Specify the group name (e.g., “Linux Servers,” “Windows Workstations”)</p><p>→ Save new group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Di-DYE8ivnX8u7SfDu3Ypg.png" /></figure><p>Now, you have successfully created a new agent group, ready for enrollment and assignment.</p><blockquote><strong>Enrolling Agents</strong></blockquote><p>The next step in your Wazuh setup is to deploy and enroll agents to start collecting logs and security data from your endpoints. The process is straightforward, but it requires careful attention to ensure proper communication between agents and the Wazuh Manager.</p><h4><strong>Steps to Enroll an Agent</strong></h4><ul><li>From the Wazuh dashboard, click on the Wazuh icon → Add agent.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HR-hTK4PP2uqF0p5TkCsig.png" /></figure><ul><li>Select the Endpoint on which you want to install the agent (LINUX, WINDOWS, or macOS).</li><li>Enter the Server address (Fill in the Wazuh Manager’s Public IP).</li><li>Assign an agent name (Give a name for your agent).</li><li>Select one or more existing groups (select the custom group you created, or it will be assigned to the default group).</li><li>Run the following commands to download and install the agent (Run the given command in your terminal/PowerShell as admin).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-6gmzQ0hd7XB-cvYipDPxA.png" /></figure><ul><li>Enable the agent service by running the following commands.</li></ul><pre>sudo systemctl daemon-reload<br>sudo systemctl enable wazuh-agent<br>sudo systemctl start wazuh-agent</pre><blockquote><strong>Outbound Connectivity and Ports</strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/874/1*yd8VgSADSIINzS64V1V59Q.png" /></figure><p>Ensure these ports are open in your firewall and properly configured on both the agent and the Wazuh Manager for successful communication.</p><blockquote><strong>Verifying Agent Enrollment</strong></blockquote><p>Once the agent is deployed and service is started, you can verify its enrollment from the Wazuh dashboard. Navigate to the “Endpoints Summary” section, where you should see a list of all enrolled agents, their status, and other relevant information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FaCUnrCpjkrPlvMRc62_Tw.png" /></figure><p>You can verify if logs are being received from the enrolled agents by navigating to the “Discover” section, where you should see incoming logs, as shown in the snippet below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sfFtft7FxOUg6aFrS_PxOA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2S96S-bEmZ80ZcIpFuNjrw.png" /></figure><h3><strong>Monitoring auditd Logs on Ubuntu</strong></h3><p>In addition to the default logs Wazuh collects, such as journald, /var/log/auth.log, and /var/log/dpkg.log, integrating auditd logs adds an extra layer of security monitoring. These logs provide valuable insights into user actions, file access, and system changes, helping detect suspicious activity or unauthorized access.</p><p>Here’s how to set up and monitor auditd logs in Wazuh.</p><blockquote><strong>Install auditd on Ubuntu</strong></blockquote><blockquote>Install auditd</blockquote><pre>sudo apt update<br>sudo apt install auditd</pre><blockquote>Enable and start the service</blockquote><pre>sudo systemctl enable auditd<br>sudo systemctl start auditd<br>sudo systemctl status auditd<br></pre><blockquote><strong>Verify auditd is Working</strong></blockquote><pre>sudo tail -f /var/log/audit/audit.log</pre><p><em>You should see output similar to the following.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f-DA-v5XNvWjIRZ9Fs0fXQ.png" /></figure><blockquote><strong>Configure Wazuh to Collect auditd Logs</strong></blockquote><blockquote>Open the Wazuh agent configuration file</blockquote><pre>sudo vi /var/ossec/etc/ossec.conf</pre><blockquote>Add this section to monitor auditd logs</blockquote><pre>&lt;localfile&gt;<br>    &lt;log_format&gt;audit&lt;/log_format&gt;<br>    &lt;location&gt;/var/log/audit/audit.log&lt;/location&gt;<br>  &lt;/localfile&gt;</pre><p><em>Just like the snippet below.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JNVDsU_VHmWw7Os473kOsg.png" /></figure><blockquote>Save the file and restart the Wazuh agent</blockquote><pre>sudo systemctl restart wazuh-agent</pre><blockquote><strong>Verify Logs in the Wazuh Dashboard</strong></blockquote><ul><li>Go to the <strong>Discover</strong> section in Wazuh dashboard.</li><li>Search for logs from location:&quot;/var/log/audit/audit.log” or decoder.name:”auditd”, and you should see logs similar to the snippet below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T1dDjt-Lgcw19RyMfu2TmQ.png" /></figure><p>We have successfully enrolled agents and onboarded auditd logs, alongside the default logs Wazuh collects, such as journald, /var/log/auth.log, and /var/log/dpkg.log.</p><blockquote>Upcoming</blockquote><p>In the next article, we will learn how to use the vi/vim editor, a handy tool for managing Wazuh configurations and log files throughout this project.</p><p><strong>Check out the next article here:</strong> <a href="https://medium.com/@gibinkjohnofficial/working-with-vi-vim-editor-dl-series-3-110c29f35b53"><strong>Working with vi/vim Editor</strong></a></p><p>Feel free to ask questions or share your feedback in the comments section — I’d love to hear from you! You can also connect with me on <a href="https://www.linkedin.com/in/gibinkjohn/"><strong>Gibin John</strong></a> to to clarify any doubts or continue the conversation.</p><p>Follow my Medium profile to stay updated on the full series: <a href="https://medium.com/@gibinkjohnofficial"><strong>Gibin John</strong></a>.</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b3f37ff6f3d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with vi/vim Editor [DL Series-3]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/working-with-vi-vim-editor-dl-series-3-110c29f35b53?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/110c29f35b53</guid>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[cyber]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Sun, 19 Jan 2025 18:52:18 GMT</pubDate>
            <atom:updated>2025-01-20T03:39:46.828Z</atom:updated>
            <content:encoded><![CDATA[<p>This article dives into the essentials of vi/vim, covering its basics, key commands, and tips to elevate your workflow.</p><p>As a cybersecurity professional, working with configuration files, writing scripts, and parsing logs is an everyday task. Among the many text editors available, <strong>vi/vim</strong> stands out as a powerhouse for its speed, efficiency, and versatility. Whether you’re deploying Wazuh, crafting custom decoders, or tweaking Linux system configurations, mastering vi/vim can significantly enhance your productivity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T-86n_hvAqPri94bxtJW2A.png" /></figure><h3>Why vi/vim?</h3><p>The vi/vim editor is a staple for professionals who work in Unix-based environments. It is:</p><ul><li><strong>Lightweight</strong>: Available on virtually every Unix/Linux system by default.</li><li><strong>Fast</strong>: Operates entirely via the keyboard, ensuring rapid text manipulation.</li><li><strong>Customizable</strong>: Tailored to your needs with plugins and configurations.</li></ul><h3>Getting Started</h3><p>To open a file in vi or vim:</p><pre>vi filename</pre><p>If the file doesn’t exist, it will create a new one.</p><h3><strong>Modes in vi/vim</strong></h3><blockquote><strong>Normal Mode</strong>:</blockquote><p>This is the default mode when you open a file in vi/vim. It allows you to navigate, delete, copy, and paste text.</p><ul><li>h,j,k,l- Move the cursor left, down, up, or right.</li><li>x - Delete a character.</li><li>dd - Delete the current line.</li><li>dG - Delete from the current line to the end of the file.</li><li>yy - Copy (yank) the current line.</li><li>p - Paste after the cursor.</li><li>u - Undo the last change.</li><li>Ctrl + r - Redo undone changes.</li></ul><blockquote><strong>Insert Mode</strong>:</blockquote><p>In this mode, you can type and edit text.</p><p><strong>How to enter</strong>: Press i to insert text before the cursor or a to append text after the cursor.</p><p><strong>How to exit</strong>: Press Esc to return to Normal Mode.</p><blockquote><strong>Visual Mode</strong>:</blockquote><p>This mode is used for selecting text. Once selected, you can perform operations like copy, delete, or indent on the highlighted text.</p><p><strong>How to enter</strong>: Press v for character selection, V for line selection, or Ctrl+v for block selection.</p><p><strong>How to exit</strong>: Press Esc to return to Normal Mode.</p><blockquote><strong>Command Mode</strong>:</blockquote><p>This mode is used to save, quit, and execute commands.</p><p><strong>How to enter</strong>: Press : in Normal Mode.</p><p>• :w — Save the file.</p><p>• :q— Quit the editor.</p><p>• :wq — Save and quit.</p><p>• :q! — Quit without saving.</p><h3><strong>Searching and Replacing</strong></h3><p>To search for a word or phrase, press / in Normal Mode, type the text, and press Enter.</p><pre>/enter-search-item</pre><p>Press n to find the next match and N for the previous.</p><p>To replace a word/phrase in the entire:</p><pre>:%s/old_text/new_text/g</pre><ul><li>% — Applies the replacement to the entire file.</li><li>s — Stands for substitute.</li><li>g — Replaces all occurrences on each line.</li></ul><p><em>Below is a snippet showing an example of this command in action.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*6fZrL15FgckHO_xu6CENcQ.png" /></figure><h3>Split Windows</h3><p>Work with multiple files or views:</p><ul><li>Vertical split: :vsplit filename</li><li>Horizontal split: :split filename</li></ul><p>Switch between splits using Ctrl + w.</p><p>To conclude, I’ve covered the essential commands and usage of vi/vim that are fundamental for managing configurations and text files. While these basics are crucial for day-to-day tasks, vi/vim also offers advanced features that can significantly streamline your workflow. Mastering these tools will make vi/vim an invaluable asset for anyone regularly working with configuration files.</p><blockquote>Upcoming</blockquote><p>In the next article, we will explore API Integration with VirusTotal, where we’ll learn how to leverage its powerful capabilities to enhance our security monitoring and analysis workflow.</p><p><strong>Check out the next article here:</strong> The post will be available on 21/01/2025. <em>Stay tuned!</em></p><p>Feel free to ask questions or share your feedback in the comments section — I’d love to hear from you! You can also connect with me on <a href="https://www.linkedin.com/in/gibinkjohn/"><strong>Gibin John</strong></a> to clarify any doubts or continue the conversation.</p><p>Follow my Medium profile to stay updated on the full series: <a href="https://medium.com/@gibinkjohnofficial"><strong>Gibin John</strong></a>.</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=110c29f35b53" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up a Distributed Wazuh Deployment [DL Series-1]]]></title>
            <link>https://medium.com/@gibinkjohnofficial/setting-up-a-distributed-wazuh-deployment-b2f2759af15a?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2f2759af15a</guid>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[siem]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Sat, 18 Jan 2025 02:52:31 GMT</pubDate>
            <atom:updated>2025-01-20T03:35:15.510Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we’ll explore how to set up a distributed Wazuh deployment with the <strong>Wazuh indexer</strong>, <strong>OpenSearch</strong> <strong>server</strong>, and <strong>OpenSearch dashboard</strong> deployed on three separate servers. I also explain the commands step by step so that people who are just starting out can understand what we are actually doing.</p><h3><strong>Project Prerequisites</strong></h3><p>Below are the servers and endpoints used for this setup, including their specifications and costs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*48PN3hF9oCCVXE1FW6iNWw.png" /></figure><h4>Endpoints</h4><p><strong><em>Linux Endpoints</em></strong></p><p><em>•</em> dev-jack-linux (Ubuntu 24.04 LTS)</p><p>• prod-Amal-linux (Ubuntu 22.04 LTS)</p><p><strong><em>Optional Endpoints</em></strong></p><p>• Windows OS</p><p>• macOS</p><p><em>Note:</em> While Windows and macOS endpoints are optional for this lab, I’ll guide you through the process of onboarding them for those who want to explore a multi-OS environment.</p><p>For this lab, I set up all these servers and linux endpoints using <strong>DigitalOcean Cloud</strong>.</p><p><strong>What is DigitalOcean?</strong></p><p><strong>DigitalOcean</strong> is a cloud platform designed for simplicity and scalability. It allows you to quickly set up virtual servers (called “droplets”) to host applications or projects. For this lab, <strong>DigitalOcean provides a $200 credit valid for 60 days</strong> — plenty to complete the entire Detection Lab setup.</p><p><a href="https://m.do.co/c/fe40670c154d"><strong><em>Click here to sign up and get started right away!</em></strong></a></p><h3><strong>Logical Architecture</strong></h3><p>Moving on to our Detection Lab setup, here’s the logical diagram of the project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4zUKPqwRPtXMyOSwFQxhwg.png" /><figcaption>Logical Diagram</figcaption></figure><p><strong>Understanding the Logical Diagram</strong></p><blockquote>Within this VPC:</blockquote><ul><li><strong>Wazuh Server</strong> acts as the central hub for log ingestion and analysis.</li><li><strong>Indexer</strong> processes the logs into a searchable format.</li><li><strong>Dashboard</strong> visualizes the data for actionable insights.</li></ul><blockquote>Outside VPC:</blockquote><ul><li><strong>Linux, Windows, and macOS Agents</strong> send their logs directly to the Wazuh Server.</li><li><strong>VirusTotal API Integration</strong> allows for automated threat intelligence queries from the Wazuh Server.</li></ul><p><em>We will explore the specifics of these logs and the VirusTotal integration in upcoming articles of this series.</em></p><p><strong>Why Use a VPC?</strong></p><p><strong>&gt; Private Networking:</strong> Ensures secure communication between servers without exposure to the public internet.</p><p><strong>&gt; Improved Performance:</strong> Reduces latency for data flow between the servers.</p><h3><strong>Infrastructure Preparation</strong></h3><blockquote><strong>Step 1: Create the VPC</strong></blockquote><p>Navigate to <strong>Networking &gt; Create VPC</strong> in your DigitalOcean dashboard, select a <strong>Datacenter Region</strong> (e.g., Bangalore), configure the <strong>Private IP Range</strong> as 172.31.0.0/24, name it (e.g., Detection-Lab-VPC), and click <strong>Create</strong>.</p><blockquote><strong>Step 2: Set Up the Servers</strong></blockquote><p>Go to <strong>Create &gt; Droplet</strong> in your DigitalOcean dashboard, select the <strong>Image</strong> (e.g., Ubuntu 24.04 LTS), configure the <strong>Size</strong> as mentioned in the above table, choose the VPC created in Step 1, and assign names to your servers (e.g., Wazuh-Master, OS-Indexer, etc.).</p><h3>Let’s Begin Deployment!</h3><blockquote><strong>Indexer Deployment Process</strong></blockquote><pre>ssh root@inderex.ip</pre><p><strong>1. Certificates Creation</strong></p><blockquote><strong>Download the SSL certificate tool and configuration file</strong></blockquote><pre>curl -sO https://packages.wazuh.com/4.10/wazuh-certs-tool.sh<br>curl -sO https://packages.wazuh.com/4.10/config.yml</pre><p><strong>What it does</strong>: These commands use curl (a tool for downloading files from the internet) to fetch two files:</p><ul><li><strong><em>wazuh-certs-tool.sh</em></strong><em>: A script that generates SSL certificates to secure communication between Wazuh components.</em></li><li><strong><em>config.yml</em></strong><em>: A configuration file where you specify details like node names and IP addresses.</em></li></ul><blockquote><strong>Edit the configuration file</strong></blockquote><pre>vim ./config.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*vTbOmr5rOdk3QONM_hNJGw.png" /><figcaption>config.yml</figcaption></figure><p>Update the name and IP for Wazuh indexer, server, and dashboard nodes as shown in the snippet above.</p><blockquote><strong>Compress the certificates</strong></blockquote><pre>tar -cvf ./wazuh-certificates.tar -C ./wazuh-certificates/ .<br>rm -rf ./wazuh-certificates</pre><p><strong>What it does</strong>:</p><ul><li><strong><em>tar -cvf</em></strong><em>: Compresses all the generated certificates into a single file named wazuh-certificates.tar for easy transfer.</em></li><li><strong><em>rm -rf</em></strong><em>: Deletes the uncompressed folder (wazuh-certificates) after compression to save space and avoid duplication.</em></li></ul><blockquote><strong>Transfer the certificates</strong></blockquote><pre>scp ./wazuh-certificates.tar root@&lt;node-ip&gt;:/root</pre><p><strong>What it does</strong>: <em>Uses scp (secure copy) to send the compressed file to other nodes (server, dashboard). Replace &lt;node-ip&gt; with the actual public IP address of the destination node.</em></p><p><strong>2. Installing and Configuring the Wazuh Indexer</strong></p><blockquote><strong>Install required system packages</strong></blockquote><pre>apt-get install debconf adduser procps gnupg apt-transport-https</pre><p><strong>What it does</strong>: <em>Installs essential tools and libraries:</em></p><ul><li><strong><em>debconf</em></strong><em>: Helps manage package configuration.</em></li><li><strong><em>adduser</em></strong><em>: Allows creating new users (needed by some services).</em></li><li><strong><em>procps</em></strong><em>: Provides tools like ps and top for process monitoring.</em></li><li><strong><em>gnupg and apt-transport-https</em></strong><em>: Enable secure communication when downloading files from the Wazuh repository.</em></li></ul><blockquote><strong>Add the Wazuh GPG key</strong></blockquote><pre>curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import &amp;&amp; chmod 644 /usr/share/keyrings/wazuh.gpg</pre><p><strong>What it does</strong>:</p><p><em>• Downloads the GPG key, which is like a digital signature that ensures the files you download from the Wazuh repository are authentic.</em></p><ul><li><em>The key is stored in /usr/share/keyrings/wazuh.gpg.</em></li></ul><blockquote><strong>Add the Wazuh repository</strong></blockquote><pre>echo &quot;deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main&quot; | tee /etc/apt/sources.list.d/wazuh.list</pre><p><strong>What it does</strong>: <em>Adds the Wazuh repository to your system’s list of package sources. This allows your system to download and install Wazuh software.</em></p><blockquote><strong>Install the Wazuh Indexer package</strong></blockquote><pre>apt-get update<br>apt-get -y install wazuh-indexer</pre><p><strong>What it does</strong>:</p><ul><li><em>Refreshes the list of available packages so your system knows about the new Wazuh repository.</em></li><li><em>Installs the Wazuh Indexer, which is responsible for storing and searching logs.</em></li></ul><blockquote><strong>Edit the configuration file</strong></blockquote><pre>vim /etc/wazuh-indexer/opensearch.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HUNoE1VHR3NrI6cF3sT0nA.png" /><figcaption>opensearch.yml</figcaption></figure><p>Set the network.host to the indexer’s private IP and update node.name to node-1, as shown in the snippet above.</p><p><strong>3. Deploying Certificates</strong></p><blockquote><strong>Create a directory for certificates, Extract and move the certificates</strong></blockquote><p>Run the following commands replacing $NODE_NAME with the name of the Wazuh indexer node (in my case, node-1).</p><pre>mkdir /etc/wazuh-indexer/certs<br>tar -xf ./wazuh-certificates.tar -C /etc/wazuh-indexer/certs/ ./$NODE_NAME.pem ./$NODE_NAME-key.pem ./admin.pem ./admin-key.pem ./root-ca.pem</pre><p><strong>What it does</strong>:</p><ul><li><em>Creates a folder to store the SSL certificates for secure communication.</em></li><li><em>Extracts the certificates for this specific node from the compressed file.</em></li><li><em>Places them in the /etc/wazuh-indexer/certs/ folder.</em></li></ul><blockquote><strong>Rename the certificates</strong></blockquote><pre>mv -n /etc/wazuh-indexer/certs/$NODE_NAME.pem /etc/wazuh-indexer/certs/indexer.pem<br>mv -n /etc/wazuh-indexer/certs/$NODE_NAME-key.pem /etc/wazuh-indexer/certs/indexer-key.pem</pre><p><strong>What it does</strong>: <em>Renames the node’s certificates to a standard name (indexer.pem and indexer-key.pem).</em></p><blockquote><strong>Secure the certificates</strong></blockquote><pre>chmod 500 /etc/wazuh-indexer/certs<br>chmod 400 /etc/wazuh-indexer/certs/*<br>chown -R wazuh-indexer:wazuh-indexer /etc/wazuh-indexer/certs</pre><p><strong>What it does</strong>:</p><ul><li><em>chmod: Sets strict permissions to prevent unauthorized access.</em></li><li><em>chown: Changes the ownership of the files to the Wazuh Indexer service.</em></li></ul><p><strong>4. Start the Wazuh Indexer Service</strong></p><pre>systemctl daemon-reload<br>systemctl enable wazuh-indexer<br>systemctl start wazuh-indexer<br>systemctl status wazuh-indexer</pre><p>• <strong>What it does</strong>:</p><ul><li><em>daemon-reload: Refreshes the system to recognize new or updated services.</em></li><li><em>enable: Ensures the Wazuh Indexer starts automatically on reboot.</em></li><li><em>start: Starts the Wazuh Indexer immediately.</em></li><li><em>status: Displays the running status of the service.</em></li></ul><p><strong>5. Initialize the cluster with new certificates</strong></p><pre>/usr/share/wazuh-indexer/bin/indexer-security-init.sh</pre><p><strong>What it does</strong>: <em>Configures the cluster to use the new SSL certificates, enabling secure communication between nodes.</em></p><p>6. <strong>Testing the Deployment</strong></p><pre>curl -k -u admin:admin https://&lt;WAZUH_INDEXER_Private_IP&gt;:9200</pre><p>You see output similar to the snippet below, confirming that the Wazuh indexer deployment is successful.</p><p><strong>Note:</strong> <em>admin:admin is the default username and password for authentication.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*feXAr33O8JFOFgpK0oDjkw.png" /></figure><blockquote>Wazuh Manager Deployment Process</blockquote><pre>ssh root@manager.ip</pre><ol><li><strong>Installing dependencies &amp; Wazuh Manager</strong></li></ol><pre>apt-get install gnupg apt-transport-https<br>curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import &amp;&amp; chmod 644 /usr/share/keyrings/wazuh.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main&quot; | tee -a /etc/apt/sources.list.d/wazuh.list<br>apt-get update<br>apt-get -y install wazuh-manager<br></pre><p>Here, we install the necessary packages to support secure connections and repository management. Then, we add the Wazuh GPG key, configure the official Wazuh repository, update the package list (just as we do for the Wazuh indexer), and install the Wazuh manager.</p><p><strong>2. Installing and Configuring Filebeat</strong></p><p>Install the Filebeat package &amp; Download the preconfigured Filebeat configuration file</p><pre>apt-get -y install filebeat<br>curl -so /etc/filebeat/filebeat.yml https://packages.wazuh.com/4.10/tpl/wazuh/filebeat/filebeat.yml</pre><blockquote><strong>Edit the Filebeat</strong> <strong>configuration file</strong></blockquote><pre>vim /etc/filebeat/filebeat.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*01npjmDpnT9RnyHyG7fNzA.png" /></figure><p>Set the hosts to {indexer’s private IP}:9200 as shown in the snippet above.</p><blockquote><strong>Create Filebeat Keystore</strong></blockquote><pre>filebeat keystore create<br>echo admin | filebeat keystore add username --stdin --force<br>echo admin | filebeat keystore add password --stdin --force</pre><p><strong>What it does:</strong></p><p><em>This command creates a keystore for Filebeat to securely store sensitive credentials, and then use echo with the — stdin and — force flags to securely add the username and password to the keystore, ensuring they are not stored in plain text.</em></p><blockquote><strong>Download the Wazuh Template for Filebeat</strong></blockquote><pre>curl -so /etc/filebeat/wazuh-template.json https://raw.githubusercontent.com/wazuh/wazuh/v4.10.1/extensions/elasticsearch/7.x/wazuh-template.json<br>chmod go+r /etc/filebeat/wazuh-template.json</pre><p><strong>What it does:</strong></p><p><em>It downloads the Wazuh indexer template for OpenSearch, a fork of Elasticsearch, and saves it to the Filebeat configuration directory, defining the structure for Wazuh logs in OpenSearch.</em></p><blockquote><strong>Install the Wazuh module for Filebeat.</strong></blockquote><pre>curl -s https://packages.wazuh.com/4.x/filebeat/wazuh-filebeat-0.4.tar.gz | tar -xvz -C /usr/share/filebeat/module</pre><p><strong>What it does:</strong></p><p><em>It downloads the Wazuh Filebeat module, which enables Filebeat to collect and forward Wazuh alerts to Opensearch. It extracts the module into the appropriate Filebeat module directory.</em></p><p><strong>3. Deploying Certificates</strong></p><p>Run the following commands replacing $NODE_NAME with the name of the Wazuh server node (in my case, wazuh-1).</p><pre>mkdir /etc/filebeat/certs<br>tar -xf ./wazuh-certificates.tar -C /etc/filebeat/certs/ ./$NODE_NAME.pem ./$NODE_NAME-key.pem ./root-ca.pem<br>mv -n /etc/filebeat/certs/$NODE_NAME.pem /etc/filebeat/certs/filebeat.pem<br>mv -n /etc/filebeat/certs/$NODE_NAME-key.pem /etc/filebeat/certs/filebeat-key.pem<br>chmod 500 /etc/filebeat/certs<br>chmod 400 /etc/filebeat/certs/*<br>chown -R root:root /etc/filebeat/certs</pre><p><strong>4. Configuring the Wazuh Server</strong></p><pre>vim /var/ossec/etc/ossec.conf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ENrZe-PwZve-wpMASoLMpw.png" /></figure><p>Set the &lt;host&gt;://{indexer’s private IP}:9200&lt;/host&gt; as shown in the snippet above.</p><p><strong>5. Start the Wazuh Manager &amp; Filebeat Services</strong></p><pre>systemctl daemon-reload<br>systemctl enable wazuh-manager<br>systemctl start wazuh-manager<br>systemctl enable filebeat<br>systemctl start filebeat</pre><p><strong>6. Testing the Deployment</strong></p><pre>filebeat test output</pre><p>You see output similar to the snippet below, confirming that the Wazuh manager deployment is successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Estip0sPDJNQHmG0DxYcyQ.png" /></figure><blockquote>Wazuh Dashboard Deployment Process</blockquote><pre>ssh root@dashboard.ip</pre><ol><li><strong>Installing dependencies &amp; Wazuh Dashboard</strong></li></ol><pre>apt-get -y install debhelper tar curl libcap2-bin gnupg apt-transport-https<br>curl -s https://packages.wazuh.com/key/GPG-KEY-WAZUH | gpg --no-default-keyring --keyring gnupg-ring:/usr/share/keyrings/wazuh.gpg --import &amp;&amp; chmod 644 /usr/share/keyrings/wazuh.gpg<br>echo &quot;deb [signed-by=/usr/share/keyrings/wazuh.gpg] https://packages.wazuh.com/4.x/apt/ stable main&quot; | tee -a /etc/apt/sources.list.d/wazuh.list<br>apt-get update<br>apt-get -y install wazuh-dashboard</pre><p><strong>2. Configuring the Wazuh dashboard</strong></p><pre>vim /etc/wazuh-dashboard/opensearch_dashboards.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/944/1*lSqgpvdfUpzXU2dAdHrnNQ.png" /></figure><p>Set server.host to 0.0.0.0 to accept all available IP addresses of the host, and update opensearch.hosts to hhtps://{indexer’s private IP}:9200 as shown in the snippet above.</p><p><strong>3. Deploying Certificates</strong></p><p>Run the following commands replacing $NODE_NAME with the name of the Wazuh dashboard node (in my case, dashboard).</p><pre>mkdir /etc/wazuh-dashboard/certs<br>tar -xf ./wazuh-certificates.tar -C /etc/wazuh-dashboard/certs/ ./$NODE_NAME.pem ./$NODE_NAME-key.pem ./root-ca.pem<br>mv -n /etc/wazuh-dashboard/certs/$NODE_NAME.pem /etc/wazuh-dashboard/certs/dashboard.pem<br>mv -n /etc/wazuh-dashboard/certs/$NODE_NAME-key.pem /etc/wazuh-dashboard/certs/dashboard-key.pem<br>chmod 500 /etc/wazuh-dashboard/certs<br>chmod 400 /etc/wazuh-dashboard/certs/*<br>chown -R wazuh-dashboard:wazuh-dashboard /etc/wazuh-dashboard/certs</pre><p><strong>4. Start the Wazuh Dashboard Service</strong></p><pre>systemctl daemon-reload<br>systemctl enable wazuh-dashboard<br>systemctl start wazuh-dashboard</pre><p><strong>5. Configuring wazuh.yml</strong></p><pre>vim /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*h0h_sE4X4GA5_ED-iP1O9g.png" /></figure><p>Set the url to <a href="https://{}/">https://{manager’s private IP}</a> as shown in the snippet above.</p><p><strong>6. Testing the Deployment</strong></p><p>Access the Wazuh web interface with your credentials.</p><pre>https://&lt;WAZUH_DASHBOARD_IP_ADDRESS&gt;</pre><p>Default username: admin &amp; password: admin</p><p>You see a result similar to the snippet below, confirming that the Wazuh dashboard deployment is successful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SOthaHX_5pqVELAMw8cnpQ.png" /></figure><h3>Securing your Wazuh installation</h3><p>On Indexer Server — (<em>ssh root@wazuh-indexer-ip</em>)</p><pre>/usr/share/wazuh-indexer/plugins/opensearch-security/tools/wazuh-passwords-tool.sh --change-all</pre><p><strong>What it does:</strong></p><p><em>It automatically changes the passwords for all Wazuh users in the system. The script output the new passwords (as shown in the snippet)</em> <em>and update the relevant configuration files to reflect the changes.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LzHQks3mkkfILCBL9Yid-A.png" /></figure><p>On Manager Sever — (<em>ssh root@wazuh-manager-ip</em>)</p><pre>curl -sO https://packages.wazuh.com/4.10/wazuh-passwords-tool.sh<br>bash wazuh-passwords-tool.sh --api --change-all --admin-user wazuh --admin-password wazuh</pre><p><strong>What it does:</strong></p><p><em>It automatically changes, displays the output, and updates the passwords for Wazuh API users.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vrT3XhN4ie-UVhtRLcyCZQ.png" /></figure><p>Run the following command to update the admin password in the Filebeat keystore. Replace &lt;ADMIN_PASSWORD&gt; with the random password generated in the first step, as shown in the output above: “INFO: The password for user <strong>admin</strong> is <strong>wcAny.XUwOVWHFy.+7tW9l8gUW1L8N3j</strong>”</p><pre>systemctl restart filebeat</pre><p>On Dashboard Server — (<em>ssh root@wazuh-dashboard-ip</em>)</p><pre>echo &lt;KIBANASERVER_PASSWORD&gt; | /usr/share/wazuh-dashboard/bin/opensearch-dashboards-keystore --allow-root add -f --stdin opensearch.password</pre><p>Run the following command by replacing &lt;KIBANASERVER_PASSWORD&gt; with the password generated in the first step.</p><p>Edit wazuh.yml Update the wazuh.yml configuration file with the .</p><pre>vim /usr/share/wazuh-dashboard/data/wazuh/config/wazuh.yml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/1*G_rtSq5ALLx90NJkNXY86g.png" /></figure><p>Change &lt;WAZUH_WUI_PASSWORD&gt; to the newly generated wazuh-wui password from the second step.</p><pre>systemctl restart wazuh-dashboard</pre><blockquote><strong>Key Takeaway</strong></blockquote><p>“Remember, in any deployment, 20% is about setting things up, and 80% is troubleshooting — and that’s where we truly learn and grow.”</p><blockquote><strong>Acknowledgments</strong></blockquote><p>I want to express my heartfelt gratitude to <a href="https://www.linkedin.com/company/wazuh">Wazuh</a> for creating such an incredible tool that empowers us to enhance security monitoring and management. A special thanks to <a href="https://medium.com/u/2dc328292dcc">Ashish Bansal</a> for the motivation and guidance that inspired this journey.</p><blockquote><strong>Upcoming</strong></blockquote><p>In the next article, we will dive into the process of <em>Agent Onboarding and Log Sources</em>. From connecting Linux, Windows, and macOS agents to configuring various log sources, I’ll guide you step by step to help you set up a comprehensive monitoring environment.</p><p><strong>Check out the next article here:</strong> <a href="https://medium.com/@gibinkjohnofficial/agent-onboarding-and-log-sources-dl-series-2-1b3f37ff6f3d"><strong>Agent Onboarding and Log Sources</strong></a></p><p>Feel free to ask questions or share your feedback in the comments section — I’d love to hear from you! You can also connect with me on <a href="https://www.linkedin.com/in/gibinkjohn/"><strong>Gibin John</strong></a> to to clarify any doubts or continue the conversation.</p><p>Follow my Medium profile to stay updated on the full series: <a href="https://medium.com/@gibinkjohnofficial"><strong>Gibin John</strong></a>.</p><p>#wazuh #WazuhSecurity #CyberDetectionLab #WazuhSIEM #ThreatHunting #CybersecurityLab #Wazuh #SecurityMonitoring #SIEM #IncidentResponse #ThreatDetection #SecurityOps #WazuhDetection #SOCLab #CyberThreatIntel #WazuhAlerting #LogAnalysis #CyberDefense #MalwareDetection #Sysmon #SOCAnalysis</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2f2759af15a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How a Missed Opportunity Inspired My Detection Lab Journey]]></title>
            <link>https://medium.com/@gibinkjohnofficial/how-a-missed-opportunity-inspired-my-detection-lab-journey-b2c1a4ad836f?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b2c1a4ad836f</guid>
            <category><![CDATA[wazuh]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[suricata]]></category>
            <category><![CDATA[sysmon]]></category>
            <category><![CDATA[jquery]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Thu, 16 Jan 2025 07:06:58 GMT</pubDate>
            <atom:updated>2025-01-26T13:02:47.564Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometimes, a missed opportunity isn’t the end — it’s the beginning of something even better.</p><p>A few months ago, I had the opportunity to interview for a Senior SecOps Engineer role at a company in Bangalore. The position was exciting, demanding expertise in SOC engineering, network security, incident response (IR), and CSIRT.</p><p>Coming from a SOC analyst background, I was confident in my ability to handle investigations and IR tasks. But when it came to the engineering aspect of the role, I realized I had only scratched the surface.</p><p>The first-round interviewer was incredibly kind, making me feel comfortable and even providing constructive feedback. I made it to the next round with higher management, focusing on aptitude, logical reasoning, and situation handling. Although the interview went well, I wasn’t selected.</p><p>At first, I felt disheartened. But the story didn’t end there. I got a chance to connect with the first-round interviewer afterward, and he shared something more valuable than a job offer — guidance on what the industry demands and how I could grow.</p><p>That conversation became the turning point for me. I decided to bridge the gap in my skills by working on a project that would challenge and expand my knowledge. And so, <strong>Detection Lab</strong> was born.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OOMBztMlItJs9De27UKfXA.png" /></figure><p>This 8-part series is the culmination of my journey, covering everything I learned along the way:</p><p>• <a href="https://medium.com/@gibinkjohnofficial/setting-up-a-distributed-wazuh-deployment-b2f2759af15a"><strong>Setting Up a Distributed Wazuh Deployment</strong></a>: Step-by-step guidance and challenges.</p><p>• <a href="https://medium.com/@gibinkjohnofficial/agent-onboarding-and-log-sources-dl-series-2-1b3f37ff6f3d"><strong>Agent Onboarding and Log Sources</strong></a>: Onboarding logs from Linux, macOS, and Windows.</p><p>• <a href="https://medium.com/@gibinkjohnofficial/working-with-vi-vim-editor-dl-series-3-110c29f35b53"><strong>Working with vi/vim Editor</strong></a>: Tips and tricks I picked up.</p><p>• <a href="https://medium.com/@gibinkjohnofficial/automated-malware-detection-and-response-with-virustotal-api-integration-dl-series-4-a95c3092023e"><strong>API Integration with VirusTotal</strong></a>: The integration and its value.</p><p>• <a href="https://medium.com/@gibinkjohnofficial/sysmonforlinux-custom-decoders-and-rules-dl-series-5-f4e1af318f7c"><strong>SysmonForLinux: Custom Decoders and Rules</strong></a>: My customizations explained.</p><p>• <a href="https://medium.com/@gibinkjohnofficial/suricata-integration-with-wazuh-dl-series-6-cfc959141eb2"><strong>Suricata Integration</strong></a><strong>: </strong>Setting Up Your Network Intrusion Detection System.</p><p>• <a href="https://medium.com/@gibinkjohnofficial/parsing-json-logs-with-jq-dl-series-7-5e6512ef5d07"><strong>Parsing JSON Logs with jq</strong></a><strong>: </strong>Simplifying Log Analysis.</p><p>• <a href="https://medium.com/@gibinkjohnofficial/creating-custom-wazuh-dashboard-dl-series-7-9d4cf73e316f"><strong>Dashboard Customization</strong></a>: Visualizing insights from data.</p><p>What began as a response to feedback has become a transformational journey. I’m excited to share it with you, and I hope it inspires you to take on challenges and grow in your own way.</p><p><strong>Follow my series to learn more, and let’s grow together.</strong></p><p><em>This is just the beginning of the ‘Detection Lab’ series. In the next article, I’ll guide you through the process of setting up a distributed Wazuh deployment. From planning the architecture to implementing each component, I’ll share detailed steps to help you build a robust deployment.</em></p><p><strong>Check out the next article here:</strong> <a href="https://medium.com/@gibinkjohnofficial/setting-up-a-distributed-wazuh-deployment-b2f2759af15a"><strong>Setting Up a Distributed Wazuh Deployment</strong></a></p><p><strong>Follow my Medium profile to stay updated on the full series:</strong> <a href="https://medium.com/@gibinkjohnofficial">Gibin John</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b2c1a4ad836f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Alert: Unauthorized Access Attempt]]></title>
            <link>https://medium.com/@gibinkjohnofficial/alert-unauthorized-access-attempt-37a5518a9e14?source=rss-5fa42d777a8d------2</link>
            <guid isPermaLink="false">https://medium.com/p/37a5518a9e14</guid>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[cyberattack]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Gibin K John]]></dc:creator>
            <pubDate>Fri, 30 Aug 2024 05:43:41 GMT</pubDate>
            <atom:updated>2024-08-30T05:52:55.399Z</atom:updated>
            <content:encoded><![CDATA[<p>Alert: Unauthorized Access Attempt</p><p>Explanation of the Attack:</p><p>An unauthorized access attempt occurs when someone tries to gain access to a system, network, or file without the proper credentials or permissions. This can be a result of various attack vectors, such as brute-force attacks, where an attacker systematically tries different username and password combinations, or through the exploitation of vulnerabilities that allow bypassing authentication mechanisms.</p><p>Attack Scenario:</p><p>Consider an attacker attempting to gain unauthorized access to a sensitive file on a server by using a brute-force attack on the server’s SSH (Secure Shell) service. The attacker may use automated tools to try thousands of different username and password combinations in rapid succession.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/947/1*cVJELFfm-6zVmO4yNyBe2g.jpeg" /><figcaption>Sample log</figcaption></figure><p>In the above sample logs, you can see multiple failed login attempts from the same IP address (`192.168.1.100`) trying different usernames (`admin`, `root`, `guest`, etc.). This indicates a potential brute-force attack.</p><p>Method to Investigate:</p><p>1. Identify Source of the Attack:<br> - Look for the IP address that is repeatedly attempting to access the system. In the sample log, the IP address `192.168.1.100` is the source.</p><p>2. Check for Successful Access:<br> - Review the logs to see if there was a successful login from this IP address or any other IP addresses that might be involved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*6dGpi3a3PaXvvJkbQWDhgg.jpeg" /><figcaption>Sample log</figcaption></figure><p>3. Review Authentication Logs:<br> - Correlate the time of the failed attempts with any other suspicious activity. This could include examining logs from other services like web applications, databases, or file systems to see if there was any other form of unauthorized access or activity.</p><p>4. Network Traffic Analysis:<br> - Analyze network traffic during the time frame of the attacks. Look for unusual traffic patterns, such as large data transfers or connections to external IPs.</p><p>5. Check for Exploited Vulnerabilities:<br> - If there are signs of successful access, investigate if any known vulnerabilities could have been exploited, such as weak passwords, unpatched software, or misconfigured services.</p><p>Logs to Correlate:</p><p>1. System Authentication Logs (e.g., `/var/log/auth.log`):<br> - These logs contain all authentication attempts, both successful and unsuccessful, across different services (e.g., SSH, sudo, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*CZ5r6L5jPOn5xUfewm5hGQ.jpeg" /><figcaption>Sample log</figcaption></figure><p>2. Application Logs (e.g., `/var/log/httpd/access_log` for Apache):<br> - Look for any suspicious activity or unauthorized access attempts related to web applications or other services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*Z6ed8Ec7KFIvpTgn_o9Qcg.jpeg" /><figcaption>Sample log</figcaption></figure><p>3. Firewall Logs (e.g., `/var/log/iptables.log`):<br> - Check for blocked or allowed connections from the suspicious IP. This can indicate whether the firewall blocked or allowed the traffic during the attack window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*aoPETdeHqqvVFRZvIULabQ.jpeg" /><figcaption>Sample log</figcaption></figure><p>4. Intrusion Detection System (IDS) Alerts:<br> - If an IDS is in place, check for any alerts related to the attack. IDS logs can provide insight into known attack signatures that match the observed behavior.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*5gyJhJNVwuYCZX0QwOCPlA.jpeg" /><figcaption>Sample log</figcaption></figure><p>Conclusion:</p><p>By correlating logs from different sources, an investigator can determine the nature and extent of an unauthorized access attempt. This approach enables a comprehensive investigation, helping to identify potential vulnerabilities and mitigate future risks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=37a5518a9e14" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>