Skip to content

arif-offsec/vmsec

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

β–ˆβ–ˆβ•—   β–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ•—   β–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ•— β–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•β–ˆβ–ˆβ•”β•β•β•β•β•
β–ˆβ–ˆβ•‘   β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β–ˆβ–ˆβ–ˆβ–ˆβ•”β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—  β–ˆβ–ˆβ•‘
β•šβ–ˆβ–ˆβ•— β–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β•šβ–ˆβ–ˆβ•”β•β–ˆβ–ˆβ•‘β•šβ•β•β•β•β–ˆβ–ˆβ•‘β–ˆβ–ˆβ•”β•β•β•  β–ˆβ–ˆβ•‘
 β•šβ–ˆβ–ˆβ–ˆβ–ˆβ•”β• β–ˆβ–ˆβ•‘ β•šβ•β• β–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•‘β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—β•šβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ•—
  β•šβ•β•β•β•  β•šβ•β•     β•šβ•β•β•šβ•β•β•β•β•β•β•β•šβ•β•β•β•β•β•β• β•šβ•β•β•β•β•β•

VM Security Scanner β€” Kali Linux Edition

License: GPL v3 Shell Platform PRs Welcome


What is vmsec?

vmsec is a fully open-source, automated security scanning and remediation tool built specifically for Kali Linux virtual machines.

It integrates 10 scanner modules powered by industry-standard open-source tools (ClamAV, rkhunter, chkrootkit, Lynis, AIDE, auditd, and more) into one unified workflow that:

  1. Scans your VM for viruses, trojans, malware, rootkits, keyloggers, spyware, backdoors, C2 connections, suspicious processes, insecure configurations, and more
  2. Generates a comprehensive, sorted report (plain text + interactive HTML) β€” findings sorted CRITICAL β†’ LOW, suggestions sorted MUST-DO β†’ OPTIONAL
  3. Remediates β€” auto-fix or manually fix findings, then auto-apply or manually apply suggestions

Note: vmsec is designed for Kali Linux VMs. Many Kali tools (Metasploit, Aircrack-ng, etc.) will trigger false positives in antivirus scanners. vmsec accounts for this β€” its auto-remediator only touches files in safe locations (/tmp, /var/tmp, ~/Downloads) and never blindly deletes system binaries.


Quick Start

# 1. Clone the repository
git clone https://github.com/arif-offsec/vmsec.git
cd vmsec

# 2. Run the installer
sudo bash install.sh

# 3. Install all security tools
sudo vmsec install

# 4. Run your first full scan
sudo vmsec scan

That's it. vmsec will scan, report, and walk you through fixing anything it finds.


Features

Feature Description
πŸ” 10 scanner modules Modular, independently runnable scanners
🦠 Malware detection ClamAV with auto-updated virus definitions
πŸ› Rootkit detection rkhunter + chkrootkit (two independent engines)
⌨️ Keylogger detection Process monitoring, /dev/input access, LKM checks
🌐 Network scanning Open ports, C2 connections, ARP poisoning, DNS hijacking
πŸ“‹ Cron audit Detects malicious persistence via cron jobs
πŸ“ Filesystem checks SUID/SGID audit, AIDE integrity, suspicious files
πŸ‘€ User audit UID-0 backdoors, SSH keys, sudo misconfig, empty passwords
βš™οΈ Service audit Dangerous/unnecessary services, firewall status
πŸ“Š Dual reports Sorted text report + dark-theme interactive HTML report
πŸ”§ Auto-remediation Safe, priority-ordered auto-fix with path restrictions
πŸ–±οΈ Manual remediation One-by-one interactive review of every finding
πŸ’‘ Suggestions Auto-apply MUST-DOs or review one by one
πŸ“– Man page Full man vmsec documentation
βš™οΈ Configurable Edit conf/vmsec.conf to tune behaviour

All Commands

sudo vmsec install              # Install all security tools
sudo vmsec update               # Update all tools + definitions

sudo vmsec scan                 # Full scan (all 10 modules)
sudo vmsec scan --quick         # Quick scan (ClamAV, rkhunter, processes, network)
sudo vmsec scan --module NAME   # Run one specific module

vmsec report                    # Print last report to terminal
vmsec report --html             # Open HTML report in browser

sudo vmsec fix --auto           # Auto-fix all findings (CRITICAL first)
sudo vmsec fix --manual         # Review and fix findings one by one

sudo vmsec suggest --auto       # Auto-apply all MUST-DO suggestions
sudo vmsec suggest --manual     # Review suggestions one by one

