Skip to content

cazy8/honey-pot-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿฏ Live Honeypot Server for Attack Pattern Analysis

Azure Ubuntu Cowrie Fail2ban Security

A cloud-deployed, medium-interaction SSH/Telnet honeypot that attracts, detects, logs, and blocks real-world cyberattacks in real time.

Deployed on Microsoft Azure with automated intrusion prevention via Fail2ban โ€” capturing attacker IPs, credentials, and commands for threat intelligence analysis.


๐Ÿ“‹ Table of Contents


๐ŸŽฏ Objective

Deploy a functional honeypot system that can:

Capability Description
Deploy Run on a cloud VM accessible from the public internet
Attract Emulate SSH/Telnet services to lure automated attacks and manual intrusions
Log Capture source IPs, credentials attempted, and commands executed per session
Analyze Identify trends, repeated patterns, and common attack vectors from log data
Block Automatically ban persistent attackers via Intrusion Prevention System (IPS)
Visualize Map attacker geolocations using IP intelligence services

๐Ÿ—๏ธ System Architecture

                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚   INTERNET       โ”‚
                    โ”‚   (Attackers)    โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚  Azure NSG       โ”‚
                    โ”‚  Firewall Rules  โ”‚
                    โ”‚  Port 2222/2223  โ”‚
                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                             โ”‚
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
              โ”‚     Azure VM (B1s)          โ”‚
              โ”‚     Ubuntu 22.04 LTS        โ”‚
              โ”‚                             โ”‚
              โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”     โ”‚
              โ”‚  โ”‚  Cowrie Honeypot   โ”‚     โ”‚
              โ”‚  โ”‚  SSH  โ†’ Port 2222 โ”‚     โ”‚
              โ”‚  โ”‚  Telnet โ†’ Port 2223โ”‚     โ”‚
              โ”‚  โ”‚                    โ”‚     โ”‚
              โ”‚  โ”‚  cowrie.log โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚     โ”‚
              โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚โ”‚     โ”‚
              โ”‚                      โ”‚โ”‚     โ”‚
              โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚โ”‚     โ”‚
              โ”‚  โ”‚   Fail2ban     โ”‚โ—„โ”€โ”˜โ”‚     โ”‚
              โ”‚  โ”‚   IPS Engine   โ”‚   โ”‚     โ”‚
              โ”‚  โ”‚   3 strikes โ†’  โ”‚   โ”‚     โ”‚
              โ”‚  โ”‚   1hr ban      โ”‚   โ”‚     โ”‚
              โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚     โ”‚
              โ”‚                       โ”‚     โ”‚
              โ”‚  Port 22 โ†’ Admin SSH  โ”‚     โ”‚
              โ”‚  (RSA key auth only)  โ”‚     โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜     โ”‚

๐Ÿ› ๏ธ Tech Stack

Component Technology Version Purpose
Cloud Platform Microsoft Azure โ€” VM hosting, public IP, Network Security Groups
Operating System Ubuntu Server 22.04 LTS Stable, secure Linux distribution
Honeypot Cowrie Latest Medium-interaction SSH/Telnet honeypot
IPS Fail2ban Latest Log monitoring, automatic IP banning
Auth RSA Key Pair โ€” Secure admin access (password auth disabled)
Isolation Python venv โ€” Dependency isolation for Cowrie
Visualization IP Geolocation โ€” Attack origin mapping via ipinfo.io

โš™๏ธ Deployment & Configuration

1. Virtual Machine Provisioning

  • Created Ubuntu 22.04 LTS VM (B1s size) on Microsoft Azure
  • Configured secure admin access via RSA private key (password authentication disabled)
  • Assigned public IP for internet-facing honeypot services

2. Firewall Configuration (Azure NSG)

Port Protocol Service Purpose
22/TCP SSH Admin Access Secure management (RSA key only)
2222/TCP SSH Cowrie Honeypot SSH trap for attackers
2223/TCP Telnet Cowrie Honeypot Telnet trap for attackers

3. Cowrie Honeypot Installation

# Create dedicated low-privilege user (principle of least privilege)
sudo adduser --disabled-password cowrie

