Entra

View Full Version : Problemi sicurezza linksys WAG54GX2 - help esperti linux


-Giro-
10-11-2006, 13:21
Ciao ragazzi :)
il problema è che questo apparecchio ha queste porte aperte di default
http://www.planetmobile.it/uploads/Giro/Images/shields_up.jpg

Ho chiamato la linksys e mi hanno detto che non c'è nulla da fare :muro:

Purtroppo non sono riuscito a risolvere cercando in rete, sembra che non ci sia modo !!
Servirebbe qualche esperto di unix/linux che riesce tramite CLI a chiudere queste porte ...abilitando il debug e connettendosi tramite telnet si riescono a vedere le varie cartelle /bin /etc /www col comando ls -al, si entra nelle sottocartelle e si vedono tutti i files, ma dove si mette mano ??

Digitando busybox esce una lista di comandi che possono essere utilizzati....

Qualcuno è in grado di aiutarmi/ci a chiudere quelle porte ? o magari scoprire il comando ?

-Giro-
14-11-2006, 19:57
uppete :)

dai raga, è importante :(

V4N3X
15-11-2006, 11:32
Sorry....non trovo informazioni sufficienti sul firmware.
Solitamente, i files di configurazione, nei sistemi UNIX hanno estensione .conf.
Con l'editor "vi" dovresti poter editarli e sovrascriverli.
Tuttavia, non essendo informato sul firmware, come prima soluzione io ti consiglierei di forwardare le porte aperte su di un indirizzo LAN inesistente.
Dall'esterno, così, dovrebbero risultare immancabilmente chiuse.
Se so qualcosa in più, riposto. ;)
P.S. se provi a chiuderle esplicitamente, impostando il modulo firewall, che succede??
P.P.S. cosa c'e' nella directory /etc?? Quali sono i comandi listati??

-Giro-
15-11-2006, 15:56
GRAZIE !!

allora, il comando "vi" non funziona (non lo trova), lo va a cercare in /bin/sh

Purtroppo il modulo firewall non permette di settare nulla o quasi

http://www.planetmobile.it/uploads/Giro/Images/firewall.jpg

Nella dir /etc ci sono queti files e cartelle
# cd etc
#
# ls -al
drwxrwxrwx 1 root root 0 Jan 1 1970 .
drwxr-xr-x 1 root root 0 Jan 1 1970 ..
drwxrwxrwx 1 523 11 0 Jan 1 1970 CVS
drwxr-xr-x 1 root root 0 Jan 1 1970 adsl
lrwxrwxrwx 1 root root 22 Jan 1 1970 airgo -> /tmp/fs1/usr/etc/airgo
prw-r--r-- 1 root root 0 Nov 15 14:44 cmd_agent
-rwxrwxrwx 1 523 11 83 Nov 15 13:27 crontab
-rw-r--r-- 1 root root 3772 Jan 1 1970 default
-rwxrwxrwx 1 523 11 135 Jan 1 1970 dhcp-fwd.cfg
-rw-r--r-- 1 root root 4428 Jan 1 1970 gateway.xml
-rw-r--r-- 1 root root 0 Jan 1 1970 gateways
-rwxrwxrwx 1 523 11 25 Jan 1 1970 group
-rwxrwxrwx 1 523 11 147 Jan 1 1970 hosts
-rw-r--r-- 1 root root 26 Jan 1 1970 htpasswd
-rw-r--r-- 1 root root 9 Jan 1 1970 hw_id
-rwxr--r-- 1 root root 1062 Jan 1 1970 ipsec.conf
drwxr-xr-x 1 root root 0 Jan 1 1970 ipsec.d
-rwxr--r-- 1 root root 42 Jan 1 1970 ipsec.secrets
drwxrwxrwx 1 523 11 0 Jan 1 1970 l7-protocols
-rwxrwxrwx 1 523 11 57 Jan 1 1970 passwd
drwxrwxrwx 1 523 11 0 Jan 1 1970 ppp
drwxr-xr-x 1 root root 0 Jan 1 1970 rc.d
-rwxrwxrwx 1 523 11 3019 Jan 1 1970 rcS
-rwxrwxrwx 1 523 11 66 Jan 1 1970 resolv.conf
lrwxrwxrwx 1 root root 28 Jan 1 1970 restore_config.cgi -> /usr/sbin/restore_config.cgi
lrwxrwxrwx 1 root root 19 Jan 1 1970 setup.cgi -> /usr/sbin/setup.cgi
-rw-r--r-- 1 root root 147 Jan 1 1970 sysinfo
-rwxrwxrwx 1 523 11 636 Jan 1 1970 syslog.conf
-rwxrwxrwx 1 523 11 948 Jan 1 1970 udhcpc.fix.script
-rwxrwxrwx 1 523 11 1272 Jan 1 1970 udhcpc.script
-rwxrwxrwx 1 523 11 372 Jan 1 1970 udhcpc.wizard.script
-rw------- 1 root root 218 Jan 1 1970 udhcpd.conf
lrwxrwxrwx 1 root root 27 Jan 1 1970 upgrade_flash.cgi -> /usr/sbin/upgrade_flash.cgi
lrwxrwxrwx 1 root root 25 Jan 1 1970 upload_lang.cgi -> /usr/sbin/upload_lang.cgi
-rwxrwxrwx 1 523 11 9 Jan 1 1970 version

In blu sono le dir, ma gli altri colori ? che differenze ci sono ?

Digitando busybox esce questa lista di funzioni che si possono utilizzare
#
# busybox
BusyBox v1.00 (2006.06.13-08:21+0000) multi-call binary

Usage: busybox [function] [arguments]...
or: [function] [arguments]...

BusyBox is a multi-call binary that combines many common Unix
utilities into a single executable. Most people will create a
link to busybox for each function they wish to use, and BusyBox
will act like whatever it was invoked as.

Currently defined functions:
[, ash, awk, busybox, cat, chmod, chown, cp, date, df, dmesg,
echo, expr, free, gzip, hostname, ifconfig, init, insmod, ip,
kill, killall, linuxrc, ln, losetup, ls, lsmod, mkdir, modprobe,
mount, netstat, ping, ping2file, ps, pwd, reboot, rm, rmmod, route,
sed, sh, sleep, sort, sysinfo, tar, test, tr, traceroute, tty

#

Le cartelle della root sono queste
# ls -al
drwxr-xr-x 1 root root 532 Jan 1 1970 bin
drwxr-xr-x 1 root root 0 Jan 1 1970 dev
lrwxrwxrwx 1 root root 8 Jan 1 1970 etc -> /tmp/etc
drwxr-xr-x 1 root root 920 Jan 1 1970 lib
lrwxrwxrwx 1 root root 11 Nov 15 14:26 linuxrc -> bin/busybox
dr-xr-xr-x 38 root root 0 Jan 1 1970 proc
drwxr-xr-x 1 root root 216 Jan 1 1970 sbin
drwxr-xr-x 1 root root 0 Jan 1 1970 tmp
drwxr-xr-x 1 505 249 116 Jan 1 1970 usr
lrwxrwxrwx 1 root root 8 Jan 1 1970 var -> /tmp/var
lrwxrwxrwx 1 root root 8 Jan 1 1970 www -> /tmp/www
drwxrwxrwx 1 523 11 1748 Jan 1 1970 www.eng
#

In /tmp c'è il file firewall.conf (scritto in bianco), ma non so come aprirlo :(

Fammi sapere se ti serve qualche altra info, intanto provo come hai detto e ti ringrazio in anticipo :)

EDIT: provato e funziona !!! quelle porte ora sono Stealth !! :) .....dovrò vedere tutte le altre ora....chissà quali e quante :muro:
Ma possibile che con un NetGear si possano bloccare tutte le porte e con questo no ?!?! :muro:

V4N3X
15-11-2006, 19:37
GRAZIE !!
provato e funziona !!! quelle porte ora sono Stealth !! :) .....dovrò vedere tutte le altre ora....chissà quali e quante :muro:
Ma possibile che con un NetGear si possano bloccare tutte le porte e con questo no ?!?! :muro:

:winner: :yeah: :ubriachi: Per adesso sei a posto. Il firmware del tuo router è basato su FreeSWAN, un firewall UNIX a sua volta basato su IPSec.
Noto comunque che mancano alcuni comandi. Mi riservo di documentarmi meglio più tardi. Se manca il vi cominciamo male: dovresti casomai usare EDIT. Quando ho tempo vedo di studiare meglio la struttura di FreeSWAN, per vedere se si può sovrascrivere manualmente qualche file, e sopratutto "quale" file è possibile utilizzare nel tuo router.
Veramente questa cosa delle porte aperte di default mi è nuova: solitamente, di default le porte stanno tutte chiuse, in ingresso, mentre quelle in uscita sono aperte.

V4N3X
15-11-2006, 19:56
Aggiornamento: proprio il file firewall.conf dovrebbe fare al caso tuo.
Riuscendo ad editarlo, ci dovrebbe essere una sezione simile a questa
#
# deny spoofing
add 2010 deny ip from 10.0.0.0/8 to any in
add 2010 deny ip from 127.0.0.0/8 to any in
add 2010 deny ip from 172.0.0.0/12 to any in
add 2010 deny ip from 192.0.2.0/24 to any in
add 2010 deny ip from 192.168.0.0/16 to any in
add 2020 reject ip from any to 10.0.0.0/8 out
add 2020 reject ip from any to 127.0.0.0/8 out
add 2020 reject ip from any to 172.0.0.0/12 out
add 2020 reject ip from any to 192.0.2.0/24 out
add 2020 reject ip from any to 192.168.0.0/16 out

# select traffic for natd
add 3000 skipto 3400 ip from any to any via xl0
add 3000 skipto 3400 ip from me to any via xl1
add 3210 divert 8668 ip from any to any
add 3220 skipto 3400 ip from any to me
add 3390 allow ip from any to any

# stateful firewall
add 4990 allow tcp from any to any out via xl1 setup keep-state
add 4990 allow udp from any to any out via xl1 keep-state
add 4990 allow icmp from any to any out via xl1 keep-state

# reject (unreach host) outgoing so we know and don't have to wait
add 4997 reject ip from any to any in via xl0
add 4998 reject ip from any to any out via xl1

# deny incomming for stealth
add 4999 deny ip from any to any

dove puoi notare la voce "deny incomming for stealth". Aggiungendo le porte aperte di default, come in esempio, dovresti poter realizzare lo scopo.
Studia bene il funzionamento e i comandi dell'editor EDIT, e del comando chmod, per cambiare eventualmente i privilegi lettura/scrittura dei files.
STAI MOLTO ATTENTO A CIO' CHE FAI!!!

-Giro-
15-11-2006, 20:39
Devo ringraziarti infinitamente perchè hai risolto il mio (e non solo mio) problema !! :cincin: :winner:

Purtroppo questa cosa delle porte aperte di default c'è anche con dei netgear, leggi QUI (http://www.hwupgrade.it/forum/showthread.php?t=1226155&page=1&pp=20) come è riuscito a risolvere facilmente il problema ....lui ....ma su questo router non c'è modo a parte quello da te indicato....

Tranquillo, sto attentissimo....figurati che nemmeno il comando EDIT funziona !! :muro:
...sembra che i comandi funzionanti siano solo quelli definiti da busybox
...forse sbaglio io, ma entro nella cartella dov'è firewall.conf (/tmp) e scrivo
edit firewall.conf
...mi risponde
/bin/sh: edit: not found

PS: sul sito ftp.linksys.com c'è il sorgente del firmware che utilizzo (1.00.09), potrebbe essere utile ?

EDIT:
questo è il link al sorgente...se può essere utile
ftp://ftp.linksys.com/opensourcecode/wag54gx2/1.00.09