help, 這是SSh attack 嗎?

help, 這是SSh attack 嗎?
#>netstat -t
出現了2千多行... 全部都是 :ssh 結尾....
而且果果ip 不同...

tcp        0      1 newinst.layeredtech.c:34778 148.228.226.5:ssh           SYN_SENT
tcp        0      0 newinst.layeredtech.c:59940 148.228.128.245:ssh         TIME_WAIT
tcp        0      0 newinst.layeredtech.c:53239 148.228.150.57:ssh          TIME_WAIT
tcp        0      0 newinst.layeredtech.c:49385 148.228.150.54:ssh          TIME_WAIT
tcp        0      0 newinst.layeredtech.c:55396 148.228.150.209:ssh         TIME_WAIT
tcp        0      0 newinst.layeredtech.c:53135 148.228.150.57:ssh          TIME_WAIT

有沒有方法可以Stop 佢地????

[ 本帖最後由 kamcm 於 2009-1-13 09:02 編輯 ]

識唔識 iptables 寫法?
我自己就用 rate limit 方法限制某D port 每分鐘最多幾多 connections, 都幾有較防止太多呢D port flooding.

*filter
:INPUT ACCEPT [252898:160685288]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [266511:51492353]
:pinglimit - [0:0]
:ratelimit - [0:0]
:syn-flood - [0:0]
[280736:183036820] -A INPUT -j syn-flood
[279:319686] -A INPUT -s 192.168.1.0/24 -p tcp -m tcp --dport 22 -j ACCEPT
[0:0] -A INPUT -s 127.0.0.1/32 -p tcp -m tcp --dport 22 -j ACCEPT
[5368:502028] -A INPUT -p tcp -m tcp --dport 22 -j ratelimit
[0:0] -A INPUT -p icmp -m icmp --icmp-type 8 -j pinglimit
[0:0] -A pinglimit -m limit --limit 1/sec --limit-burst 1 -j ACCEPT
[0:0] -A pinglimit -j DROP
[4712:463228] -A ratelimit -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT
[416:24592] -A ratelimit -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -m limit --limit 10/min --limit-burst 10 -j ACCEPT
[240:14208] -A ratelimit -p tcp -j LOG --log-prefix "[RATELIMIT]" --log-level 5
[240:14208] -A ratelimit -p tcp -j DROP
[261052:163276818] -A syn-flood -m limit --limit 100/sec --limit-burst 150 -j RETURN
[19684:19760002] -A syn-flood -j DROP
COMMIT

呢個係我自己用的 iptables rules,其中 192.168.1.0/24 係我 LAN IP range, 因為唔想 block 埋自己內部 connection 所以 ACCEPT,其中 22 port 會入 ratelimit tables 度做返個 limit,如果你有其他 port 想 limit connection rate 就加條 rules 就得,太多 connection 會 block 一陣同 log 低在 syslog/messages/dmesg,

Fedora/RHEL/Red Hat based 就晌 /etc/sysconfig/iptables
Gentoo 或其他就放 /var/lib/iptables/rules-save

TOP

原來唔係我果Server 比人Attack...而係有人用左我果Server 去做 SSH Attack

Once I type "service httpd stop", all record in netstat-t disappeared....

Before I typed "service httpd stop",

I saved all of the process record in a note pad,

and it's seem the attacker use a script to initial the attack

Theresore, the username is apache but not root..

apache 11980 0.0 0.0 4732 620 ? S 06:23 0:06 ./wssh
apache 11982 0.0 0.0 4732 608 ? S 06:23 0:06 ./wssh
apache 11989 0.0 0.0 4732 664 ? S 06:23 0:07 ./wssh
apache 11990 0.0 0.0 4732 624 ? S 06:23 0:06 ./wssh
apache 11994 0.1 0.8 13564 7976 ? S 06:23 0:12 ./wssh
apache 11995 0.2 0.4 8328 4268 ? S 06:23 0:16 ./wssh
apache 11997 0.0 0.0 4732 520 ? S 06:23 0:05 ./wssh
apache 11999 0.2 0.4 8328 3940 ? S 06:23 0:17 ./wssh
apache 12003 0.1 0.2 7088 2880 ? S 06:23 0:08 ./wssh
apache 12004 0.0 0.0 4732 312 ? S 06:23 0:00 ./wssh
apache 12009 0.0 0.0 4732 512 ? S 06:23 0:01 ./wssh
apache 12012 0.1 0.6 13436 5808 ? D 06:23 0:12 ./wssh
apache 12013 0.2 0.2 8328 2792 ? S 06:23 0:15 ./wssh
apache 12022 0.0 0.0 4732 632 ? S 06:23 0:06 ./wssh
apache 12134 0.1 0.8 13308 7720 ? S 06:25 0:11 ./wssh
apache 12144 0.0 0.0 4732 284 ? S 06:26 0:00 ./wssh
apache 12162 0.0 0.0 4732 536 ? S 06:26 0:05 ./wssh
apache 12167 0.0 0.2 6096 2048 ? S 06:26 0:06 ./wssh
apache 12175 0.1 0.2 6592 2440 ? S 06:26 0:07 ./wssh
apache 12184 0.1 0.3 12540 3168 ? D 06:26 0:10 ./wssh
apache 12185 0.1 0.1 12156 1064 ? S 06:26 0:11 ./wssh
apache 12188 0.0 0.1 5600 1440 ? S 06:26 0:03 ./wssh
apache 12194 0.0 0.0 4732 516 ? S 06:26 0:05 ./wssh
apache 12195 0.0 0.2 6348 2268 ? S 06:26 0:06 ./wssh
apache 12204 0.0 0.0 4732 508 ? S 06:26 0:05 ./wssh
apache 12230 0.0 0.0 4732 512 ? S 06:27 0:05 ./wssh
apache 12253 0.0 0.0 4732 512 ? S 06:29 0:05 ./wssh


但我做完 Updatedb 再 執行 locate wssh 而搵唔到有呢個files..

但係tmp 入面又見到有...

[root@server /]# cd tmp
[root@server tmp]# ls -all
total 10688
drwxrwxrwt   4 root   root     69632 Jan 13 09:40 .
drwxr-xr-x  24 root   root      4096 Dec  7 12:12 ..
-rwxr-xr-x   1 apache apache    4172 Jun  2  2006 cback
-rw-r--r--   1 apache apache    4172 Jun  2  2006 cback.2
-rw-r--r--   1 apache apache    4172 Feb  2  2008 cback.3
-rw-r--r--   1 apache apache    4172 Feb  2  2008 cback.4
-rw-r--r--   1 apache apache    4172 Feb  2  2008 cback.5
-rw-r--r--   1 apache apache    4172 Feb  2  2008 cback.6
-rw-r--r--   1 apache apache    4172 Feb  2  2008 cback.7
drwxrwxrwt   2 root   root      4096 Dec  7 12:13 .font-unix
drwxrwxrwt   2 root   root      4096 Dec  7 12:12 .ICE-unix
-rw-------   1 apache apache      70 Jan 13 08:36 sess_005c0fe3ad1cb8282572229ba6c61c20
-rw-------   1 apache apache      70 Jan 13 08:47 sess_07229d19a7547e80a291255b77dce975
-rw-------   1 apache apache     598 Jan 10 10:32 sess_4b19fb454922e4f4457125837a85ee67
-rw-------   1 apache apache    2170 Jan 10 07:05 sess_4ea0703014a0ab7032e90f985cde7b75
-rw-------   1 apache apache      70 Jan 13 08:35 sess_53640f971edab45ff7e008170f9504ff
-rw-------   1 apache apache    3755 Jan 10 08:34 sess_61dc1f478da08caf5774c2ed6ac5f04b
-rw-------   1 apache apache    3425 Jan 10 04:57 sess_68e90264fbc72055135dd3dcbab9cdf6
-rw-------   1 apache apache    1060 Jan 10 05:46 sess_6d4051e802ba7d5f1387abf6b2029cdc
-rw-------   1 apache apache    2121 Jan 10 10:37 sess_7afe3ed8455e2f3f35dc5ce8b666b131
-rw-------   1 apache apache    2313 Jan 10 09:59 sess_86430e9ac1f247628b7d4159dc304ced
-rw-------   1 apache apache     598 Jan 10 10:37 sess_965bd5ec39f6bf616b46a35bf47b04fd
-rw-------   1 apache apache    1060 Jan 10 06:13 sess_a1d47a3de2f0ca5f1819e664a35bb499
-rw-------   1 apache apache      70 Jan 13 08:46 sess_ca4fb5fc3345ec876854ccd944ad2d8c
-rw-------   1 apache apache    1060 Jan 10 10:05 sess_e4cadcafa1fc9cc04c9746881fc08562
-rw-------   1 apache apache    3258 Jan 13 09:40 sess_e53a1efb57b4ea27e91488d71bffade3
-rw-------   1 apache apache    2453 Jan 10 10:32 sess_ee14e1999e8188fad38bc15134b4d91d
-rwxr-xr-x   1 apache apache 3569280 Jan 12 09:41 wssh
-rw-r--r--   1 apache apache 3569280 Jan 12 09:41 wssh.1
-rw-r--r--   1 apache apache 3569280 Jan 12 09:41 wssh.2

但真係諗爆頭都唔明..果果人係點把D script upload 去 tmp 的?

[ 本帖最後由 kamcm 於 2009-1-13 09:54 編輯 ]

TOP

你個 web 有冇 php 野? php upload default 會放 /tmp

TOP

原帖由 lazyfai 於 2009-1-13 10:07 發表
你個 web 有冇 php 野? php upload default 會放 /tmp


有php 野.. 但全果Server 只有一個Domain..
而且在Public_html  同時放了  .htaccess .htpasswd [加了密碼]
而且  .htaccess  內有  IndexIgnore *.*
確保其他人撞到password , 都見唔到D files..   

最後一點就係.我Server 入面應該係冇Update Script 之類的Script.. 所以不知道他是如果把Files Upload 到 tmp...

TOP

已找到人解答了...

是Directadmin 出了 嚴重 loophole...

http://directadmin.com/forum/showthread.php?p=147702

[ 本帖最後由 kamcm 於 2009-1-13 10:34 編輯 ]

TOP