Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Networking & Security
  • Search

i got hacked. what were they up to?

Having problems getting connected to the internet or running a server? Wondering about securing your box? Ask here.
Post Reply
Advanced search
443 posts
  • Page 12 of 18
    • Jump to page:
  • Previous
  • 1
  • …
  • 10
  • 11
  • 12
  • 13
  • 14
  • …
  • 18
  • Next
Author
Message
59729
Apprentice
Apprentice
Posts: 279
Joined: Mon Jun 21, 2004 12:57 am

  • Quote

Post by 59729 » Fri Apr 01, 2005 3:06 pm

Legoguy wrote:Beware. The list of names they try is getting longer:

http://turbogfx.homelinux.org/sshattempts.txt

That was logged on the 25th, 6 days ago. 587 attempts within 10 minutes. Of course none of them were harmful (none of them existed) but I'd imagine the list is getting longer as the thing breaks into more boxes.

Starting from October 29th 2004, there have been 4166 attempts on my machine... none of them doing anything. You only really need to worry if you have a user/pass the same, although I can't confirm that, but it seems to be the case.

To find all of the relevant items in your log:

Code: Select all

grep "sshd\[[0-9]\+\]: \(Invalid\|User\|reverse\)" /var/log/messages
Add a " | wc -l " on it to see the number of attempts.
Actually

Code: Select all

grep -c "sshd\[[0-9]\+\]: \(Invalid\|User\|reverse\)" /var/log/messages
does the trick, no need to pipe
Top
Randseed
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 111
Joined: Thu Apr 01, 2004 6:19 pm

  • Quote

Post by Randseed » Sat Apr 02, 2005 7:13 pm

bcore wrote:Yeah, I'm SSH'ed in from work most days.. Easiest way to check my email and transfer files between.

I'd say the moral of the story here is don't create a test account, and if you do, don't also make it's password "test", and if you do that too, don't forget to delete it. :)
If you can, set up OpenVPN as a server on your home machine, and then OpenVPN as a client on the work box. Then only allow incoming connections on the OpenVPN server. Then to even see ssh, they have to somehow crack OpenVPN first, THEN ssh in.
Top
tdi
Apprentice
Apprentice
Posts: 170
Joined: Wed Aug 25, 2004 3:21 pm

  • Quote

Post by tdi » Thu Apr 07, 2005 1:35 pm

use knocked.
they first have to know the order of knocks ...

or hardcore sci-fi version:
use OpenVPN with ssh in it over the ppp in ICMP (ppp over icmp is possible)
Top
moocha
Watchman
Watchman
Posts: 5722
Joined: Tue Oct 21, 2003 6:45 pm

  • Quote

Post by moocha » Thu Apr 07, 2005 1:39 pm

Or, easier: Don't use passwords. Use public key authentication and passphrases.
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Top
rdvrey
Tux's lil' helper
Tux's lil' helper
Posts: 92
Joined: Mon Mar 03, 2003 10:39 pm
Location: Netherlands, Amersfoort

  • Quote

Post by rdvrey » Thu Apr 21, 2005 8:15 am

Why not use sshd (or webmin) for remote control, but ...
make sshd use another port something weird and odd say 41567
and use portsentry to setup traps and 41560-41566 and 41568-41575
This way it is not a standard port and will only be found if a full port scan is done (costs a lot of time to scan).
But any scan from 0-65000 or the other way round, will fall in the portsentry trap before reaching anything serious
Portsentry then puts the IP address in the deny list of the firewall which totaly blocks that IP for any form of connection.

Works for me for many years now.


Robert

PS don't make a typo when connecting yourself, you will get banned yourself (i haved that to)
Top
moocha
Watchman
Watchman
Posts: 5722
Joined: Tue Oct 21, 2003 6:45 pm

  • Quote

Post by moocha » Thu Apr 21, 2005 8:28 am

Or, easier: Don't use passwords. Use public key authentication and passphrases.
:)
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Top
rdvrey
Tux's lil' helper
Tux's lil' helper
Posts: 92
Joined: Mon Mar 03, 2003 10:39 pm
Location: Netherlands, Amersfoort

  • Quote

Post by rdvrey » Thu Apr 21, 2005 8:31 am

[quote="moocha"]Or, easier: [b]Don't use passwords. Use public key authentication and passphrases.[/b]
:)[/quote]

But then you will need to have your key anywhere you go, I don't
Top
pinger
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 128
Joined: Thu Mar 18, 2004 3:00 pm

  • Quote

Post by pinger » Thu Apr 21, 2005 2:51 pm

3650 attempts since last May. All of them unsuccesful as far as I can tell. I have a nice collection of emails from ISPs saying they sent official warning letters or even kicked their users. Methinks a couple of script kiddies out there had some explaining to do to Daddy :lol:
Top
mallchin
l33t
l33t
User avatar
Posts: 655
Joined: Tue Jan 21, 2003 9:59 pm
Location: United Kingdom
Contact:
Contact mallchin
Website

  • Quote

Post by mallchin » Sat Apr 23, 2005 12:27 am

grep: /var/log/messages: No such file or directory :roll:
6700 @ 2.66GHz, 4Gb RAM, 2 x 500Gb, 8800 GTX, PhysX, X-Fi, 24" Widescreen, Tux mascot
Top
amne
Bodhisattva
Bodhisattva
User avatar
Posts: 6378
Joined: Sun Nov 17, 2002 6:00 pm
Location: Graz / EU

  • Quote

Post by amne » Mon Apr 25, 2005 5:27 pm

Split off Unknown MAC in WLAN
Dinosaur week! (Ok, this thread is so last week)
Top
nshade
n00b
n00b
Posts: 3
Joined: Tue Apr 26, 2005 2:10 am

Just incase you have not figured out what they did.

  • Quote

Post by nshade » Tue Apr 26, 2005 2:26 am

I am not sure if you ever figured out what was done on your system but I can tell you after seeing a lot of this from working for a server farm that offers servers for what ever you want like hosting and stuff.

I see it every day. What happend to you was a brute force ssh scan that they found an account with an insecure password as you have stated the user account test with the password test. This happens daily where I work because people are umm how shall I say this.. dumb in creating an account with the same password.

Well those files you found are for launching an attack on another server or computer.. AKA packet kiddies do this to take someone off line or take a site off line when multiple servers/workstations are compromised this way they use them to launch a DDOS attack..

It kinda sucks yes but that is why you should always stress on security and securing your server/workstation and making dang sure that your passwords are secure as well no username and password should be the same.


Well anyway they are basicly botnets that sit on an IRC server some where in a certian channel waiting for the commands to launch an attack some some poor sole. Imagine having over 300 workstations/servers on various backbones hitting your website/workstation/server it will and can take it off line atleast till your isp/firewall/hosting provider implements some type of protection agianst this.

Even though they may have gotten in as a simple user does not mean they have not tried to gain root access either. I would recommend looking at your netstats try ' netstat -nlp ' and double checking the ports. I would also recommend doing a ps -aux |grep (username) and then checking the processes running by them you can always do ' ls /proc/pid#### -al ' and it should tell you where the files are located.

And for those running apache or a web server of any sort check /tmp, /var/tmp , /dev/shm, you may also want to check incase you are running samba /var/spool/samba and also /usr/local/apache/proxy or /user/local/apache/vbox.

Seen to many exploits scripts and the starts of root kits to be installed or programs to obtain root by some means.

I hope this gave you an idea where to look as well incase they may of installed programs else where besides there home directory.

I would also check your log files agian, most likely the ips are spoofed, or through an open proxy or if they are stupid enough to use there own ip.. well you can always e-mail the ARIN contact or the ISP's upstream provider the logs.

I know I may be a noob, but after working with redhat, freebsd, and yes even windows for a while I see a lot of exploits scripts, attack scripts and root level compromises where I work.


Hope this helps you and other people.

NS
Top
ThePsychotic2k
n00b
n00b
Posts: 56
Joined: Wed Jun 16, 2004 10:18 am
Location: Bristol

  • Quote

Post by ThePsychotic2k » Sat Apr 30, 2005 5:13 pm

Unfortantually this is the way of the internet. More and more traffic is being generated everyday with these type of attacks

I feel so much safer in the last couple of months as my Uni has finally put a firewall up between external and internal connections (including blocking port 22). I havn't had any ssh connection attempts since, I only log other connetion attemps on port 22 and the only time I ever got anything is when I'm sshing in and i forget to put -p xxxx.

But before the nice firewall i just used these simple ideas (and still do):
-- run sshd on a non default port
-- don't allow ssh root access
-- use iptables to block any connetions to any port apart from what you use (only my ssh port for me)
Top
electrofreak
l33t
l33t
User avatar
Posts: 713
Joined: Wed Jun 30, 2004 2:11 am
Location: Ohio, USA
Contact:
Contact electrofreak
Website

  • Quote

Post by electrofreak » Sun May 01, 2005 12:55 am

bcore wrote:Yeah, I'm SSH'ed in from work most days.. Easiest way to check my email and transfer files between.

I'd say the moral of the story here is don't create a test account, and if you do, don't also make it's password "test", and if you do that too, don't forget to delete it. :)
Or at the very least turn off sftp and ftp and the like access and change the shell to /bin/false
Top
AA
n00b
n00b
User avatar
Posts: 59
Joined: Tue Jul 29, 2003 3:27 am
Contact:
Contact AA
Website

  • Quote

Post by AA » Mon May 02, 2005 12:27 am

bcore: Since you only ssh into your machine from work you might want to set iptables to block all connections except those from your work ip address: assuming your work ip is static and not dynamic.

this should do it: someone please correct me if i'm wrong. as i am hardly an expert when it comes to iptables!

Code: Select all

iptables -A INPUT -p tcp -s xxx.xxx.xxx.xxx/GG -d yyy.yyy.yyy.yyy/SS  --dport 22 -j ACCEPT
iptables -A INPUT -p tcp -s 0/0 -d yyy.yyy.yyy.yyy/?? --dport 22 -j DROP
where xxx.xxx.xxx.xxx is the work's gateway ip and yyy.yyy.yyy.yyy your home machine ip.
GG the work live ip subnet and SS your home machine subnet
Top
jmckay123456789
n00b
n00b
Posts: 46
Joined: Sat Aug 16, 2003 9:15 pm

why try to stop attempts? Just have strong defenses.

  • Quote

Post by jmckay123456789 » Wed May 04, 2005 5:38 pm

I see people say "I see how many attempts there are on my machine, is there a way to stop it?".
I don't see why (or how) you need to stop attempts as long as your total security situation looks good.
I'm very comfortable with my security, even though I get hundreds of attempts a day against me. My approach is pretty simple:


My firewall has the minimum number of ports open. So in you only want to ssh into the machine, you only need one port open. This means you only have to worry about one class of attacks, namely attacks on your ssh access.

So how do we secure our ssh? Well what are the vulnerabilities?

1) Flaws in the program/protocol. I feel good about these kinds of problems as long as I keep my ssh software up to date. There is a theoretical possibility that a black hat finds a vulnerability and exploits it before the maintainers of the ssh software ever find out. But if you have someone that good trying to hack your system, you have other problems.

2) Weak passwords, dictionary attacks, etc. My approach has been to:

a) Restrict the world of logins that work by editing my sshd config. I have disallowed root access, and in fact I disallow all access except by certain users. In my case that is just me plus my wife. So in addition to breaking my password they would have to guess one of our usernames. It is no inconvenience to me not to have root access because I can just su root as soon as I login.

b) Have strong passwords. Since there are only two usernames with access (thanks to above), I only have two passwords that I have to ensure are strong.


So to summarize:
Firewall allows only ports you need
Keep your ssh software up to date
Restrict users who can login remotely to those that need that capability
Make sure those users have strong passwords

With those rules in mind, when I see that I have had hundreds of attempts it doesn't really bother me. 90% of them are attempts against the root user, most of the rest are either against users like "www" or "mysql" or against names like "jim", "sarah", or other common names. I have yet to see a single attempt at either of my real usernames. And should they do that, they will still have to crack a strong password.

I feel like an elephant being attacked by gnats. It just doesn't bother me.
Top
GNUtoo
Veteran
Veteran
User avatar
Posts: 1919
Joined: Thu May 05, 2005 9:39 pm

  • Quote

Post by GNUtoo » Mon May 09, 2005 8:22 pm

boh i don't know if i sould post it (it could give some ideas to some person)
i'me a little bit lazy so i've not read all the post(it's long to read) but i could help a bit
i suppose that you have talked about securising the computer
but you have may have forgeted to securise the modem ...
some modems have defaults passwords...
so change the passwords
maybe the firmware could also be upgraded (in some case there are some security holes)
Top
ruurd
n00b
n00b
Posts: 8
Joined: Fri Jan 07, 2005 3:48 pm

  • Quote

Post by ruurd » Wed May 11, 2005 6:51 pm

honesty makes me have to say that I didn't read all 12 pages, skipped the middle part, so this post might make no sense at all. Please ignore if so.

I also noticed the SSH stuff, and I made a script to kick them out for a day after 15 attempts. I know it's *no* protection mechanism, so please look 2 posts up and do what's said there, but following the 90% reasoning: the script just reduces the chance that they might succeed a little, and just reduces the mess in your /var/log/messages or /var/log/auth.

To run this script you will need a working iptables and 'at' (emerge at).

Code: Select all

#!/bin/sh
# vim:ts=4:sw=4:tw=0

# Ruurd Koons 24th April 2005
# This script scans for failed login attempts and pushes the IP of
# frequent failing clients on the iptables list, which are removed
# using an at job afterwards.  The main purpose of this script is
# to stop ssh login attacks in an early stage of the process.
# Design note: it seems that a grep in front of awk activates input
# buffering, which delays the actual awk processing.  The piped
# greps below are only because of this reason done in awk itself.
# grep sshd | grep "Failed password" | grep -o -e "\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}" | 

SCANFILE="/var/log/messages";
LOGFILE="/var/log/banned_scanners";

if [ "$1" != "" ];
then
	comm="$1";
else
	comm="tail --max-unchanged-stats=5 --follow=name $SCANFILE";
fi

if [ "$2" == "-d" ];
then
	debug=1;
else
	debug=0;
fi

$comm | awk -v debug="$debug" -v logfile="$LOGFILE" '
	BEGIN	{ treshold = 15; timeout = 30 * 60; }
			{
			  if ($5 ~ /^sshd\[[0-9]+\]:$/ &&
			      $0 ~ /Failed password/ &&
			      $(NF - 3) ~ /[0-9]([0-9][0-9]?)?\.[0-9]([0-9][0-9]?)?\.[0-9]([0-9][0-9]?)?\.[0-9]([0-9][0-9]?)?$/)
			  {
			  	$0 = $(NF - 3);
				if ($0 ~ /^::ffff:/) $0 = substr($0, 8);
			  	if (debug + 0 != 0) print $0, attempt["count"$0], attempt["time"$0];
				
				attempt["count"$0] += 1;
				if (systime() - attempt["time"$0] > timeout) {
				  attempt["count"$0] = 1;
				}
				attempt["time"$0] = systime();
				if (attempt["count"$0] > treshold &&
				  $0 !~ /0+\.0+\.0+\.0+/ &&
				  $0 !~ /255/)
				{
				  if (debug + 0 == 0) {
					  print systime() " " $0 >> logfile;
					  system("iptables -A INPUT -j DROP --source " $0);
					  system("echo iptables -D INPUT -j DROP --source " $0 " | at now + 1 day >& /dev/null");
				  } else {
				  	print systime() " " $0;
				  }
				  attempt["time"$0] = null;
				  attempt["count"$0] = null;
				}
			  }
			}
	END		{ }
' &
The log that is written allows for later use such as permanent banning of returning IP's or distribution between serveral hosts in for instance a university network.

To recap what the script does:
- it adds the IP to the iptables INPUT chain when an IP fails to login using SSH
* over 15 times
* within 30 minutes
- the 'ban' lasts currently one day
- the ban is recorded in a small logfile, where the IP is prepended by the current UNIX epoch time

The main reason to ban only for a day is to keep the iptables chain small, as it will grow rapidly if you ban all, and most of them never come back after a day (from my experience).

I thought I'd share my script, maybe someone likes it also.

Cheers!
Top
bluedevils
Apprentice
Apprentice
Posts: 252
Joined: Wed Jul 21, 2004 3:02 pm
Location: Vancouver BC -> NYC, NY

  • Quote

Post by bluedevils » Wed May 11, 2005 7:12 pm

In addition to using firewalls to limit access to work's IP only, you could also set either a cron for sshd on the box or a rule on the firewall to make it only available during work hours. This should help to limit the time they have access to that port. A cron on the box might be easier to manage if you need to do extra stuff outside of work hours.
Top
Dreadfull
Tux's lil' helper
Tux's lil' helper
Posts: 139
Joined: Fri Apr 15, 2005 9:18 pm

  • Quote

Post by Dreadfull » Sat May 14, 2005 11:39 am

Code: Select all

May 14 07:46:22 godshells sshd[9499]: Did not receive identification string from ::ffff:201.243.124.239
May 14 07:51:11 godshells sshd[9542]: Invalid user jordan from ::ffff:201.243.124.239
May 14 07:51:11 godshells sshd[9542]: reverse mapping checking getaddrinfo for 201-243-124-239.genericrev.cantv.net failed - POSSIBLE BREAKIN ATTEMPT!
how nice ..
i was sleeping at that hour and also noone knew my ip ..
CPU: AMD Athlon 64 3200+
RAM: 2 GB DDR 400 Dual channel
HDD: 2x200 GB WDC SATA
OS: Gentoo 2005.1
Compiler: GCC 3.4.5
kernel: 2.6.14-hardened-r5
Top
sixtymhz
n00b
n00b
Posts: 7
Joined: Mon May 16, 2005 8:52 pm

  • Quote

Post by sixtymhz » Mon May 16, 2005 8:58 pm

If anyone wants to know how these guys are hiding their tracks...

history -c
> .bash_history

cat /dev/null > /var/log/messages
cat /dev/null > /var/log/wtmp

Just to name a few.

Also wouldn't be a bad idea to

chmod 700 /usr/bin/wget
chmod 700 /usr/bin/perl
Top
freebies_11
n00b
n00b
Posts: 36
Joined: Thu Dec 09, 2004 1:01 pm

  • Quote

Post by freebies_11 » Tue May 17, 2005 1:28 am

sixtymhz wrote:chmod 700 /usr/bin/wget
chmod 700 /usr/bin/perl
This is an incredibly bad idea.
Top
moocha
Watchman
Watchman
Posts: 5722
Joined: Tue Oct 21, 2003 6:45 pm

  • Quote

Post by moocha » Tue May 17, 2005 1:37 am

Heelios wrote:
sixtymhz wrote:chmod 700 /usr/bin/wget
chmod 700 /usr/bin/perl
This is an incredibly bad idea.
Indeed.
That will break a lot of packages and will help exactly nothing - what's to prevent the attacker from simply uploading a statically linked wget? Nothing, that's what.
If you want to prevent certain accounts from doing networking, you can always use iptables' owner-match support, for example.
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Top
sixtymhz
n00b
n00b
Posts: 7
Joined: Mon May 16, 2005 8:52 pm

  • Quote

Post by sixtymhz » Tue May 17, 2005 8:34 pm

eh, well I guess if you are paranoid, it wouldn't be to bad >_<
Plus I was speaking in terms of already being hacked. My friend was hacked with the hacker using wget to exploit his forum and so forth. Setting the wget and perl to 700 stopped him from doing anything else untill he got his server up and running again (and updated!!)

But thanks for the insight.

Could you give a better example of the IPTABLES owner-match deal please?
Top
moocha
Watchman
Watchman
Posts: 5722
Joined: Tue Oct 21, 2003 6:45 pm

  • Quote

Post by moocha » Wed May 18, 2005 2:19 am

sixtymhz wrote:eh, well I guess if you are paranoid, it wouldn't be to bad >_<
Yes it would. Every application depending on perl (and those are legion) will break for a non-root user, thus forcing you to use root more, thus creating more security holes than it "fixes".
sixtymhz wrote:Plus I was speaking in terms of already being hacked.
If a breakin already happened then it's ten times as pointless - if the enemy is already inside it's too late to fill the moat....
sixtymhz wrote:Could you give a better example of the IPTABLES owner-match deal please?
See the iptables tutorial :). IIRC, owner-match comes in the standard gentoo-sources too, not only in hardened, so it shouldn't be hard to figure out.
Military Commissions Act of 2006: http://tinyurl.com/jrcto

"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety."
-- attributed to Benjamin Franklin
Top
sixtymhz
n00b
n00b
Posts: 7
Joined: Mon May 16, 2005 8:52 pm

  • Quote

Post by sixtymhz » Wed May 18, 2005 8:33 pm

Cool deal, thanks :wink:
Top
Post Reply

443 posts
  • Page 12 of 18
    • Jump to page:
  • Previous
  • 1
  • …
  • 10
  • 11
  • 12
  • 13
  • 14
  • …
  • 18
  • Next

Return to “Networking & Security”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic