intrusos ssh2

Imagen de edidanilo

Forums: 

tengo el siguiente mensaje en mail/root
From MAILER-DAEMON@localhost.localdomain Sat Mar 31 12:51:05 2007
Return-Path:
Received: from localhost.localdomain (linux4 [127.0.0.1])
by localhost.localdomain (8.13.1/8.13.1) with ESMTP id l2VHp4Iq002470
for ; Sat, 31 Mar 2007 12:51:04 -0500
Received: from localhost (localhost)
by localhost.localdomain (8.13.1/8.13.1/Submit) id l2VDFKBK023854;
Sat, 31 Mar 2007 08:21:38 -0500
Date: Sat, 31 Mar 2007 08:21:38 -0500
From: Mail Delivery Subsystem
Message-Id: <200703311321.l2VDFKBK023854@localhost.localdomain>
To: root@localhost.localdomain
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
boundary="l2VDFKBK023854.1175347298/localhost.localdomain"
Subject: Warning: could not send message for past 4 hours
Auto-Submitted: auto-generated (warning-timeout)

This is a MIME-encapsulated message

--l2VDFKBK023854.1175347298/localhost.localdomain

**********************************************
** THIS IS A WARNING MESSAGE ONLY **
** YOU DO NOT NEED TO RESEND YOUR MESSAGE **
**********************************************

The original message was received at Sat, 31 Mar 2007 04:02:03 -0500
from root@localhost

----- Transcript of session follows -----
root... Deferred: Connection timed out with [127.0.0.1]
Warning: message still undelivered after 4 hours
Will keep trying until message is 5 days old

--l2VDFKBK023854.1175347298/localhost.localdomain
Content-Type: message/delivery-status

Reporting-MTA: dns; localhost.localdomain
Arrival-Date: Sat, 31 Mar 2007 04:02:03 -0500

Final-Recipient: RFC822; root@localhost.localdomain
Action: delayed
Status: 4.4.1
Remote-MTA: DNS; [127.0.0.1]
Last-Attempt-Date: Sat, 31 Mar 2007 08:21:38 -0500
Will-Retry-Until: Thu, 5 Apr 2007 04:02:03 -0500

--l2VDFKBK023854.1175347298/localhost.localdomain
Content-Type: message/rfc822

Return-Path:
Received: (from root@localhost)
by localhost.localdomain (8.13.1/8.13.1/Submit) id l2V923Jh021290
for root; Sat, 31 Mar 2007 04:02:03 -0500
Date: Sat, 31 Mar 2007 04:02:03 -0500
From: root
Message-Id: <200703310902.l2V923Jh021290@localhost.localdomain>
To: root
Subject: LogWatch for linux4

################### LogWatch 5.2.2 (06/23/04) ####################
Processing Initiated: Sat Mar 31 04:02:02 2007
Date Range Processed: yesterday
Detail Level of Output: 0
Logfiles for Host: linux4
################################################################

--------------------- Kernel Begin ------------------------

Logged 2296 packets on interface eth1
From 24.78.164.10 - 2 packets to tcp(2967)
From 24.214.46.223 - 3 packets to tcp(4899)
From 41.249.7.13 - 2 packets to tcp(135)
From 64.86.67.78 - 1 packet to tcp(1103)
From 64.86.121.11 - 1 packet to tcp(5900)
From 64.184.80.39 - 3 packets to tcp(139)
From 67.184.222.153 - 1 packet to tcp(5900)
From 75.27.146.194 - 2 packets to tcp(8080)
From 76.111.5.10 - 1 packet to tcp(5900)
From 82.12.243.135 - 1 packet to tcp(5900)
From 84.3.253.164 - 3 packets to tcp(135)
.
.
.
.
**Unmatched Entries**
Invalid user delta from ::ffff:62.149.230.151
Failed password for invalid user delta from ::ffff:62.149.230.151 port 36875 ssh2
Invalid user admin from ::ffff:62.149.230.151
Failed password for invalid user admin from ::ffff:62.149.230.151 port 37134 ssh2
Invalid user test from ::ffff:62.149.230.151
Failed password for invalid user test from ::ffff:62.149.230.151 port 37403 ssh2
Invalid user fluffy from ::ffff:24.189.76.235
Failed password for invalid user fluffy from ::ffff:24.189.76.235 port 60470 ssh2
Invalid user admin from ::ffff:24.189.76.235
Failed password for invalid user admin from ::ffff:24.189.76.235 port 33360 ssh2
Invalid user test from ::ffff:24.189.76.235
Failed password for invalid user test from ::ffff:24.189.76.235 port 35026 ssh2
Invalid user guest from ::ffff:24.189.76.235
Failed password for invalid user guest from ::ffff:24.189.76.235 port 36003 ssh2
Invalid user webmaster from ::ffff:24.189.76.235
Failed password for invalid user webmaster from ::ffff:24.189.76.235 port 36954 ssh2
.
..
etc
etc
de que trata esto y algunas direcciones ip son:
125.244.34.131
200.3.248.22
85.128.118.110
128.121.244.238
72.4.161.226
203.190.10.253
85.144.41.191

a que se debe??????

Cambia el puerto del ssh

Imagen de Monkito

En la actualidad hay un gusano que busca el puerto 22 de c/ip pública existente y enpieza a enviar un ataque por diccionario con el fin de encontrar una clave vulnerable y subir un rootkit.

La solución sería cambiar el puerto en sshd.conf de 22 a cualquiera que no sea privilegiado ej 8526, también cambiar en /etc/services luego de esto sólo podras acceder a tu pc con "ssh ip -p 8526" y el gusano no sabrá en que puerto está tu sshd escuchando.

Pero así tambien al momento de hacer ssh desde el host en cuestión a cualquier otro deberás usar la opción "-p 22" ya que ahora el puerto por defecto es otro.

A mi me pasó eso, y lo solucioné de ese modo..

bye

Cogito Ergo Sum

------------
counter.li.org

Cogito Ergo Sum

La recomendaciòn es buena o

Imagen de damage

La recomendaciòn es buena o tambien puedes denegar con iptables las conexiones entrantes provinientes a ssh a esa interfaz y solo permitir que cierta o ciertas ip's puedan usar el ssh.

Keep The Fire Burning.....
Stryper 1988
http://counter.li.org/

gracias por las

Imagen de edidanilo

gracias por las recomendaciones, pero podrias ser mas explicito y dar una guia de como denegar con iptables las conexiones entrantes provinientes a ssh a esa interfaz y solo permitir que cierta o ciertas ip's puedan usar el ssh.

saludos
..........
Ekipolinux
(593)-06-2832838
(593)-097104119

..........
edidanilo
Gana mucho dinero
(593)-06-2832726
(593)-091351355

Te puedo ayudar con un script completo

Imagen de Monkito

Primero necesitamos saber que es lo que hace tu pc a la que queires entrar por ssh desde ciertos hosts.

ej, hace nat?, es proxy?, (da internet a otros?) comaparte archivos? (samba), es servidor web?, de correos?, dns? en fin todo lo que haga tu pc en la red.

por otro lado las reglas de iptables se rigen a la política por defecto que uses en tu firewall, sería bueno que postees la salida de:

iptables -nL

ej: si tienes política DROP para input las reglas quedan así:

IP1="la primera ip con acceso a ssh"
IP2="la segunda ip con acceso a ssh"
IP3="la tercer ip con acceso a ssh"

iptables -A INPUT -p tcp --dport 22 -s $IP1 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -s $IP2 -j ACCEPT
iptables -A INPUT -p tcp --dport 22 -s $IP3 -j ACCEPT

si tienes políticas ACCEPT queda "casi" igual, solo que al final de las reglas anteriores agregas:


iptables -A INPUT -p tcp --dport 22 -s 0/0 -j DROP

en fin todo depende de las reglas que tengas previamente estableciadas en tu firewall, por eso es mejo hacer un script desde el principio, ya que aunque hagas DROP a todas las ip "0/0" en una línea de iptables no sabemos si antes de que lea esa línea hay otra regla diciendo lo contrario, en ese caso no va a funcionar...

Cogito Ergo Sum

------------
counter.li.org

Cogito Ergo Sum

cada vez que quiero

Imagen de edidanilo

cada vez que quiero conectarme ahora internamente obtengo lo siguiente
[root@ekipolinux ~]# ssh xx@10.2.19.1
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
f6:6e:06:51:21:72:17:58:fd:ed:c8:b7:c5:f7:5f:b0.
Please contact your system administrator.
Add correct host key in /root/.ssh/known_hosts to get rid of this message.
Offending key in /root/.ssh/known_hosts:1
RSA host key for 10.2.19.1 has changed and you have requested strict checking.
Host key verification failed.
-------------------------------------------------------------------------
la salida de iptables -nl es:
[root@linux4 ~]# iptables -nL
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
DROP all -- 0.0.0.0/0 0.0.0.0/0
DROP all -- 0.0.0.0/0 127.0.0.0/8
ACCEPT all -- 10.2.19.0/24 0.0.0.0/0
ACCEPT tcp -- 0.0.0.0/0 0.0.6.187
DROP all -- 10.2.19.0/24 0.0.0.0/0
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 8 limit: avg 1/sec burst 5
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 8
DROP icmp -- 0.0.0.0/0 10.2.19.255
DROP icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTAB LISHED
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137
ACCEPT udp -- 200.107.10.62 0.0.0.0/0 udp spt:53
ACCEPT udp -- 200.107.60.58 0.0.0.0/0 udp spt:53
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:21
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:22
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:23
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:25
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:53
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:53
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:110
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:10000
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1433 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: MSSQL '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1433
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6670 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Deepthrt '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6670
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6711 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Sub7 '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6711
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6712 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Sub7 '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6712
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6713 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Sub7 '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6713
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12345 limit : avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Netbus '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12345
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12346 limit : avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Netbus '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:12346
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20034 limit : avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: Netbus '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:20034
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:31337 limit : avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: BO '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:31337
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6000 limit: avg 3/hour burst 5 LOG flags 0 level 4 prefix `Firewalled packet: XWin '
DROP tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:6000
DROP udp -- 0.0.0.0/0 0.0.0.0/0 udp dpts:33434:3352 3
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:113 reject- with icmp-port-unreachable
REJECT 2 -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-po rt-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 reject-w ith icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 reject- with icmp-port-unreachable
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:0x16/0x02 limit: avg 5/min burst 5 LOG flags 0 level 4 prefix `Firewalled packet:'
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 reject-with tcp-res et
DROP all -- 0.0.0.0/0 0.0.0.0/0

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP all -- 0.0.0.0/0 0.0.0.0/0 state INVALID
DROP icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 8
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:137 reject- with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:138 reject- with icmp-port-unreachable
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:139 reject- with icmp-port-unreachable
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:137 reject- with icmp-port-unreachable
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:138 reject- with icmp-port-unreachable
REJECT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:139 reject- with icmp-port-unreachable
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80
ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723
DROP icmp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTAB LISHED
LOG tcp -- 0.0.0.0/0 0.0.0.0/0 tcp flags:0x16/0x02 limit: avg 5/min burst 5 LOG flags 0 level 4 prefix `Firewalled packet:'
REJECT tcp -- 0.0.0.0/0 0.0.0.0/0 reject-with tcp-res et
DROP all -- 0.0.0.0/0 0.0.0.0/0

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0

Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0 icmp type 255
ACCEPT esp -- 0.0.0.0/0 0.0.0.0/0
ACCEPT ah -- 0.0.0.0/0 0.0.0.0/0
ACCEPT udp -- 0.0.0.0/0 224.0.0.251 udp dpt:5353
ACCEPT udp -- 0.0.0.0/0 0.0.0.0/0 udp dpt:631
ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTAB LISHED
REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-ho st-prohibited
[root@linux4 ~]#

..........
edidanilo
Gana mucho dinero
(593)-06-2832726
(593)-091351355

Sólo un comentario

Imagen de tuxero

El "error" (entre comillas) se debe a que la identificación del HOST es incorrecta, puedes eliminar la que ya existe editando el archivo known_hosts dentro de .ssh en tu directorio de usuario.

Atendiendo a todas las recomendaciones hechas y repitiendo acerca de eso.

1. Puedes cambiar el puerto del SSH (optativo). :)
2. Verificar que tengas habilitada la conexión como super usuario.
3. Verificar que el número de intentos de conexión no sea mayor de 2 ó 3
4. No permitir claves en blanco.
5. Generar claves de identificación entre las máquinas que quieras pertmirles conexión remota, para que sólo entre ellas se permita.
6. Establecer restricciones a nivel del firewall para sustentar y mejorar la opción anterior.
7. Tener chequeadores de rootkit's por cualquier cosa, chkrootkit, rkhunter
8. Revisar los logs del sistema tales como secure, messages, lastlog, etc, etc...

Y pues como ya mencioné inicialmente, simple y sencillamente seguir las indicaciones descritas por los demás compañeros, trabajar con Google como aliado y pues revisar todo al revés y al derecho.

[email]geml_ecuador@yahoo.com[/email] [img]http://counter.li.org/cgi-bin/certificate.cgi/378903[/img]

Antes fueron los dinosaurios los que se extinguieron, ahora le está llegando la hora a Micro$oft

Gabriel Eduardo Morejón López. [email]gabrielmorejon@gmail.com[/email] [img]http://counter.li.org/cgi-bin/certificate.cgi/378903

Utilizar el hosts.allow y el

Utiliza el hosts.allow y el hosts.denny

por ejemplo:


#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
sshd: 192.168.1.

aqui vas a poner a todos los hosts que quieren que entre a tu pc.

#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# The portmap line is redundant, but it is left to remind you that
# the new secure portmap uses hosts.deny and hosts.allow. In particular
# you should know that NFS uses portmap!

sshd:ALL

aqui deniegas a todos..

Saludos

Ahi tienes sacrip, y mas

Imagen de damage

Ahi tienes sacrip, y mas recomendaciones, que más puedes pedir, si no conectas por el mensaje man in the middle has lo que dice tuxero borra el archivo known_host, que el mismo mensaje te dice la ruta, eso es todo y deniega ya sea por iptables o con host deny

Keep The Fire Burning.....
Stryper 1988
http://counter.li.org/

Páginas