# Clone and configure Cowrie
git clone https://github.com/cowrie/cowrie.git /home/cowrie/cowrie
cd /home/cowrie/cowrie

# Isolate dependencies in virtual environment
python3 -m venv cowrie-env
source cowrie-env/bin/activate
pip install -r requirements.txt

# Launch honeypot on ports 2222 (SSH) and 2223 (Telnet)
bin/cowrie start

4. Fail2ban Integration (Active Defense)

Custom filter โ€” /etc/fail2ban/filter.d/cowrie.conf:

[Definition]
failregex = ^.*\[HoneyPotSSHTransport,.*,<HOST>\].*login attempt.*failed$
ignoreregex =

Custom jail โ€” /etc/fail2ban/jail.local:

[cowrie]
enabled  = true
port     = 2222
filter   = cowrie
logpath  = /home/cowrie/cowrie/var/log/cowrie/cowrie.log
maxretry = 3
bantime  = 3600

Policy: After 3 failed login attempts โ†’ IP is banned for 1 hour via iptables.


๐Ÿ“Š Log Analysis & Attack Patterns

The honeypot captured hundreds of automated attack attempts within hours of deployment. Analysis commands for the cowrie.log file:

Top Attacker IP Addresses

grep "login attempt" cowrie.log | awk -F'[, ]' '{print $4}' | sort | uniq -c | sort -nr | head -n 10

Top Usernames Attempted

grep "login attempt" cowrie.log | sed 's/.*\[b//;s/\/.*//' | tr -d "'" | sort | uniq -c | sort -nr | head -n 10

Top Passwords Attempted

grep "login attempt" cowrie.log | sed 's/.*\///;s/\].*//' | tr -d "'" | sort | uniq -c | sort -nr | head -n 10

Common Attack Patterns Observed

Pattern Details
Credential Stuffing Automated bots attempting root/admin/test with common passwords
Default Credentials Attempts with factory defaults (admin:admin, root:123456)
Dictionary Attacks Systematic wordlist-based password spraying
Persistence Attempts Repeated connections from the same IP ranges

๐ŸŒ Visualization & Reporting

Attack origin mapping workflow:

  1. Extract unique attacker IPs from Cowrie logs
  2. Geolocate via ipinfo.io API โ†’ latitude/longitude coordinates
  3. Plot on a world map using Google My Maps or Tableau Public
# Extract unique IPs for geolocation
grep "login attempt" cowrie.log | awk -F'[, ]' '{print $4}' | sort -u > attacker_ips.txt

# Geolocate via API
while read ip; do
  curl -s "https://ipinfo.io/$ip/json" >> geo_data.json
done < attacker_ips.txt

๐Ÿ”‘ Key Findings

Metric Observation
Attack Speed Automated scans detected within minutes of deployment
Top Usernames root, admin, test, user, ubuntu
Top Passwords 123456, admin, password, root, 1234
Attack Origins China, Russia, Vietnam, India, Brazil (typical botnet sources)
Fail2ban Blocks Effectively reduced repeated attacks from persistent IPs

๐Ÿ”ฎ Future Scope

Enhancement Description
Splunk/Wazuh Centralized SIEM for real-time log analysis and dashboarding
ELK Stack Elasticsearch + Logstash + Kibana for advanced visualization
Threat Intel Feeds Correlate attacker IPs with known threat intelligence databases
High-Interaction Upgrade to full OS emulation for deeper attacker behavior analysis
Automated Reporting Python scripts for daily attack summary reports

๐Ÿ“„ Documentation

The full project report is available as a PDF in this repository:

  • ELEVATE_LABS_FINAL INTERNSHIP _PROJECT.pdf โ€” Complete internship report with detailed analysis

๐Ÿ‘ค Author

Harsh Gupta โ€” @cazy8 ยท LinkedIn


If you found this useful, consider giving it a โญ

About

Live SSH/Telnet honeypot deployed on Microsoft Azure with Cowrie and Fail2ban IPS. Captures real-world attack patterns, credentials, and attacker geolocations for threat intelligence analysis.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors