79
submitted 1 week ago* (last edited 6 days ago) by umutcamliyurt@lemmy.world to c/cybersecurity@sh.itjust.works

Source code and details: https://github.com/umutcamliyurt/PortTripper

How it works

On startup PortTripper:

  1. Scans the configured port range and builds a whitelist of ports already in use by real services (first run only).
  2. Draws a cryptographically random sample of up to -maxports ports from the range, excluding whitelisted ports. Using crypto/rand for selection means the open set is unpredictable to an attacker even if they know the configured range.
  3. Binds TCP and UDP listeners on every chosen port.
  4. On TCP: accepts connections, holds them open for a configurable duration, then drops them, wasting the scanner's threads and file descriptors.
  5. On UDP: reads and discards datagrams without replying, so ports appear open|filtered to scanners rather than closed.

All real service ports are untouched because they are already bound before PortTripper starts, and the auto-generated whitelist tells PortTripper to skip them.

you are viewing a single comment's thread
view the rest of the comments
[-] Jerry@feddit.online 28 points 1 week ago* (last edited 1 week ago)

Things like this that play games scare me. This itself opens a wider attack vector on your server. I'm thinking of possibilities:

  1. In Linux, each TCP connection is a file descriptor. PortTripper holds connections to waste scanner threads, which means it's holding file descriptors. This could be a good DDOS attack vector. Hit every port with connection requests, requiring a slew of file descriptor creations, and boom, you cause the server to hit the server ulimit cap. New connections cannot be made. The server is half dead.

  2. Memory and CPU consumption. Maintaining thousands of open TCP states takes RAM and CPU. A massive flood can consume all memory. And for what? To annoy a hacker?

Interestingly enough, just these 2 things can make PortTripper a hacker's tool.

  1. If a service crashes or reboots, is down for maintenance, or is slow to come up, PortTripper might grab the port before the application comes back up. And then it can't come back up.

  2. Who's to say there won't be vulnerabilities in PortTripper that can cause a buffer overflow, memory leak, or parsing vulnerability in PortTripper's code or a library it uses? Playing this game opens another attack vector into your server.

  3. If PortTripper can bind to ports 1 through 1023, then it's running as root or has elevated capabilities. If an attacker exploits a bug in PortTripper or a library it uses, they can get high-level control of the server.

  4. While PortTripper "discards datagrams without replying" in a reflected DDOS attack, millions of discarded packets come in, which means millions of CPU interrupts at the kernel level. This can choke the NIC.

I think PortTripper is too risky to run just to become a nuisance to someone, IMHO.

[-] bamboo@lemmy.blahaj.zone 3 points 1 week ago

It'll probably just be a nuisance for small operations and for larger botnets be a drop in the bucket or not even noticable.

[-] Cyber@feddit.uk 1 points 1 week ago

Yeah, I don't think this would be great on an external boundary with all the internet scanners out there, but maybe in a DMZ it might help as a feed to a boundary blocklist.

I do see torrent peers trying to scan my network sometimes, so this might be an interesting insight...

load more comments (15 replies)
this post was submitted on 30 May 2026
79 points (100.0% liked)

Cybersecurity

10060 readers
20 users here now

c/cybersecurity is a community centered on the cybersecurity and information security profession. You can come here to discuss news, post something interesting, or just chat with others.

THE RULES

Instance Rules

Community Rules

If you ask someone to hack your "friends" socials you're just going to get banned so don't do that.

Learn about hacking

Hack the Box

Try Hack Me

Pico Capture the flag

Other security-related communities !databreaches@lemmy.zip !netsec@lemmy.world !securitynews@infosec.pub !cybersecurity@infosec.pub !pulse_of_truth@infosec.pub

Notable mention to !cybersecuritymemes@lemmy.world

founded 3 years ago
MODERATORS