Location Research Breakthrough Possible @S-Logix pro@slogix.in

Local Outlier Factor-Based Detection of SSH Brute-Force Attacks Against an Ubuntu SSH Server Using Wazuh Authentication Logs

Description

Organizations commonly use SSH (Secure Shell) to provide encrypted remote access to Linux servers. SSH allows authorized users and administrators to log in remotely and manage server resources. Authentication activity generated by the SSH service provides important security information that can be used to identify suspicious login behavior.

An SSH server may receive repeated authentication attempts from an unauthorized source. If an attacker repeatedly attempts different passwords or credential combinations, the activity may indicate an SSH brute-force attack. Monitoring these authentication events is important for identifying suspicious access attempts and supporting timely security investigation.

Wazuh provides security monitoring capabilities that can collect and analyze authentication events from an Ubuntu Linux server. Its configured rules can identify supported authentication-related conditions, including repeated failed login attempts. However, authentication patterns may vary between environments, and additional anomaly analysis can be evaluated to determine whether it provides useful information beyond existing rule-based detection.

In this use case, an Ubuntu Linux virtual machine hosts the OpenSSH server, while Kali Linux is used as the security-testing environment. Wazuh collects the authentication logs generated by the Ubuntu server. Python and pandas process the collected records and extract numerical features such as failed login counts, authentication frequency, and other available account- or source-related activity.

The Local Outlier Factor (LOF) algorithm, implemented through the scikit-learn library, analyzes the extracted authentication features and identifies observations that differ from the local patterns represented in the reference data. A publicly available security-log or SSH-attack dataset is used for model development and evaluation, while controlled SSH login attempts from Kali Linux provide laboratory evidence for validating the monitoring workflow.

The model's results are compared with the authentication records, available Wazuh alerts, and controlled test activity. Streamlit is used to present suspicious authentication observations, relevant timestamps, available source information, and anomaly results in a dashboard. The findings are reviewed to determine whether the LOF model provides useful additional detection information.

The complete security-monitoring workflow is:

Ubuntu SSH Server → SSH Authentication Activity → Wazuh Authentication Log Collection → Python Feature Extraction → Local Outlier Factor Analysis → Anomaly Identification → Wazuh Alert Correlation → Security Dashboard → Finding Validation → Security Assessment

Existing Security Problem

Application/Service: OpenSSH Server on Ubuntu Linux

OpenSSH is the target remote-access service in this use case. It provides encrypted remote login and administration capabilities for the Ubuntu Linux server.

Existing Problem :

An SSH server may receive repeated login attempts from an unauthorized source. If authentication activity is not adequately monitored, repeated failures and unusual login patterns may be difficult to identify and prioritize for investigation.

Rule-based security monitoring can identify authentication conditions covered by configured detection rules. However, a fixed threshold may not represent every legitimate or suspicious authentication pattern. Additional analysis may help identify observations that differ from the reference behavior, although such observations are not automatically confirmed attacks.

The security problem is:
Ubuntu SSH Server
→
Incoming SSH Login Attempts
→
Repeated or Unusual Authentication Failures
→
Authentication Log Records
→
Potential SSH Brute-Force Activity
→
Detection and Investigation Needs
→
Additional Authentication Anomaly Analysis

The proposed solution introduces Wazuh authentication-log monitoring, Python-based log processing, authentication feature extraction, Local Outlier Factor analysis, correlation with existing Wazuh alerts, dashboard-based investigation, and detection-performance evaluation.

Attack

Specific Attack: SSH Brute-Force Attack

The controlled attack scenario evaluates whether repeated SSH authentication attempts against the authorized Ubuntu laboratory server can be observed in authentication logs and identified as unusual by the LOF-based analysis.

Kali Linux is used as the testing system, and Ubuntu runs the target SSH service. The test is restricted to an isolated laboratory environment and uses a designated test account.

The objective is to generate controlled authentication activity, verify that the relevant events are collected by Wazuh, and assess whether the extracted features enable LOF to identify unusual authentication patterns. The model's output is compared with the recorded activity and available Wazuh alerts.

Attack Behavior :
Kali Linux Testing System
→
Repeated SSH Login Attempts
→
Ubuntu OpenSSH Service
→
Successful or Failed Authentication
→
Ubuntu Authentication Logs
→
Wazuh Event Collection
→
Python Feature Extraction
→
LOF Anomaly Identification
→
Security Finding Validation
→
Investigation and Evaluation

