SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I never had any trouble with malware in Linux until the other day when I caught my Slackware box trying to download a number of files from dgnfd564sdf.com. A little Google searching revealed that this is a known malware site located in Beijing. Apparently they crack your root password and use ssh to modify your crontab to download the files. I never use ssh for anything so I was a little disconcerted to learn that I had this big security hole that somebody was trying to exploit.
One file that did get downloaded was sfewfesfs which showed up in my /etc directory. When I tried to delete it I discovered that, even as root, I couldn't delete it. Even worse the sticky bit was set. I did a Google search on the file name and discovered a page full of sinister looking crontab entries that somebody had posted on Pastebin.
I had been planning to upgrade the box to Slackware 13.37 anyway so I reformatted the hard drive and installed Slack with a tougher root password. Then, after doing a little reading up on the subject, I configured ssh to ban root logins altogether. Before I did the install I noticed that my computer was spawning a bunch of sendmail jobs that didn't go anywhere because I had my internet connection shutdown. Apparently the whole idea of this thing is to turn your computer into a spambot. Has anyone else had trouble with this?
The reason that you could not remove the file as root likely was that the hacker set the "immutable" bit on it. This is one of several additional permission bits outside of the normal *nix bits.
To see if the immutable bit is set on "foo" do:
lsattr foo
The "i" below indicates that the immutable bit is set:
----i---------- foo
Turn off the immutable bit as root thusly:
chattr -i foo
Then you can remove the file.
There are other solutions to prevent a brute-force attack against ssh passwords. The best is to use a private key for ssh access. You can generate one with:
You might also take a look at fail2ban. After a configurable number (three is a popular setting) of failed login attempts, it blocks the originating IP address for a configurable amount of time.
I think this topic is better suited for the Linux - Security section of LQ.org. The people there will likely know more than us about these things.
...some of the people there tend to be lured in easily by including words like "cracked", "hacked", "malware", etc, etc in thread titles :-]
Quote:
Originally Posted by TobiSGD
1. Insecure root password
2. Remote root login allowed
3. SSH server running, though not used
You couldn't make it much easier for those crackers.
Allowing root and not using pubkey auth and allowing remote root access, exactly! Shame people still have to learn things the hard way.
Quote:
Originally Posted by GVrooman
(..) I reformatted the hard drive and installed Slack with a tougher root password. Then, after doing a little reading up on the subject, I configured ssh to ban root logins altogether. (..)
Reinstalling the OS was a good choice given evidence elsewhere suggests both script-based as well as manual modifications as root. (Note crontab-based tricks aren't something new, its been around for ages, and depending on purposes may not even require root access. If one is stupid enough to allow say the web server user a crontab then, given a vuln in popular software in the web stack, that may be enough.) Do ensure all passwords are changed (not only root), ensure you implement the advice given, harden your machine basically, and if you have any 'net facing services do ensure you not only have active response (like fail2ban) but also regularly audit the box (say Samhain + Logwatch?) to be able to investigate any anomalies before they become a problem.
Regarding fail2ban, I prefer a more proactive approach: Using /etc/hosts.{allow,deny} and/or iptables to restrict who can connect to sshd in the first place. I also disable password authentication and root login. These settings are effective on Slackware. On other systems, it is also necessary to disable PAM, or else PAM will "override" the sshd configuration. Ideally, sshd wouldn't even be listening on the Internet. It would all be done over a VPN instead. This would help guard against undiscovered security bugs and 0-days.
Actually, the real shame is that remote root login is allowed by default.
Having just stumbled on this thread, I thought I'd better check this out. Looking at my sshd_config file I find:
#PermitRootLogin yes
which implies (to me!) that the default is not to allow a root login. My system is 14.0 (haven't got around to updating to 14.1 yet!). Am I reading this correctly? And does this mean that at some point between the OPs system and mine, this loophole was closed? I am no security expert!
It is commented out, so it is NOT allowed by default. I have also checked the 14.1 package.
That's unfortunately an incorrect analysis.
@pchristy: I agree with you the line, as written, suggests the default is to not allow root logins. However, the default does
allow them. Sound practice (unless you have special needs and know what you're doing) is to set "PermitRootLogin no" in
/etc/ssh/sshd_config. Maybe Slackware should ship that as default.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.