vmsec list-modules              # List all scanner modules
vmsec version                   # Show version
man vmsec                       # Full manual page

Scanner Modules

Module Tools Used Detects
clamav ClamAV Viruses, trojans, malware files
rkhunter rkhunter Rootkits, backdoors, hidden files
chkrootkit chkrootkit Rootkits (different engine), LKM, sniffers
lynis Lynis Full system audit, hardening index, config warnings
processes ps, lsof, unhide Keyloggers, crypto miners, hidden processes, suspicious LKMs
network ss, iptables, arp Open ports, C2 connections, DNS hijacking, ARP poisoning, promiscuous mode
crontabs bash Malicious cron persistence, reverse shells, obfuscated commands
filesystem find, aide, stat SUID/SGID, world-writable files, recently modified binaries, AIDE integrity
users getent, passwd, sshd UID-0 backdoors, empty passwords, NOPASSWD sudo, SSH misconfig
services systemctl Dangerous services (Telnet/RSH/TFTP), unnecessary services, missing auditd/fail2ban

Integrated Open-Source Tools

All tools are free, open-source, and installed from Kali's official apt repository.

Tool License What it does
ClamAV GPL v2 Virus and malware scanner β€” maintained by Cisco Talos
rkhunter GPL v2 Rootkit, backdoor, and local exploit scanner
chkrootkit BSD-like Rootkit scanner with different detection engine
Lynis GPL v3 Comprehensive system security audit by CISOfy
AIDE GPL v2 File integrity monitoring β€” detects any unauthorized changes
auditd GPL v2 Linux kernel audit daemon β€” logs all system activity
UFW GPL v3 Uncomplicated Firewall β€” manages iptables rules
fail2ban GPL v2 Blocks brute-force login attempts automatically
unhide GPL v3 Detects processes hidden by rootkits
nethogs GPL v2 Real-time per-process network bandwidth monitor
ss / lsof / netstat GPL Network analysis (built into Linux)

Report Example

After a scan, vmsec generates two report files:

Text report (reports/vmsec_report_YYYY-MM-DD_HH-MM-SS.txt):

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  FINDINGS  (CRITICAL β†’ HIGH β†’ MEDIUM β†’ LOW)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  ── CRITICAL ────────────────────────

  [001] [CRITICAL] Module: clamav
        Description : ClamAV detected: Trojan.Agent-12345
        Location    : /tmp/payload.elf
        Fixable     : yes
        Fix command : shred -u -z '/tmp/payload.elf'

  ── HIGH ────────────────────────────

  [002] [HIGH] Module: network
        Description : Dangerous port 4444 is OPEN β€” known Metasploit listener
        Location    : port:4444
        Fixable     : yes
        Fix command : fuser -k 4444/tcp

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
  SUGGESTIONS  (MUST β†’ SHOULD β†’ OPTIONAL)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  [001] [MUST] Module: network
        Suggestion : Enable UFW firewall
        Command    : ufw default deny incoming && ufw --force enable

HTML report β€” a dark-theme interactive page with color-coded severity badges, viewable in any browser.


Remediation Flow