Security Concept

Behavior-Based Authentication Anomaly Detection

The primary security concept is Behavior-Based Authentication Anomaly Detection combined with continuous security monitoring.

The approach analyzes authentication-related features to identify observations that differ from their local reference patterns. Local Outlier Factor estimates the local density of an observation relative to the density of its neighboring observations. It can therefore highlight unusual patterns within the prepared feature space.

Wazuh remains responsible for collecting and monitoring authentication events and generating alerts through its configured detection rules. Python and scikit-learn provide the additional anomaly-analysis stage. LOF results are correlated with the recorded authentication activity and Wazuh alerts rather than being treated as independent confirmation of a brute-force attack.

For scoring new authentication observations, LOF is configured for novelty detection and fitted to suitable reference data before new observations are evaluated. The selected features and preprocessing must remain consistent between model development and subsequent scoring.

The assessment follows:
Authentication Log Collection
→
Data Cleaning and Preparation
→
Authentication Feature Extraction
→
Feature Preprocessing
→
LOF Reference-Data Model Fitting
→
New Authentication Activity Scoring
→
Anomaly Identification
→
Wazuh Alert and Test-Activity Correlation
→
Detection Performance Evaluation
→
Security Finding and Recommendation

Defensive Mechanism

The security concept defines the overall security strategy. The following are the specific defensive mechanisms implemented.

SSH Authentication Log Monitoring :

Wazuh collects and monitors authentication events generated by the Ubuntu SSH service.

Purpose: Maintain visibility into SSH authentication activity and provide evidence for investigation.

Local Outlier Factor Anomaly Detection

LOF analyzes extracted authentication features and identifies observations that differ from their local reference patterns.

Purpose
  • Highlight unusual authentication behavior for further security investigation.

Rule-Based SSH Alerting

Wazuh's configured detection rules identify supported authentication-related conditions, including repeated failures where the relevant rules are enabled.

Purpose
  • Detect known authentication-risk patterns and provide alerts for correlation with model results.

Authentication Feature Analysis

Python and pandas process authentication records and calculate suitable features from available log fields.

Purpose
  • Convert authentication activity into consistent numerical inputs for anomaly detection.

SSH Access-Control Hardening

SSH configuration and account-access requirements are reviewed to reduce unnecessary access and strengthen authentication security.

Purpose
  • Reduce the opportunity for unauthorized SSH access.

Source and Account Activity Review

Authentication records are reviewed for repeated failures against accounts and, where available, repeated activity from source addresses.

Purpose
  • Help investigators identify the accounts and sources associated with suspicious authentication patterns.

Security Finding Validation

LOF results are compared with authentication records, controlled test activity, and available Wazuh alerts.

Purpose
  • Determine whether the identified anomalies are supported by the available security evidence.

Detection Performance Evaluation

The model's results are evaluated against suitable reference labels or documented ground truth where available.

Purpose
  • Assess detection performance and document false positives and missed detections.

Security Event Prioritization

Suspicious observations are reviewed using available timestamps, authentication features, source information, and related alerts.

Purpose
  • Help prioritize authentication events for investigation.

Post-Configuration Validation

Authentication monitoring and controlled access tests are repeated after relevant SSH security improvements.

Purpose
  • Verify that the intended security controls and monitoring workflow continue to function.

Security Tools

Primary Security Monitoring Tool: Wazuh

Wazuh is the primary security monitoring platform because it collects and analyzes supported authentication events from the Ubuntu SSH server and provides alerts through configured detection rules.

Purpose
  • Collect SSH authentication events.
  • Monitor supported authentication-related security conditions.
  • Provide alerts and event evidence for correlation.
  • Support investigation of suspicious login activity.
  • Validate the visibility of controlled test activity.

Machine Learning Tool: Local Outlier Factor (LOF) — scikit-learn

Local Outlier Factor is the machine learning algorithm used to identify observations that differ from their local reference patterns. The scikit-learn implementation supports novelty detection when configured and fitted appropriately for scoring new observations.

Purpose
  • Analyze numerical authentication features.
  • Identify locally unusual authentication observations.
  • Produce anomaly classifications for evaluation.
  • Support comparison with Wazuh alerts.
  • Help assess additional anomaly-detection value.

Programming and Analysis Tool: Python

