Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here. |
| 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-29-2005, 04:37 PM
|
#1
|
|
Senior Member
Registered: Feb 2003
Location: Washington D.C
Posts: 2,052
Rep:
|
Disconnect An Established Connection
I RECENTLY RAN NETSTAT -PANTU AT A FRIEND OF MINES PC AT HOME. IT SHOW A ESTABLISHED CONNECTIONS ON A PORT THAT LOOKED SUSPICIOUS. IT TURNS OUT THAT IT WAS A BACK DOOR PROGRAM. IN LINUX, HOW WOULD I MANUALLY DISCONNECT AN ALREADY ESTABLISHED CONNECTIONS?
|
|
|
|
08-29-2005, 10:16 PM
|
#2
|
|
Senior Member
Registered: Mar 2003
Distribution: Fedora
Posts: 3,658
Rep:
|
You could kill the listening process using the PID number you got from the netstat output. If your friend has a backdoor installed on his system, then he'll need to do alot more than kill the individual connection if he wants his system to be considered even remotely secure. A full wipe and re-installation from trusted media is the only solution for a security breach of that magnitude. Also if you/he plan on doing any forensic analysis of the system, then killing the connection is going to be an immediate tipoff that the compromise has been detected. You're better off either immediately pulling the network cable or trying to sniff/intercept the connection.
Btw, please don't post in all caps as it is annoying to read.
Last edited by Capt_Caveman; 08-29-2005 at 10:17 PM.
|
|
|
|
08-30-2005, 12:05 PM
|
#3
|
|
Senior Member
Registered: Feb 2003
Location: Washington D.C
Posts: 2,052
Original Poster
Rep:
|
I guess if I keep annoying Captain Caveman then I will never get a response from you ever. I will be more diligent and pay alot more attention to my grammitical edicate. Now back to the question. Can you please give me an example of killing the pid (syntax)
|
|
|
|
08-30-2005, 12:58 PM
|
#4
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
Using this sample line from netstat -pantu on my machine:
Code:
tcp 0 0 131.XX.155.XX:41786 64.233.187.99:80 ESTABLISHED 9650/firefox-bin
At the end where you see 9650/firefox-bin, 9650 is the PID. So you can kill the process from the console with 'kill 9650'.
|
|
|
|
08-30-2005, 04:26 PM
|
#5
|
|
Senior Member
Registered: Feb 2003
Location: Washington D.C
Posts: 2,052
Original Poster
Rep:
|
Matir you are the man and thanks to mr caveman for his input as well. This is a stupid question but I am going to throw this out there. My question is as such:
1 - A good set of standard security measures would be iptables rules, snort (IDS), tripwire, syslogger and etc.. to prevent most want to be hackers out of your system. Would this be feasable. I would like to create a script that would run every couple of minutes (3 min)and check for establish connections to your system using netstat and I would set up a criteria saying that if your not this certain IP (allowing only certain IP from the outside world) to disconnect you by sending the output of the script to kill the pid using the netstat command. The reason I would use this would be if all of the other security items failed then my script would definately kick them off and or just modify my script to put any IP that is not valid or allowed from the oustide in to add that to my iptables block rule or put it in my host/deny.
give me some feedback thanks.
Last edited by metallica1973; 08-30-2005 at 04:28 PM.
|
|
|
|
08-30-2005, 09:33 PM
|
#6
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
Why don't you just use a firewall to only allow certain connections? 
|
|
|
|
08-31-2005, 04:49 PM
|
#7
|
|
Senior Member
Registered: Feb 2003
Location: Washington D.C
Posts: 2,052
Original Poster
Rep:
|
If all else failed(firewall, ids and etc..)I could use netstat to see the established connection. Basically it works like such:
every 3 min my script checks for established connections, if there is a connection that is established while I am on the system then boom disconnects that intruder and adds them to my block rule in IPTABLES. Like you were saying under IPTABLES I would only allow a certain IP address (from work)to my system at home. My system should one have one connection comming from the outside in and that is just me at work looking at my system. If I am at home and I my scripts sees another established connection other then the one I specify them it would flag and add the rogue IP to the IPTABLES - Block rule and this would be an extra added step of security. thanks
|
|
|
|
08-31-2005, 05:00 PM
|
#8
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
And a simple:
Code:
iptables -A INPUT -j ACCEPT -p tcp --dport 22 -s IP.AT.WO.RK
iptables -A INPUT -j DROP -p tcp --dport 22
Would not achieve the same?
|
|
|
|
08-31-2005, 05:53 PM
|
#9
|
|
Senior Member
Registered: Feb 2003
Location: Washington D.C
Posts: 2,052
Original Poster
Rep:
|
Matir,
you are the man. true but what happens if a cracker gets past the firewall?
|
|
|
|
08-31-2005, 07:50 PM
|
#10
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
In this case... if he (somehow) gets around the firewall, the only way would require a source IP being one of the ones allowed by the firewall... and thus the connection would show as coming from there.
|
|
|
|
08-31-2005, 08:13 PM
|
#11
|
|
Senior Member
Registered: Feb 2003
Location: Washington D.C
Posts: 2,052
Original Poster
Rep:
|
Matir,
Many thanks to all of your responses. I have much respect!
|
|
|
|
08-31-2005, 09:15 PM
|
#12
|
|
Moderator
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,505
Rep: 
|
No problem. Just trying to help where I can. 
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 12:58 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|