DEV Community

Cover image for Decoy-Hunter: Bypassing "All Ports Open" Deception in Offensive Security
KL3FT3Z
KL3FT3Z

Posted on

Decoy-Hunter: Bypassing "All Ports Open" Deception in Offensive Security

The defensive idea belongs to https://t.me/s0i37_channel

๐Ÿ›ก๏ธโ†’โš”๏ธ Decoy-Hunter: Bypassing "All Ports Open" Deception in Offensive Security

Defensive deception is powerful โ€” but not invisible.

This tool helps red teams and penetration testers cut through the noise of fake services and find real attack surfaces.


๐Ÿ”ฅ The Problem: "All Ports Are Open" Deception

In modern defensive architectures, it's becoming common to confuse attackers by making every TCP port appear open. This is often achieved with simple iptables rules:

iptables -t nat -A PREROUTING -i eth0 -p tcp -m conntrack --ctstate NEW -j REDIRECT --to-ports 1234
while sleep 1; do nc -nv -lp 1234; done
Enter fullscreen mode Exit fullscreen mode

Or more advanced tools like portspoof, which return random service banners on every port.

The goal? Waste the attackerโ€™s time, trigger false positives in scanners, and hide real services among thousands of decoys.

But hereโ€™s the catch: most deception implementations are flawed.

  • portspoof returns different banners on each scan โ†’ easily detectable.
  • Static banner emulators (e.g., using nmap-service-probes responses) lack protocol logic.
  • Fake services often respond to any input with the same static string โ€” real services donโ€™t work that way.

This creates an opportunity for offensive counter-deception.


๐Ÿ•ต๏ธโ€โ™‚๏ธ Introducing decoy-hunter

decoy-hunter is a stealthy, protocol-aware scanner designed to:

  • Detect fake services behind "all ports open" traps,
  • Identify real, exploitable services hidden in the noise,
  • Operate with traffic obfuscation to avoid detection by the defender.

Unlike nmap -sV, which can be fooled by consistent fake banners, decoy-hunter:

  • Uses real nmap-service-probes to send legitimate client requests,
  • Validates protocol behavior, not just banners,
  • Supports TCP + UDP up to port 10,000 (or full range),
  • Mimics human-like timing and request patterns.

๐Ÿง  How It Works

1. Realistic Probing

Instead of sending raw strings, decoy-hunter:

  • Sends valid HTTP requests with real User-Agent,
  • Initiates TLS handshakes on HTTPS ports,
  • Uses SMTP EHLO, FTP USER, Redis PING, etc.,
  • Leverages the official nmap-service-probes database for accuracy.

2. Protocol Validation

A fake SSH service might return SSH-2.0-OpenSSH_8.9, but:

  • It wonโ€™t complete a key exchange,
  • It wonโ€™t respond correctly to malformed packets,
  • It may reply with an SSH banner on port 8080 โ€” which is suspicious.

decoy-hunter checks:

  • Does the response match the expected protocol state?
  • Is the service consistent across multiple probes?
  • Does it only respond to one probe type, ignoring others?

3. Traffic Obfuscation (Anti-Detection)

To avoid being flagged as a scanner:

  • Random delays between connections (0.2โ€“2.0s),
  • Limited concurrency (default: 15),
  • No aggressive payload spraying,
  • TLS used where expected (e.g., port 443),
  • No repeated identical patterns.

๐Ÿ”’ Goal: Make traffic look like a curious user or misconfigured client โ€” not a pentest tool.


๐Ÿš€ Quick Start

1. Install dependencies

pip install tqdm
Enter fullscreen mode Exit fullscreen mode

2. Download nmap-service-probes

wget https://raw.githubusercontent.com/nmap/nmap/master/nmap-service-probes
Enter fullscreen mode Exit fullscreen mode

3. Run a scan

# Scan top 10k TCP ports
python3 decoy_hunter.py 192.168.1.10

# Include UDP (slower)
python3 decoy_hunter.py target.com -sU -c 5

# Custom ports
python3 decoy_hunter.py 10.0.0.5 -p 22,80,443,8080,1234
Enter fullscreen mode Exit fullscreen mode

Sample Output

[REAL] 22/tcp open ssh (via passive/NULL) โ†’ SSH-2.0-OpenSSH_8.9p1
[FAKE] 8080/tcp open http (via GetRequest) โ†’ SSH-2.0-OpenSSH_8.9p1  โ† ๐Ÿšฉ Mismatch!
[REAL] 443/tcp open http (via GetRequest) โ†’ HTTP/1.1 200 OK
Enter fullscreen mode Exit fullscreen mode

Notice: SSH banner on port 8080 โ†’ clear sign of deception.


๐Ÿ› ๏ธ Technical Highlights

Feature Description
Full nmap-service-probes support Accurate service detection using Nmapโ€™s official database
Async I/O with asyncio Fast, scalable scanning without blocking
UDP + TCP scanning Covers both transport layers
Stealth mode Randomized timing, realistic requests, low concurrency
Progress bar Visual feedback with tqdm
No external dependencies (except tqdm) Pure Python, easy to run anywhere

๐Ÿ“š Why This Matters

Defensive deception is a valid and useful tactic โ€” but it shouldnโ€™t create a false sense of security. As red teamers and ethical hackers, we must:

  • Understand defensive tricks,
  • Develop tools to see through them,
  • Help organizations test the effectiveness of their deception layers.

decoy-hunter is not just a scanner โ€” itโ€™s a counter-deception framework for the modern attack surface.


๐Ÿค Contributing

Found a fake service that decoy-hunter missed?

Have an idea to improve obfuscation or probe coverage?

โ†’ Pull requests welcome!

โ†’ Issues and feature requests encouraged.


โš ๏ธ Legal & Ethical Note

This tool is for authorized penetration testing and research only.

Never scan systems you donโ€™t own or donโ€™t have explicit permission to test.


๐Ÿ“ฆ Repository Structure

decoy-hunter/
โ”œโ”€โ”€ decoy_hunter.py          # Main CLI tool
โ”œโ”€โ”€ probes.py                # Probe logic & obfuscation
โ”œโ”€โ”€ service_probes_parser.py # Parses nmap-service-probes
โ”œโ”€โ”€ nmap-service-probes      # (Download separately)
โ”œโ”€โ”€ README.md                # This file
โ””โ”€โ”€ requirements.txt         # tqdm
Enter fullscreen mode Exit fullscreen mode

๐Ÿ’ก Inspired By


๐Ÿ” Real security isnโ€™t about hiding โ€” itโ€™s about resilience.

Use decoy-hunter to ensure your defenses are tested, not just decorated.


Author: [KL3FT3Z]

License: MIT

GitHub: github.com/toxy4ny/decoy-hunter


Top comments (3)

Collapse
 
yorgie7 profile image
Yogesh Bamanier

impressive

Collapse
 
toxy4ny profile image
KL3FT3Z

Thanks!)))

Collapse
 
yorgie7 profile image
Yogesh Bamanier

Linkedin?