Python connects the authentication-log processing, feature extraction, model scoring, evaluation, and dashboard components.

Purpose
  • Process collected authentication records.
  • Extract and prepare model features.
  • Apply the fitted LOF model.
  • Correlate model outputs with security events.
  • Support the complete analysis workflow.

Data Processing Tool: pandas

pandas is used to clean, organize, transform, and aggregate authentication records before they are supplied to the LOF model.

Purpose
  • Process authentication records in tabular form.
  • Handle missing values and inconsistent fields.
  • Calculate authentication activity features.
  • Prepare consistent model inputs.
  • Organize results for evaluation.

SSH Testing Tool: OpenSSH Client

The OpenSSH client is used from Kali Linux to generate controlled login attempts against the authorized Ubuntu SSH server.

Purpose
  • Generate controlled SSH authentication activity.
  • Test the authorized laboratory target.
  • Produce observable authentication events.
  • Support verification of the monitoring workflow.

Target Service: OpenSSH Server

OpenSSH Server provides the remote-access service being assessed and generates authentication-related events on the Ubuntu system.

Purpose
  • Provide the SSH authentication endpoint.
  • Record successful and failed login activity.
  • Support controlled authentication testing.
  • Provide evidence for security monitoring.

Target Platform: Ubuntu Linux

Ubuntu provides the server environment hosting OpenSSH and generating authentication logs for Wazuh monitoring.

Purpose
  • Host the SSH service.
  • Maintain authentication-related log records.
  • Provide the controlled target account.
  • Support SSH security-configuration review.
  • Supply event evidence for analysis.

Security Testing Platform: Kali Linux

Kali Linux provides the controlled testing environment used to generate authorized SSH login attempts against the Ubuntu target.

Purpose
  • Perform controlled authentication testing.
  • Execute SSH client requests.
  • Generate test activity for monitoring validation.
  • Support repeatable laboratory assessment.

Dashboard Tool: Streamlit

Streamlit is used to present authentication activity and model outputs through a local security-monitoring dashboard.

Purpose
  • Display suspicious authentication observations.
  • Present anomaly results and relevant timestamps.
  • Show available account and source information.
  • Support review of Wazuh alerts and model results.
  • Present evaluation findings.

Reference Data Source: Publicly Available Security-Log or SSH-Attack Dataset

A suitable publicly available dataset provides reference observations for model development and evaluation. The available fields and any supplied labels must be reviewed before deciding which features and evaluation metrics are appropriate.

Purpose
  • Provide reference authentication observations.
  • Support LOF model development.
  • Enable evaluation where suitable labels or ground truth exist.
  • Help assess model behavior beyond the controlled laboratory activity.

Virtualization Platform: Oracle VirtualBox

VirtualBox provides the isolated laboratory infrastructure for the Ubuntu target and Kali Linux testing system.

Purpose
  • Host Ubuntu Linux.
  • Host Kali Linux.
  • Configure an isolated testing network.
  • Support controlled and repeatable security testing.

Process

STEP 01

Prepare the Isolated SSH Security Monitoring Environment

  • Create an isolated cybersecurity laboratory using VirtualBox.
  • Configure Ubuntu as the SSH server.
  • Configure Kali Linux as the security-testing system.
  • Establish controlled network communication between the virtual machines.
  • Assign and record the laboratory IP addresses.
  • Verify connectivity between Kali Linux and Ubuntu.
  • Confirm that the assessment is restricted to the authorized laboratory.
Tools: VirtualBox + Ubuntu Linux + Kali Linux
STEP 02

Configure the Ubuntu SSH Server

  • Install OpenSSH Server on Ubuntu if it is not already installed.
  • Start the SSH service.
  • Verify that the service is running.
  • Create or designate a controlled laboratory account.
  • Review the SSH service configuration.
  • Confirm that the server can record authentication activity.
  • Record the initial SSH configuration.
Tools: OpenSSH Server + Ubuntu Linux
STEP 03

Configure Wazuh Authentication Monitoring

  • Configure Wazuh monitoring for the Ubuntu server using a supported agent or log-collection method.
  • Verify that the relevant authentication logs are being collected.
  • Review the available SSH authentication events.
  • Check whether the collected records contain the required fields.
  • Review the configured Wazuh rules for repeated authentication failures.
  • Record the initial monitoring status.
Tools: Wazuh + Ubuntu Linux + OpenSSH Server
STEP 04

Establish the Initial Authentication Baseline

  • Generate legitimate SSH login activity using the authorized laboratory account.
  • Review the corresponding authentication records.
  • Identify the fields available in the logs.
  • Record the timestamps and authentication outcomes.
  • Verify that the events are visible in Wazuh.
  • Record the initial authentication behavior for comparison with later test activity.
Tools: OpenSSH Client + Ubuntu Authentication Logs + Wazuh
STEP 05

Prepare the Reference Authentication Dataset

  • Select a suitable publicly available security-log or SSH-attack dataset.
  • Review the dataset structure and available authentication-related fields.
  • Identify the fields that can support the intended feature extraction.
  • Check for missing values, duplicate records, and inconsistent formats.
  • Determine whether suitable reference labels or documented ground truth are available.
  • Record any limitations that may affect model development or evaluation.
Tools: Python + pandas + Publicly Available Security-Log or SSH-Attack Dataset
STEP 06

Generate the Controlled SSH Brute-Force Test Activity

  • Use Kali Linux as the authorized testing system.
  • Generate a limited number of controlled SSH authentication attempts against the Ubuntu laboratory server.
  • Use only the designated laboratory account and target.
  • Observe the authentication responses.
  • Record the test time and expected activity.
  • Avoid excessive requests and testing against external systems.
  • Preserve the information needed to validate the resulting authentication events.
Tools: Kali Linux + OpenSSH Client + Ubuntu SSH Server
STEP 07

Verify Authentication Events in Wazuh

  • Review the Ubuntu authentication logs after the controlled test.
  • Confirm that the expected failed login events are recorded.
  • Verify that Wazuh collects the relevant events.
  • Review any alerts generated by the configured Wazuh rules.
  • Check whether the available fields include timestamps and source information.
  • Record any missing events or parsing problems.
  • Preserve the collected monitoring evidence.
Tools: Wazuh + Ubuntu Authentication Logs + OpenSSH Server
STEP 08

Set Up the Python Analysis Environment

  • Create a dedicated Python environment for the project.
  • Install pandas for authentication-log processing.
  • Install scikit-learn for Local Outlier Factor analysis.
  • Install Streamlit for the monitoring dashboard.
  • Verify that the required libraries can be imported.
  • Organize the project into log processing, feature extraction, model analysis, evaluation, and dashboard components.
  • Confirm that the environment is ready for data preparation.
Tools: Python + pandas + scikit-learn + Streamlit + Ubuntu Linux
STEP 09

Process and Normalize Authentication Records

  • Load the selected reference dataset into the Python processing workflow.
  • Load the collected laboratory authentication records into the same workflow where appropriate.
  • Normalize timestamps and relevant field formats.
  • Handle missing values and duplicate observations according to documented preprocessing rules.
  • Map corresponding fields without assuming that different log formats have identical meanings.
  • Check the consistency of the processed records.
  • Prepare the records for authentication feature extraction.
Tools: Python + pandas + Wazuh Authentication Events
STEP 10

Extract Authentication Features

  • Identify the numerical features required for LOF analysis.
  • Calculate failed login counts within defined time windows where the necessary events are available.
  • Calculate authentication-attempt frequency.
  • Extract successful and failed authentication counts where supported by the data.
  • Extract distinct account or source counts where the required fields are available.
  • Aggregate individual events into consistent observations suitable for anomaly detection.
  • Document the feature definitions and calculations.
Tools: Python + pandas
STEP 11

Prepare the LOF Model Input

  • Select the numerical features for the model.
  • Handle missing or invalid feature values.
  • Apply suitable feature scaling where required.
  • Ensure that the reference data and new observations use the same feature definitions.
  • Verify the order and structure of the model inputs.
  • Keep evaluation labels separate from the model input.
  • Prepare the final feature data for LOF model fitting.
Tools: Python + pandas + scikit-learn
STEP 12

Configure and Fit the Local Outlier Factor Model

  • Configure the scikit-learn Local Outlier Factor algorithm.
  • Select a suitable neighborhood size based on the reference data.
  • Configure novelty detection when the model is intended to score new authentication observations.
  • Fit the model using the prepared reference observations.
  • Verify that model fitting completes successfully.
  • Record the model parameters and preprocessing configuration.
  • Preserve the fitted model for subsequent scoring.
Tools: Python + scikit-learn
STEP 13

