Posted
by
timothyon Thursday May 19, 2011 @05:22PM
from the said-the-spider-to-the-vandal dept.

An anonymous reader writes "I run an FTP server for a few dozen people, and it seems like every week I have a random IP address connect to my box and try guessing 'Administrator' passwords once every five seconds or so. This poses no real risk to me, since all my accounts have custom (uncommon) names. But if this is happening to me, I would wager lots of people are at risk of low level, persistent, long term password cracking attempts. Is there a way to report the perpetrators, or any action we can take to address this kind of danger?"

Am i the only one wondering how the hell you connect an ethernet cable to a power outlet? would be a pretty funny support call though

Dell: welcome to dell customer service, how can i help you?
Customer: I got hacked so i fought back with electricity, and now the monitor isn't working properly.
Dell: *sounds of someone securing a noose*

You may be the only one of us who hasn't made a "fool-killer". It's a 120V plug on one end connected to alligator clips on the other. Great for connecting ANYTHING to a power outlet, especially things that shouldn't be.

That's a fine idea for private systems. For private servers I use only ssh with certificates. Poof, hack attempts are gone.

For a public facing FTP server the idea is to keep it easy. It should work with any FTP client out of the box with no configuration. In this case your only defense is to pick real username and long, quality passwords.

It actually works very well. Almost every break-in attempt is from a script. Almost every script only tries the default port. You can easily eliminate a very large number of script attacks just by changing the port.

The point of "don't rely on security through obscurity" is that being obscure should not be your only layer of defense.

Moving your SSH service off of the default port has a few benefits:

- Most of the standard attack scripts no longer work against your server.

- Your security logs are 99% less cluttered (if not 99.9%), making it easier to see the more determined and worrisome attackers.

I never leave a public facing server's SSH port on the default, it's not hard to specify an alternate port in the SSH clients and it makes my life a lot simpler when I don't have to wade through a few thousand password attempts each day on the standard port. There are a few attackers out there who do port-scanning first to find the SSH port before trying dictionary attacks, but since we don't do password authentication they're still left out in the cold unless they get our private SSH keys.

They are, however, bloody annoying and make spotting anything important that much harder.

If you know legit connections will be in certain IP blocks, ban all others.

If not but you've decent FTP software, have it block access from any IP that tries to access specific accounts (such as Administrator, samba, nagios or whatever ones that both don't exist and are being targeted on your box).

If you prefer something more entertaining, use Linux' packet munging code. What you want to do is detect inbound connections

denyhosts is your best bet, IMHO. After a few failed attempts, it blocks the IP and kills automated attacks.

Except that for the more serious attackers, who have botnets at their disposal, it doesn't do much. In a attack by a botnet, each IP address only hits your server a handful of times and they're synchronized so that each bot tries a different username/password combination. But since there are a few thousand or tens of thousands of machines in the botnet, it adds up to a few tens of thousands of at

Yep, I've been doing and saying this for years. If Asia, Russia, South America are not interesting markets for my site/service/product/email, I simply block the IP ranges from hitting the respective ports. I'm certainly not about to sell high-end gaming computers or consulting services to China, so they're more than welcome to find some other host to crack.

Proactively? Not really. The systems used for this are typically overseas, in countries that more or less don't care.

However, you -can- configure your server to disregard even initial connection attempts from specific ranges of IP addresses. I solved a lot of this on my own home FTP server by (sorry comrads) telling my server to ignore connection attempts from Russia and China.

Upon doing so, it went from a daily occurrence, to maybe one attempt a month. Usually less.

And, if a friend ever needs to FTP in from one of these countries, it's a simple enough rule change.

Have you ever thought of just running ssh on a port other than 22? I haven't use 22 in many years. We get tons of garbage attacks on the webserver, but I haven't had a single attempt on my ssh server in years. Not one. I still check the logs, but now it takes seconds instead of an hour. One less thing to have to worry about.

Putting ftp on a different port(s) is much more problematic, but changing sshd is trivial.

Every once in a while some one will do something. After checking my logs I found one day I found some attacks coming from a university in the UK. Sent that section of the log to the admin of the school. I got a nice email back thanking me for email because it allowed him to find and fix the machine that was compromised.Another option would be to write a script that would detect any attempt at admin access that fails more than three times and block the IP for a week or so.

Proactively? Not really. The systems used for this are typically overseas, in countries that more or less don't care.

However, you -can- configure your server to disregard even initial connection attempts from specific ranges of IP addresses. I solved a lot of this on my own home FTP server by (sorry comrads) telling my server to ignore connection attempts from Russia and China.

Upon doing so, it went from a daily occurrence, to maybe one attempt a month. Usually less.

And, if a friend ever needs to FTP in from one of these countries, it's a simple enough rule change.

I had a few meetings with local FBI cyber people, and they recommended for me to send things like that to either DISA or to them (the local field office for my area)
Contact your local FBI field office and see what they say. If you can talk to their cyber division they are usually helpful. (usually...)

Not unless you are someone of particular noteworthyness. A government official, a celebrity of any kind. Then you'll get their attention. Because the police know that even a famous singer will raise hell if they talk about how useless the police are.

I always found that honeypots also attracted MORE attention to the network, rather than serving as a tool of defense.

Essentially, even if you did get the police involved to the point where they could trace the hackers, chances are they are using some type of TOR technology, and the ones that aren't, the little bobby droptables of the world, probably aren't worth prosecuting.

Save yourself the headache and forgo the unnecessary risk and stress of honeypotting.

Put a simple "here's how to use SFTP, if you want to deal with me, use it" text file in the FTP Server, if you really feel like educating your partners. If you don't, just show them the finger if they're too stupid to use SFTP.

Sorry, but it's not my duty to explain security to people for free. I get paid for that.

Odd. Just yesterday I added an "S" to a project (in front of the "FTP") and nobody raised a concern, it was signed without a problem.

My partners don't care about protocols or technical tidbits. They care about a working interface. For them, using SFTP or FTP is the same as long as their interface delivers their data. If you're concerned with your customers, give them what they need to access your files instead of leaning back and complaining that you'd lose business if your increase security.

im saying there are probably a lot of people who work for the government who are doing a lot of 'testing' of their little toys on the unwitting civilian population. nothing makes this more clear than the HBGary emails.

Personally I use the lfd daemon with the csf firewall script on my servers. fail2ban is similar.

People should not get unlimited attempts to connect to your services.

At the same time, you don't want to clog up your firewall rules with thousands of denied IPs, so I usually set the filter rather high so it will not impact real users (you would be surprised how many users need 10 or 15 attempts to guess their password if they forgot) but only people really performing a serious brute force password guessing atta

You say this poses no real risk to you, because your passwords are immune to dictionary attacks. But ftp sends passwords in cleartext, so it actually does pose a risk to you if someone is able to sniff your packets on the public internet.

But anyway, if you feel that the risk to you is insignificant, then why are you asking the question? Are you asking it on behalf of other people who might want to security-harden their ftp servers? If those people are worried, why wouldn't they have already switched from ftp to sftp? And if they're running sftp, they can protect against attacks of the type you're describing by installing denyhosts:http://denyhosts.sourceforge.net/ Denyhosts does have a cooperative blacklisting facility of the type you were asking about.

I could be wrong, but since ftp is inherently insecure, I would be surprised if someone had created software with the same functionality as denyhosts that would work with ftp. That would be like retrofitting a tricycle to make it supersonic.

As mentioned elsewhere in this thread consider using Fail2ban which is easily configured for monitoring failed attempts at connecting to your server and can then block the IP after a configurable threshold is reached.

If your security is even modest as far as passwords there is no need to worry. More sophisticated attacks using coordinated bot nets are the really scary thing but can be countered by limiting the number of login attempts a second/minute. But it's all just extended dictionary attacks. Only someone really dedicated does brute force. This is the equivalent of someone going through a parking lot and checking to see if anyone left their door unlocked and or keys inside their car. If you can just change the port used for ftp, it cuts it down by 99 percent.

The problem is the bandwidth. You have to pay for it anyway. Even if your server doesn't acknowledge it. Someone really dedicated using a bot net can easily give you overage charges.

Like you, I saw the same thing. That said, I also configured my system to respond as though it was a Windows 2000 server, when in reality it was a linux box, so it could try guessing "administrator" all it wants....
That said, I also wrote a script and cron job to parse all the access logs, keep counts of failed login attempts by IP address, subnet, and ISP block, and when they hit certain thresholds, update my firewall rules to reject all connections to that address, subnet, and ISP. I saw a lot of stuff

Let's see how stupid they are. Find a nasty virus variant, package it in a file called Kiddy_Porn.exe and drop it on your server. Set up an account with the login Administrator:Password and have that account point to just this file. Maybe put some others in a directory to give it some legitimacy.

Monitor your logs and laugh your butt off when you see get/kiddy_porn.exe

Cyberduck for OS X, FileZilla for Windows, and gFTP all do SFTP and are free. If you're already using SFTP then only allow specific users and disable root access. Key authentication is ideal like others have mentioned but sometimes a hassle.

The first (and hopefully last time) I was rooted was in '99 on a Redhat box through FTP using a buffer overflow. Since then I learned my lesson.

People who worry about computer security are forbidding the clients of my company from installing software on their MS Windows computers. That means they cannot install the software to do SFTP on their computers - so in the name of security they are using plain old vanilla FTP! For as long as this stupid situation persists I'll be using FTP. The alternatives the clients can actually use are stupid web based FTP done badly ideas like those idiots that set up a system where a password change wouldn't keep

I wrote a (T)FTP server that after 6 trys gives the user a 6 minute delay; after another 10 tries another delay (15 minutes) is applied, but after 20 to 30 (psedo- random) total failed attempts in one day, the user (irregardless of username) is given what seems like access to the system. They can list a limited set of small "files and directories", although none actually exist, and all simulated file contents are mundane, boring, and severely rate limited.

I would bet that if it is coming from a single IP at a time, it is coming from a country where English is not the primary language. You can try to report it, but you'll likely get a reply in a language you cannot read and the correspondence will stop there.

Alternately, if you are seeing distributed (botnet) attempts, there isn't much point in trying. You'll have dozens (if not more) of different addresses, and they are almost always all transient anyways. You could spend your time going through all t

Fail2Ban seems to work well, and one of the mail servers I use does it, but i asked him to not use int on my server - I wanted the wrapper option instead of iptables, and my admin partner balked. He wanted to keep the bans in place for years, which is fairly pointless, except he has a secret admirer that comes back and hax on his system every 2 years or so. I'm not sure i can take him anywhere with me any more, he's pissed someone off who has more scripts than he does. Fortunately his secret admirer is n

Filezilla can do automatic bans. I am sure your favourite FTP server can do that as well. 5 failed login attempts = auto ban for 3 hours. That solved all our problems in the office.

For home, just running an FTP server on a different port got rid of these kind of attacks completely. Of course, blocking hinet and other chinese netblocks works as well. You have a lot of options here.

1) I like the idea of programs like DenyHosts and Fail2Ban; as some people mentioned FileZilla also has a nifty "auto-ban" option which I've used too. I specifically like using a shared list of bad hosts; that was really what I was asking for, so thank you all! Totally answered my question.

2) Switching from FTP is indeed an option. I originally started by using FTPS, which is nicely supported by FileZilla but not by many other programs. The trouble was that a many users had routing difficulties and were unable to reach the FTPS server from their location. The worst part was that many routing difficulties were transient: when they were at the office it would fail, when they were at starbucks it would work, when they were at a hotel it would fail, etc.

3) I would wager that SFTP is pretty much the right solution. I figure I'll get started on looking for an SFTP replacement for FileZilla server.

If the users need to authenticate - switch to SCP over SSH. Switching to SFTP sounds nice in theory, until some tech comes along and screws up the FTP server config and people are able to start logging in again over regular FTP.

If the content is designed to be public readable, setup a download only FTP site that requires no authentication, and do the uploads via SCP.

If you need to allow uploads, setup a folder that allows anonymous uploads, but don't let FTP users download from that folder. Retrieve t

If the users need to authenticate - switch to SCP over SSH. Switching to SFTP sounds nice in theory, until some tech comes along and screws up the FTP server config and people are able to start logging in again over regular FTP.

That doesn't make sense. SFTP is not a normal FTP server exposed over an SSH or SSL tunnel. There's no "FTP server config" you can screw up and magically transform an SFTP server into an FTP server. Even if there were, server configs don't change on their own, it doesn't real

How about fail2ban? We use it to block multiple SSH attempts. It blacklists IP's for a user-defined amount of time and then unblocks them again. Works like a charm, every time. Hell, it's even locked me out on more than one time (because I didn't update the whitelist file for my workstation's IP).

It's a pretty simple concept - a basic heuristic for dodgy-looking connection attempts, and then blocking the originating IP at the firewall. Once it's reasonably bug-free it won't need maintenance until Linus decides to switch to a different firewall again.

Guess it's time to give back to the community....a few years ago, I wrote a custom script to continually tail out lines at a time from/var/log/auth.log and null route the bad ip's....to date, I have 4316 ip's null routed. I have the following script running as a background job initiated from/etc/rc.local hope this is helpful to people.

HoneyPots can be an important layer. But you need the other layers. We use the following layers to protect SSH (https://it.wiki.usu.edu/ssh_description )

1.) The firewall limits the vulnerable scope of SSH to a few trusted hosts.2.) The firewall can also be used to prevent credential guessing by rate-limiting connections to the SSH port.3.) The SSH Port is treated as a shared secret. Only interesting, targeted attacks find the SSH server.4.) The SSH server should not allow known usernames including root. The attacker must find a username.5.) The admin is trained to create good passwords for his usernames.6.) SSH users are taught to verify the identity of their systems when they first connect.7.) System admins must regularly review the activity of their SSH servers.8) Security monitors all SSH connections, including ones on non-standard ports. We follow up on connections that seem interesting.9.) USU has SSH HoneyPots that help us respond to SSH attack.