sudo vmsec scan
       β”‚
       β–Ό
  Report generated
  (txt + HTML)
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  FINDINGS REMEDIATION    β”‚
β”‚  [1] Auto (CRITICAL firstβ”‚
β”‚  [2] Manual (one by one) β”‚
β”‚  [3] Skip                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  SUGGESTIONS             β”‚
β”‚  [1] Auto (MUST-DO only) β”‚
β”‚  [2] Manual (one by one) β”‚
β”‚  [3] Skip                β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Auto-remediation safety rules:

  • Files are only auto-deleted from: /tmp, /var/tmp, ~/Downloads, ~/Desktop, ~/.cache
  • System files, binaries, and config files are never auto-deleted
  • All actions are logged to a timestamped log file
  • Kali's built-in pentesting tools are never flagged as auto-removable

Installation

Option 1: Clone and install (recommended)

git clone https://github.com/arif-offsec/vmsec.git
cd vmsec
sudo bash install.sh

Option 2: One-line install

curl -fsSL https://raw.githubusercontent.com/arif-offsec/vmsec/main/install.sh | sudo bash

What the installer does

  • Copies files to /opt/vmsec/
  • Creates /usr/local/bin/vmsec symlink (so you can run vmsec from anywhere)
  • Installs the man page (man vmsec)
  • Copies config to /etc/vmsec/vmsec.conf
  • Creates /var/log/vmsec.log
  • Optionally runs vmsec install to install all security tools

Uninstall

sudo bash uninstall.sh

Configuration

Edit /etc/vmsec/vmsec.conf (system-wide) or conf/vmsec.conf (local):

# Update definitions before each scan (yes/no)
VMSEC_AUTO_UPDATE_DEFS="yes"

# Report format: txt | html | both
VMSEC_REPORT_FORMAT="both"

# Days to consider a system binary "recently modified"
VMSEC_RECENT_DAYS="7"

Requirements

  • OS: Kali Linux (2022+), Parrot OS, or any Debian/Ubuntu-based distro
  • Privileges: root (sudo) for scanning and remediation
  • Internet: Required for first-time tool installation and definition updates
  • VM Software: VMware Workstation Pro, VirtualBox, QEMU/KVM, or any hypervisor

VMware Isolation (Before You Scan)

Running vmsec inside your VM is only half the protection. Make sure your VMware settings are locked down first:

VMware Setting Value
Shared Folders (Options tab) Disabled
Copy/Paste (Guest Isolation) Disabled
Drag & Drop (Guest Isolation) Disabled
Network Adapter Host-Only or NAT (never Bridged)
USB Controller Remove or restrict
Snapshots Take one before every risky session

Also add these lines to your .vmx file:

isolation.tools.copy.disable = "TRUE"
isolation.tools.paste.disable = "TRUE"
isolation.tools.dnd.disable = "TRUE"
isolation.tools.hgfs.disable = "TRUE"

Contributing

Contributions are welcome! See CONTRIBUTING.md for guidelines.

To add a new scanner module:

  1. Create scanners/scan_yourmodule.sh
  2. Use record_finding and record_suggestion functions from lib/utils.sh
  3. Register it in the ALL_MODULES array in vmsec main script
  4. Submit a pull request

Repository Structure

vmsec/
β”œβ”€β”€ vmsec                    ← Main executable (entry point)
β”œβ”€β”€ install.sh               ← One-command installer
β”œβ”€β”€ uninstall.sh             ← Uninstaller
β”œβ”€β”€ README.md
β”œβ”€β”€ LICENSE                  ← GPL v3
β”œβ”€β”€ CHANGELOG.md
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ utils.sh             ← Colors, logging, record_finding(), record_suggestion()
β”‚   β”œβ”€β”€ config.sh            ← Configuration loader
β”‚   β”œβ”€β”€ installer.sh         ← apt tool installation + post-install setup
β”‚   β”œβ”€β”€ reporter.sh          ← Text + HTML report generation
β”‚   β”œβ”€β”€ remediator.sh        ← Auto and manual remediation engine
β”‚   └── suggester.sh         ← Auto and manual suggestion engine
β”œβ”€β”€ scanners/
β”‚   β”œβ”€β”€ scan_clamav.sh       ← ClamAV virus/malware scan
β”‚   β”œβ”€β”€ scan_rkhunter.sh     ← rkhunter rootkit scan
β”‚   β”œβ”€β”€ scan_chkrootkit.sh   ← chkrootkit rootkit scan
β”‚   β”œβ”€β”€ scan_lynis.sh        ← Lynis system audit
β”‚   β”œβ”€β”€ scan_processes.sh    ← Suspicious processes + keyloggers
β”‚   β”œβ”€β”€ scan_network.sh      ← Network + C2 + firewall
β”‚   β”œβ”€β”€ scan_crontabs.sh     ← Malicious cron jobs
β”‚   β”œβ”€β”€ scan_filesystem.sh   ← SUID/AIDE/filesystem integrity
β”‚   β”œβ”€β”€ scan_users.sh        ← User accounts + SSH + sudo
β”‚   └── scan_services.sh     ← Dangerous/unnecessary services
β”œβ”€β”€ conf/
β”‚   └── vmsec.conf           ← Default configuration
β”œβ”€β”€ man/
β”‚   └── vmsec.1              ← Man page source
└── reports/                 ← Generated reports saved here

License

GPL v3 β€” Free and open-source forever. See LICENSE for the full text.


Disclaimer

vmsec is provided as-is for educational and defensive security purposes. It does not guarantee detection of all threats. Security scanning results may include false positives, especially on Kali Linux which ships many offensive security tools. Always review findings before applying remediation. The authors are not responsible for any system damage caused by misuse of the auto-remediation feature.


Made with ❀️ for the security community · Report a Bug · Request a Feature

About

πŸ›‘οΈ Automated security scanner for Kali Linux VMs. Detects malware, viruses, rootkits, keyloggers, backdoors, misconfigurations & C2 connections. | 10 Modules | One command to scan, generate sorted report & auto-remediate findings. | GPL V3

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages