Structured Session Log Collection
Cowrie session logs are collected and processed into a consistent format before machine-learning analysis.
- Convert raw SSH interaction records into structured data suitable for classification.
SSH (Secure Shell) is a network protocol commonly used to access and manage remote Linux systems. SSH services may be targeted by attackers attempting repeated authentication requests, username and password guessing, and suspicious command interactions after establishing a session.
Cowrie is an SSH honeypot designed to record login attempts and simulated shell interactions. It captures information such as connection details, attempted usernames, authentication outcomes, session identifiers, and commands entered into the simulated environment. These records provide useful evidence for analyzing SSH interaction patterns without exposing a real production shell.
In this use case, Cowrie is deployed on an Ubuntu Linux virtual machine, while Kali Linux is used as the controlled security-testing environment. SSH login attempts and harmless simulated command interactions are generated within an isolated Oracle VirtualBox laboratory. Cowrie records the activity, and Python processes the resulting session logs into structured data.
A publicly available SSH honeypot dataset is used to study existing SSH interaction patterns and support model development and evaluation. The Random Forest classification algorithm is applied to suitable labeled records to classify predefined SSH behavioral categories, such as brute-force-like login activity and suspicious command-interaction activity, where the available labels and features support those distinctions.
The trained model is evaluated using unseen test records and appropriate classification metrics. The predictions are also reviewed alongside controlled Cowrie session records to determine whether the model can identify the predefined behavioral patterns. The model provides behavioral classification results for investigation; it does not independently confirm that a source is malicious.
Publicly Available SSH Honeypot Dataset + Controlled Cowrie Session Logs → Dataset and Log Analysis → Data Preprocessing → Behavioral Feature Extraction → Label Validation → Random Forest Model Training → SSH Behavior Classification → Prediction Validation → Security Evidence Review → Model Performance Evaluation
Application/Service: Cowrie SSH Honeypot
Cowrie is the SSH honeypot service used in this use case. It records controlled SSH login attempts and simulated shell interactions, producing session logs for security analysis.
SSH honeypots can generate numerous records containing authentication attempts, connection metadata, and simulated command interactions. Reviewing these records manually can be time-consuming, particularly when the objective is to distinguish repeated login guessing from other suspicious interaction patterns.
Cowrie provides records of observed activity, but collecting logs alone does not automatically classify each session according to predefined behavioral categories. A separate data-processing and classification workflow is required to extract meaningful features, learn patterns from labeled records, and evaluate the resulting predictions.
The proposed solution introduces Cowrie log collection, publicly available dataset analysis, behavioral feature extraction, Random Forest model training, classification of unseen records, evaluation of prediction accuracy, and evidence-based review of the classified SSH activity.
Specific Attack: SSH Brute-Force Login Attempts and Suspicious Command-Interaction Attempts Against a Cowrie SSH Honeypot
The controlled attack scenario evaluates SSH activity patterns by generating repeated login attempts and harmless simulated command interactions against the Cowrie honeypot in an authorized laboratory.
Kali Linux is used to generate the controlled test activity. Cowrie records the connections, authentication outcomes, and simulated session interactions. These records are processed to identify features that can help distinguish the predefined behavioral categories.
The objective is to assess whether the Random Forest classifier can classify the recorded activity based on patterns learned from labeled data. The assessment is performed only against the user's own isolated laboratory environment; it does not involve attacking a real SSH server.
Machine-Learning-Based SSH Behavioral Classification and Security Validation
The primary security concept is machine-learning-based behavioral classification combined with evidence-based security validation.
The Random Forest algorithm uses multiple decision trees to classify records according to patterns learned from labeled training data. In this use case, suitable features may include login-attempt counts, authentication outcomes, session duration, attempted-username patterns, and command-interaction indicators, depending on the fields available in the dataset and Cowrie logs.
The model is trained using labeled records and evaluated against unseen test records. Precision, recall, F1-score, and a confusion matrix are used to examine classification performance. Controlled Cowrie records provide additional evidence for assessing whether the complete workflow behaves as intended.
The security concept defines the overall approach for analyzing SSH behavior.
The following are the specific defensive mechanisms implemented.
Cowrie is deployed within an isolated Ubuntu virtual machine to capture controlled SSH interactions without exposing a production SSH service.
Cowrie session logs are collected and processed into a consistent format before machine-learning analysis.
Python-based preprocessing checks required fields, handles missing values, identifies duplicate records where appropriate, and validates feature representations.
Relevant features are extracted from the dataset and Cowrie logs according to the fields available and the classification objective.
A Random Forest classifier is trained on labeled records to classify predefined SSH behavioral categories.
The available labeled records are divided into training and testing portions, with suitable grouping where related records could otherwise appear in both sets.
Model predictions are compared with known test labels using precision, recall, F1-score, and a confusion matrix.
Predicted categories are reviewed alongside the original Cowrie session records and the known characteristics of the controlled test scenarios.
Kali Linux generates authorized test interactions against the Cowrie honeypot in the isolated laboratory.
Dataset preparation, selected features, model settings, evaluation metrics, and limitations are recorded.
Cowrie is the primary SSH honeypot because it captures SSH login attempts and simulated shell interactions and generates session logs for analysis.
scikit-learn provides the Random Forest classifier and supporting data-splitting and evaluation utilities required for the machine-learning workflow.
Python is used to integrate Cowrie log processing, dataset preparation, feature extraction, model training, and evaluation.
pandas is used to load, inspect, clean, transform, and organize SSH dataset records and Cowrie logs into tabular structures.
NumPy supports numerical operations and data transformations used during preprocessing and analysis.
Kali Linux provides the controlled security-testing environment used to generate SSH interactions against the Cowrie honeypot.
Ubuntu Linux hosts Cowrie and the supporting components required for session-log collection and analysis.
A publicly available SSH honeypot dataset is used to study existing SSH interaction patterns and support model development and evaluation. The dataset name is not specified in this document.
Oracle VirtualBox provides the isolated virtual-machine environment for Ubuntu Linux and Kali Linux.
Wireshark is used when required to inspect network-level information about controlled SSH connections between Kali Linux and the Cowrie host.
The system identifies SSH login attempts and suspicious command-execution activities recorded in Cowrie honeypot session logs.
Random Forest classifies SSH session behavior into predefined categories using selected behavioral features.
Authentication outcomes and repeated login attempts help identify patterns associated with potential brute-force activity.
Command-related features help identify suspicious command-execution behavior within recorded SSH sessions.
Publicly available SSH honeypot data supports model development and evaluation using appropriately prepared and labeled records.
Python, pandas, NumPy, and scikit-learn support data preprocessing, feature extraction, model training, and classification.
Model performance is evaluated using precision, recall, F1-score, and a confusion matrix to understand classification errors.
Cowrie session logs provide evidence for reviewing login attempts, recorded commands, session behavior, and classification results.
The isolated Ubuntu and Kali Linux environment enables controlled testing of SSH login attempts and harmless command interactions without targeting external systems.
The classification results help security analysts prioritize suspicious SSH sessions for further investigation and improve SSH threat monitoring.