Welcome to Linux Forums! With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.
Write an article for LinuxForums Today! Win Great Prizes!
Find the answer to your Linux question:
New to Linux Forums? Register here for free!
    Linux Forums > Your Distro > Gentoo Linux Help > newbie help: foolish I got hacked

Forgot Password?
 Gentoo Linux Help   For help and discussion related to Gentoo Linux

Site Navigation
Linux Articles
Linux Forums
Linux Downloads
Linux Hosting
Free Magazines
Job Board
IRC Chat
RSS Feeds
Linux Forum Topics
Linux Forums
Your Distro
Linux Resources
GNU Linux Zone
The Community
Reply
 
Thread Tools Display Modes
Old 12-31-2008   #1 (permalink)
Just Joined!
 
Join Date: Dec 2008
Posts: 2
newbie help: foolish I got hacked

I've fooling around with linux boxes for quite a while, but here got my first introduction to the scary world that exhist outside of my safe pre-programmed router. Here is My problem:

I was converting my ubuntu server to gentoo to set up a nat gateway between the router and the wired network. I was going to add firewall / proxy and a few things and start to move services off the underpowered router.

Mistake 1: using an overly simple password while setting up system. I ssh alot, have to keep restarting and so genorally just use keyboard rolls when I'm setting up. I won't do it again.

So I set up two nics, iptables, dhcp and samba. Got internal computers connecting to the net.

Mistake 2: Putting the router in "demilitarized zone" on router. Basically means all non-nat-port-forwarded-ports go to box I just set up. with open ssh. And simple password.

Might hove just been bad luck, but within ten minuteo on reconnecting via ssh my previous login was from an aol address somewhere in America (I'm in Australia).

So I restarted router (dynamic IP from ISP at least they wont know where I am). I checked iptables rules there are a few rampant accepts in the hope that if I set up firewall correctly I will gloss over it. It annoys me that some 12 yo from kentucky has got into my system but I,m not out for revenge or anything. My question from a reasonable noobie is apart from beefing password, deleting iptables rules, hiding server back behind properly set up router what can I do?

I have generic syslog-ng set up; is there any way to see what has been tinkered with? I've put only about 10 hours into setting up server, should I just scrap it and start again?
kimbecause is offline  



Reply With Quote
Old 12-31-2008   #2 (permalink)
Just Joined!
 
cheapscotchron's Avatar
 
Join Date: Dec 2008
Location: swamps of jersey
Posts: 68
kimbecause,

You can review the shell history files to see what was done.
You can run rootkit hunter to look for back doors.
But a smart intruder will cover his tracks well.

The best approach would be to scrap it and start over.

CSR
cheapscotchron is offline   Reply With Quote
Old 12-31-2008   #3 (permalink)
Just Joined!
 
Join Date: Dec 2008
Posts: 2
Ok thanks . . . those are the lessons you learn I guess.
kimbecause is offline   Reply With Quote
Old 01-03-2009   #4 (permalink)
Linux User
 
Join Date: Sep 2008
Location: Oosterhout, Netherlands
Posts: 445
The best way to learn things is by learning them the hard way, which is what you just did. I also learnt something the hard way. I gave my friend access to my server (it's a home server, nothing important) with sudo access (it's Ubuntu) through SSH, and I told him only to use a client installed on the pc and not a web bases one. He used a web based one, and my system got cracked, cracker screwed up the system, and while I was trying to fix it, my friend tried to log out, which didn't work so he rebooted, ehhh, auch, screwed up the whole system and got kernel panic, could reinstall the system! (Happy I had back-uped my system)
Bemk is offline   Reply With Quote
Old 01-04-2009   #5 (permalink)
Linux Engineer
 
Freston's Avatar
 
Join Date: Mar 2007
Location: The Netherlands
Posts: 832
It's also a very good idea to run SSH over a port other than 22. Change that to somewhere above 3000 (I admit, it's completely arbitrary).

It wont help your security one bit, but many evil portscans don't go so high up and thus a lot of scriptkiddies wont attempt at breaking in. I used to have possibly hundreds of attempts to break in per day, and now none.


Also, you can use iptables to block out a lot of addresses by range. I have a filter that is pretty crude, but it stops 70~80% of all 'hostile' traffic while blocking none of the 'friendly' traffic. If someone is out to get you, this isn't even remotely watertight. But it seems most attacks are just opportunistic, this is quite effective if only because it keeps the logs quiet.
If you are interested, I posted it in the security section.
__________________
Can't tell an OS by it's GUI
Freston is offline   Reply With Quote
Old 01-04-2009   #6 (permalink)
Linux User
 
Join Date: Sep 2008
Location: Oosterhout, Netherlands
Posts: 445
I do have a port set, it is around the range 10.000 - 100.000, good luck finding it. The only thing is that my friend used a web based client which doesn't check the key, so there was a man in the middle. Ouch, that hurt. It took me 3 days to restore the damage done in 3 minutes. So learn the lesson I learnt this way: "Be smart and do ssh only inside your network, never over WAN, you don't know whether or not there is somebody listening!"
Bemk is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Free Magazines
A Newbie's Getting Started Guide to Linux
Learn the basics of the Linux operating systems. Get to know what it is all about, and familiarize yourself with the practical side. Basically, if you're a complete Linux newbie and looking for a quick and easy guide to get you started this is it.
subscribe
Run Your Own Web Server Using Linux & Apache - Free 191 Page Preview
Learn about everything you'll need to build and maintain your Linux servers, and to deploy Web applications to them.
subscribe
Open Source Security Myths Dispelled
Dispel the five major myths surrounding Open Source Security and gain the tools necessary to make a truly informed decision for your IT organization
subscribe
InformationWeek
InformationWeek is the only newsweekly you'll need to stay on top of the latest developments in information technology.
subscribe



All times are GMT. The time now is 08:14 AM.






© 2000 - - All Rights Reserved - Property of  MAS Media

Content Relevant URLs by vBSEO 3.3.1