TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Endlessh: An SSH Tarpit

579 pointsby stargraveabout 6 years ago

30 comments

xoaabout 6 years ago
Neat little project to needle some of the botters a bit (though I assume they&#x27;ll all evolve to recognize this fairly quickly). I&#x27;d echo tyingq&#x27;s comment below though:<p><i>Any tarpit has the potential to piss someone off. I&#x27;d run it on a sacrificial server with no obvious way to tie back to who is running it.</i><p>Yeah, just speculating but at least from what I&#x27;ve seen in the past if you successfully tarpit some script kiddie and they notice the IP their scan got stuck on there is some potential to move from &quot;one of a billion random lowest common denominator bulk scan targets&quot; to &quot;paid attention to specifically some minimal amount&quot;, which is a genuinely different scenario. Even if all that amounts to is a relatively low volume revenge DDOS pointed at you for a bit it&#x27;s still more of a disruption then if the auto scan had just moved on without seeing anything of note in the first place. This looks like fun on some systems, but on anything real I&#x27;m inclined to just stick to cutting down on log spam via single packet auth or a port knocker or the like. The old outrun-the-hiker-not-the-bear aphorism fits a lot of cases, just something to keep in mind before implementing something like this if you aren&#x27;t directly experimenting with more active reactions.<p>Conversely as a research project I&#x27;m now actually curious what sort of extra attention even something like this could attract. Maybe these days everyone would just adapt and move on instead and the above is all obsolete?
评论 #19468161 未加载
评论 #19467053 未加载
LinuxBenderabout 6 years ago
I like this! It&#x27;s tiny, simple, yet effective.<p><pre><code> 2019-03-22T19:54:06.303Z ACCEPT host=::ffff:196.52.43.xx port=50327 fd=4 n=1&#x2F;4096 2019-03-22T19:54:38.838Z CLOSE host=::ffff:196.52.43.xx port=50327 fd=4 time=32.535 bytes=199 2019-03-22T19:57:12.008Z ACCEPT host=::ffff:141.98.81.xx port=53646 fd=4 n=1&#x2F;4096 2019-03-22T19:57:21.118Z CLOSE host=::ffff:141.98.81.xx port=53646 fd=4 time=9.110 bytes=30 </code></pre> The 141 bot never stays longer than 5 seconds. I&#x27;m guessing they are using &#x27;expect&#x27; and waiting 5 seconds for a particular string.<p>The only thing missing is setting some glibc hardening options<p><pre><code> RELRO STACK CANARY NX PIE RPATH RUNPATH FORTIFY Fortified Fortifiable FILE Partial RELRO No canary found NX enabled No PIE No RPATH No RUNPATH No 0 8 .&#x2F;endlessh </code></pre> I modified one line in the Makefile<p><pre><code> CFLAGS = -std=c99 -Wall -Wextra -Wno-missing-field-initializers -D_FORTIFY_SOURCE=2 -O2 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -ftrapv -s -g -Wl,-z,relro,-z,now -Wl,-z,noexecstack -pipe -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -fstack-clash-protection --param ssp-buffer-size=4 -fPIE -pie -m64 -mtune=generic </code></pre> It&#x27;s better now<p><pre><code> RELRO STACK CANARY NX PIE RPATH RUNPATH FORTIFY Fortified Fortifiable FILE Full RELRO Canary found NX enabled PIE enabled No RPATH No RUNPATH Yes 3 4 .&#x2F;endlessh</code></pre>
评论 #19467912 未加载
评论 #19470867 未加载
评论 #19485099 未加载
评论 #19467068 未加载
评论 #19466690 未加载
userbinatorabout 6 years ago
This is the Internet equivalent of keeping phone scammers on the line by not just refusing to hang up, but actively interacting with them until they hang up (search YouTube for &quot;tech support scammer trolling&quot; for some entertainment...)<p>That said, I&#x27;m a little confused even after reading the linked RFC paragraph; it claims &quot;The primary use of this feature is to allow TCP-wrappers to display an error message before disconnecting.&quot; but I&#x27;m not familiar with that term and there are no other occurrences of the word &quot;wrapper&quot; in that document.<p><i>Firefox and Chrome will spin on that server for hours before giving up.</i><p>For a web browser, this behaviour makes a lot of sense: timeouts are usually based on &quot;I&#x27;ve waited for X and haven&#x27;t received anything&quot;, not &quot;this connection is like collecting water from a dripping tap&quot;. As long as there is a slow but steady stream of content coming in, you wouldn&#x27;t want to abort until the user gives up or an internal limit on the data collected is hit (which is probably what happened with the author&#x27;s tests --- a quick search doesn&#x27;t yield the maximum size of the response headers browsers will accept, but servers usually have a configurable limit of a few KB at most for the request headers alone.)
评论 #19469109 未加载
评论 #19469343 未加载
HocusLocusabout 6 years ago
I opened up port 22 once so that it connected (without crypto) and issued the phrase,<p>YOU ARE STANDING AT THE END OF A ROAD BEFORE A SMALL BRICK BUILDING. AROUND YOU IS A FOREST. A SMALL STREAM FLOWS OUT OF THE BUILDING AND DOWN A GULLY.<p>&gt;<p>and if they typed in something it would continue to play the game. After hundreds of thousands of automated SSH worm probes over several months, an actual human did connect and play the game for a few minutes! But even this triumph was short lived, they did not even play it to the end to see if something interesting might be unlocked (it would have been an invitation to contact my email address).
EvanAndersonabout 6 years ago
I haven&#x27;t used it in years, but Tom Liston&#x27;s &quot;Labrea&quot; tarpit is an interesting take on this concept: <a href="https:&#x2F;&#x2F;github.com&#x2F;Hirato&#x2F;LaBrea" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Hirato&#x2F;LaBrea</a><p>It listens in your unused IP space and both tar-pits scanners and creates actionable intelligence about scans against your hosts.
评论 #19466640 未加载
viraptorabout 6 years ago
If you don&#x27;t want to waste resources and run a separate service, you can do a very similar thing with just iptables. Look for the TARPIT target.<p>&gt; Captures and holds incoming TCP connections using no local per-connection resources. Connections are accepted, but immediately switched to the persist state (0 byte window), in which the remote side stops sending data and asks to continue every 60-240 seconds. Attempts to close the connection are ignored, forcing the remote side to time out the connection in 12-24 minutes.
评论 #19469244 未加载
JohnFenabout 6 years ago
This is awesome. Like the author, I run my real SSH server on a nonstandard port. Unlike the author, I run nothing on the standard SSH port.<p>I think that I&#x27;ll start running this there.
devyabout 6 years ago
On a different note, I love this other tool he wrote: Enchive<p><a href="https:&#x2F;&#x2F;nullprogram.com&#x2F;blog&#x2F;2017&#x2F;03&#x2F;12&#x2F;" rel="nofollow">https:&#x2F;&#x2F;nullprogram.com&#x2F;blog&#x2F;2017&#x2F;03&#x2F;12&#x2F;</a>
评论 #19468230 未加载
0db532a0about 6 years ago
Wouldn’t cycling over the lines of an ASCII middle finger be more efficient and equally as useful as generating random strings? The middle finger would fit in a few cache lines at most.
cryptonectorabout 6 years ago
Massively async ssh scanners won&#x27;t care. They&#x27;ll time out and move on without being held up at all.
评论 #19469330 未加载
HashBasherabout 6 years ago
I wonder if you could make the attacker crunch out some shah-256 and you can profit by mining Bitcoin.
评论 #19467295 未加载
评论 #19468481 未加载
iknowordidthatabout 6 years ago
Is a poll necessary?<p>Simple timer to count to 10. Go over all open sockets, drain incoming, pump junk. Handle accept. Repeat.
ape4about 6 years ago
Would be nice if it logged something fail2ban could act on. So it could ban the IP-address - after bugging the bot for a couple hours.
oedmarapabout 6 years ago
Neat little tool! Since switching to Teleport I haven&#x27;t had OpenSSH listening publicly for a while, just reverse proxies. Still, I&#x27;ll prob spin up a small server for this to observe the patterns and IP locations.<p>Also, don&#x27;t think that posting this blog article on March 22 didn&#x27;t go unnoticed :)
评论 #19468960 未加载
pmcabout 6 years ago
SSH brute-force attacks still pose a significant risk. See our related paper on SSH auditing driven by attacker&#x27;s attempts here <a href="https:&#x2F;&#x2F;pmcao.github.io&#x2F;caudit&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pmcao.github.io&#x2F;caudit&#x2F;</a>
earthboundkidabout 6 years ago
I wrote one of these for HTTP: <a href="https:&#x2F;&#x2F;github.com&#x2F;carlmjohnson&#x2F;heffalump" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;carlmjohnson&#x2F;heffalump</a>
nullcabout 6 years ago
I found that disabling password authentication makes ssh probing mostly stop.<p>Attackers that are smart enough to detect and avoid pubkey only hosts will probably easily adapt to this program.
AlexCoventryabout 6 years ago
Perhaps this could be useful if you ran it on a vast number of ports. Just running it on the one doesn&#x27;t seem to make an attacker&#x27;s life much more difficult.
评论 #19466806 未加载
评论 #19466804 未加载
nullheadabout 6 years ago
Set this up on a server last night. In 20 hours I&#x27;ve got 75 connections. Took a capture of trying to connect to it from my laptop:<p><a href="https:&#x2F;&#x2F;www.cloudshark.org&#x2F;captures&#x2F;b64150b66908" rel="nofollow">https:&#x2F;&#x2F;www.cloudshark.org&#x2F;captures&#x2F;b64150b66908</a><p>IP addresses have been change to protect the innocent. This is from macOS but definitely seeing some different behavior from other clients.
mehrdadnabout 6 years ago
This is great but what happens when clients start watching out for strings they don&#x27;t expect? Seems like only a matter of time.
damirabout 6 years ago
Awesome! Love reading hacks like these.
blastbeatabout 6 years ago
Assuming you run a legit SSH server on port A and an SSH tarpit on port B. What hinders an attacker to connect to port A an B at the same time? What is the advantage having an attacker connected for weeks on port B?
评论 #19466822 未加载
评论 #19466843 未加载
z3t4about 6 years ago
I can recommend setting up a server and do extensive logging. Then watch hackers as they attempt to break in. I had a server hacked last week and today i read the logs to figure out how they did. From first discovery, trying to figure out what system they&#x27;re on, to gaining a shell, and figure out how to execute stuff, gaining network access. It was better then watching an actual movie. And a humbling experience. But also entertaining, watching the struggle against my hardening and even stumbled on a bug, feeling his&#x2F;her frustration. And the wow feeling when they finally got a shell.
评论 #19470374 未加载
tejtmabout 6 years ago
What a wonderful opportunity to rickroll ... to prolong detection time rot13 it or walk through all the ciphers you can get away with.<p>cause we are never going to give you up ;)
maga_2020about 6 years ago
very interesting, and useful (including newbies like me who do not appreciate the complexities and dangers of having internet-accessible IP address).<p>I wonder if security-oriented OSs like openBSD could offer something like this out of the box. So that an admin can just say enable_tarpits=&#x27;yes&#x27;, and it would automatically enable tarpits like this for all the currently installed packages (with some default ports).
评论 #19468584 未加载
GNOMESabout 6 years ago
I must not be understanding something...<p>Does this still allow whitelisted machines to connect, or is this just a troll thing to do?
评论 #19466674 未加载
评论 #19466658 未加载
评论 #19466721 未加载
评论 #19466656 未加载
评论 #19467163 未加载
stcredzeroabout 6 years ago
Could the return strings be generated by a Deep Learning powered fuzzer?
评论 #19469257 未加载
评论 #19467630 未加载
egorfineabout 6 years ago
Beautiful!
allanrboabout 6 years ago
Ewww, sticky service! Hilarious! :-D
评论 #19467860 未加载
ams6110about 6 years ago
I&#x27;m not sure I like this. How secure is it? Anything you put on port 22 is going to be attacked relentlessly. I think I&#x27;d rather have OpenSSH handling those attacks than some tarpit program that may or may not have been subjected to the audits and the trial-by-fire that OpenSSH has.
评论 #19466425 未加载
评论 #19466480 未加载
评论 #19466422 未加载
评论 #19466423 未加载
评论 #19467708 未加载
评论 #19469264 未加载