Perform Authentication Anomaly Detection

  • Prepare the new authentication observations using the same feature-extraction process.
  • Apply the same preprocessing used for the reference data.
  • Score the new observations using the fitted LOF novelty-detection model.
  • Record the resulting anomaly classifications and relevant score values.
  • Identify the observations flagged as unusual by the configured model.
  • Associate the results with the corresponding authentication records where possible.
  • Treat the model output as an anomaly indicator rather than confirmation of an attack.
Tools: Python + pandas + scikit-learn
STEP 14

Correlate LOF Results with Wazuh Alerts

  • Review the authentication observations flagged by LOF.
  • Identify the corresponding authentication records and timestamps.
  • Review related Wazuh alerts where available.
  • Compare the model results with the controlled test activity.
  • Compare the results with reference labels where suitable labels or ground truth exist.
  • Record cases where LOF and Wazuh produce different detection results.
  • Validate the findings against the available security evidence.
Tools: Python + pandas + scikit-learn + Wazuh
STEP 15

Evaluate Detection Performance

  • Review the model's results against suitable reference labels or documented ground truth where available.
  • Calculate appropriate evaluation metrics when the data supports them.
  • Assess precision, recall, and F1-score where valid ground-truth labels are available.
  • Review false positives and missed detections.
  • Compare LOF results with Wazuh alerts where a meaningful comparison is possible.
  • Record the effects of feature selection and model configuration.
  • Document the limitations of the dataset and evaluation.
Tools: Python + pandas + scikit-learn + Wazuh
STEP 16

Develop the Authentication Monitoring Dashboard

  • Create a local dashboard using Streamlit.
  • Display relevant authentication timestamps and available account information.
  • Display available source information and extracted authentication features.
  • Present LOF anomaly classifications and relevant score values.
  • Display corresponding Wazuh alerts where the required event information is available.
  • Distinguish model-identified anomalies from confirmed security incidents.
  • Present the available evaluation results for review.
Tools: Python + Streamlit + pandas + scikit-learn + Wazuh
STEP 17

Validate the Complete Detection Workflow

  • Repeat the controlled SSH authentication test against the authorized Ubuntu server.
  • Verify that the authentication events are recorded by Ubuntu.
  • Confirm that Wazuh collects the relevant events.
  • Verify that Python extracts the expected authentication features.
  • Confirm that the fitted LOF model scores the prepared observations.
  • Check that the dashboard displays the corresponding model results and available Wazuh alerts.
  • Record missing events, unexpected results, false positives, and processing errors.
  • Preserve the final validation evidence.
Tools: Kali Linux + Ubuntu SSH Server + Wazuh + Python + scikit-learn + Streamlit
STEP 18

Perform Final Security Validation and Advisory Review

  • Review the initial and final authentication-monitoring results.
  • Review the controlled SSH testing evidence.
  • Review the extracted authentication features and LOF configuration.
  • Review the correlation between model results and Wazuh alerts.
  • Review the available evaluation metrics and documented limitations.
  • Identify appropriate SSH configuration and authentication-monitoring improvements.
  • Record any remaining security concerns.
  • Finalize the dashboard evidence and security assessment documentation.
Tools: Wazuh + Python + scikit-learn + Streamlit + Ubuntu Linux

Outcome

The Ubuntu SSH server is configured as the authorized target for the continuous security-monitoring assessment.

Wazuh collects SSH authentication events and provides visibility into authentication-related alerts supported by its configured detection rules.

A publicly available security-log or SSH-attack dataset is prepared for model development and evaluation.

Python and pandas process authentication records and extract the numerical features required for Local Outlier Factor analysis.

The Local Outlier Factor model identifies authentication observations that differ from the local patterns represented in its reference data.

Controlled SSH login attempts from Kali Linux provide laboratory evidence for validating the authentication-monitoring and anomaly-analysis workflow.

LOF results are correlated with authentication records and available Wazuh alerts to support investigation of suspicious login activity.

The Streamlit dashboard presents relevant authentication information, anomaly classifications, available source details, and model evaluation results.

The detection evaluation documents the observed performance, false positives, and missed detections where suitable reference labels or ground truth are available.

The complete SSH Brute-Force Detection assessment, Wazuh authentication monitoring, LOF-based anomaly analysis, security-event correlation, dashboard presentation, and detection-performance evaluation workflow is demonstrated in the isolated laboratory environment.