SSH HoneyPots give us several benefits:

1) They make it easy to automate blocking SSH attackers, with virtually no chance of false positives. Some patterns of attack are designed to bypass Fail2ban, but the HoneyPots have to problem handling them.

2) We notify remote ISPs (and remote managers) that they have attacking systems. This is surprisingly effective. When we started (6 years ago) less than 1 notify in 8 seemed to have any effect. Now about 1/2 of the notifications seem to be have an effect. And remember, virtually every one of those attacking computers belongs to an innocent victim. Notification helps them, and it improves the overall security of the internet. We have also confirmed that notifications drive away some attackers.

3) We collect and analyze guessed credentials.- If they meet our complexity requirements, they are added to our central black-list.- Patterns of credentials reveal patterns of attack and patterns of attackers. It's a Heisenberg thing. An attacker both changes the target, and reveals information about himself. Password guessing reveals a lot of information. Virtually every attack has been a unique combination of credentials. You can do cluster analysis against the combinations. You can find relationships between attacks and IPs. You can track how these relationships change over time. You can correlate this information with your other intelligence. The FBI came to us and asked about some attacking IPs. Almost all of them had hit our SSH HoneyPots. We were able to pass all this intelligence back to them.

Our SSH Honeypots (and several other SSH servers) now have the following banner:

---USU tracks internet abuse. We have SSH honeypots that automatethe process of detection, notification, and blocking. Thesehoneypots also collect credentials and analyze them.

If this system is a honeypot, your access will be reported as abuse.Your credentials will be logged. Your IP address will be blocked.

If you believe that your access has been misidentified as abuse,please contact USU IT Security at security@usu.edu or 435-797-1804.---

Denyhosts is the bomb. Seriously, I get weeks where I used to get hammered with ssh login dictionary attacks. Now, denyhosts nicely bans them, and best of all, it can share back with a central server so once somebody starts attacking a couple people, we all ban their asses. It's one of the first things I install on any new server. Seriously, I think I'm going to go send the DH guys another donation because they're so damned awesome.

Who needs to synchronize ban lists? Have it ban a host for a week or so after 10 failed attempts (for both existing and nonexistent accounts, so they can't brute-force usernames). No meaningful number of brute-force attempts will get through to any box that way.

1: A honeypot might get someone in legal hot water if someone then launches criminal activity from it. For example, if someone's honeypot was used for torrents or CP, it will be tough explaining to cops (or the RIAA's pet judge) that the owner knowingly allowed such activity to happen and hoping not to get found culpable/convicted.

We use honeypots purely for denyhosts purposes. These are machines which are not in DNS and should never have machines connect to it. If a machine connects, we assume that it's malicious and add it to a blocklist which is shared amongst the rest of our machines. No one ever gets in to the honeypot. One could wait for a failed login attempt to occur (it would be a little more generous to scanners who aren't trying to break in)--it's just a tradeoff. We're much harsher.

The longer answer is do anything you want. I highly recommend spending a lot of time to configure an "administrator" login. Then have it take one to a fake directory with nothing important. Wait until that IP drops off the inevitable giant pile of files to be shared with other people, and then when all the stuff is uploaded. Disable it and keep the files. It seems like pretending to be there for a short while could get you many gigabytes of something. It would be like peer to peer in reverse.

Depending on the nature of "something", you might not actually want to have it. If someone would upload some pirated terrorist child porn to your server, left a log file on his PC and gets busted by the cyber police, you and your server would be their next target.

The basis for social construct is that the collective does the work of the individual to prevent abuse. If the collective (police) won't do the work, then by default it returns back to the individual. But you're right, however the "they" you speak of is "us".

Hmmm, on the systems I help look after we occasionally see large number of RDP sessions with invalid logons.
On some rare occasions we've been able to RDP to the source IP (get to the logon screen). Gives me the impression that its a bot.

Because they'd spend many hours of police time and all the hastle of getting the ISP to hand over the address, and in all probability find some fourteen-year-old script kiddie who is playing with a brute-force program and password list he grabbed off of a site with two many Zs in the name.

There's a decent chance that the box that's actually trying to connect is already pwned by the person making the login attempt. Retribution against the (owner of the) box is likely to be retribution against a fellow victim. At least—I dunno about ftp—I use ssh with hosts.allow/deny to control access, which does a reverse DNS lookup so I get the host names of attackers in my logs, and a high percentage of them look like small mail servers and the like, so I'm pretty sure they're already pwned.