Skip to content

Add RDP brute-force protection script for MikroTik RouterOS - #28

Merged
gpas45 merged 1 commit into
mainfrom
claude/rdp-brute-force-firewall-t2ymli
Jul 13, 2026
Merged

Add RDP brute-force protection script for MikroTik RouterOS#28
gpas45 merged 1 commit into
mainfrom
claude/rdp-brute-force-firewall-t2ymli

Conversation

@gpas45

@gpas45 gpas45 commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Summary

Added a new MikroTik RouterOS script that implements staged RDP brute-force protection with automatic escalation and banning of attacking sources.

Changes

  • New file: routeros/rdp-bruteforce.rsc - Complete RDP brute-force detection and mitigation system

    • Implements a 5-stage escalation system for RDP connection attempts (TCP/3389)
    • Each stage has a 3-minute timeout, with stage 5 having a 5-minute timeout
    • Sources that reach stage 5 are added to a blacklist with a 4-week 2-day ban
    • Includes firewall mangle rules for detection/staging and filter rules for blocking
    • Supports whitelisting via RDP address-list (trusted clients)
    • Supports management hosts that bypass staging via management address-list
    • Exempts internal network 192.168.0.0/16 from banning
    • Includes comprehensive documentation of the staging mechanism
  • Updated: routeros/README.md - Added documentation entry for the new script

    • Describes the script's purpose, staging mechanism, and configuration requirements

Implementation Details

  • Uses MikroTik firewall mangle rules to progressively add sources to address-lists based on connection state
  • Rules are ordered from high stage to low stage to prevent cascading through all lists in a single pass
  • Blocking is handled by a separate filter rule that drops all packets from blacklisted sources
  • The script is designed to be imported once and requires manual maintenance of whitelist/management address-lists

https://claude.ai/code/session_011QmBU1hdErFnfrU7SrpaUh

Staged address-list detection (rdp_stage1..5) that bans repeat
RDP/3389 offenders in "black-list attackers" for 4w2d, plus the
filter drop rule that actually blocks banned sources.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011QmBU1hdErFnfrU7SrpaUh
@gpas45
gpas45 merged commit 2572b9d into main Jul 13, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants