Autore |
Discussione  |
|
volley_3
Advanced Member
    

Nota:
672 Messaggi |
Inserito il - 28/04/2008 : 17:39:09
|
ma perchè con questa stringa mi dice che l'host non è online? nmap -v -PN -sS -sV -sR --reason mioip -e eth0 -S 11.22.33.44 --spoof-mac 0 vorrei vedere se il log di iptables funge a dovere ma non va la scansione....
# nmap -v -PN -sS -sV -sR --reason MIOIP -e eth0 -S 80.34.13.156 --spoof-mac 0
Starting Nmap 4.53 ( htt*://insecure.org ) at 2008-04-28 17:27 CEST Spoofing MAC address EE:45:B7:95:DE:80 (No registered vendor) Initiating ARP Ping Scan at 17:27 Scanning MIOIP [1 port] Completed ARP Ping Scan at 17:27, 0.22s elapsed (1 total hosts) Read data files from: /usr/share/nmap Nmap done: 1 IP address (0 hosts up) scanned in 0.395 seconds Raw packets sent: 2 (84B) | Rcvd: 0 (0B) root[No-Spam]ubuntu:~#
questo è il mio script iptables
# cat /etc/init.d/firewall
#!/bin/bash
#
# Firewall personale by Benjamin (Mizar)
#####################################################################
#Da copiare in /etc/init.d/ per esecuzione automatica con chmod 755 #
#####################################################################
# Indirizzo web di origine #
# htt*://forum.ubuntu-it.org/index.php?topic=12833.0 #
######################################################
#########################
# Definizione Variabili #
#########################
IPTABLES="/sbin/iptables"
IFLO="lo"
IFEXT1="eth0" # Da sostituire con la propria interfaccia: eth0, eth1, ppp0, etc
#IFEXT2="eth1" # Da sostituire con la propria interfaccia: eth0, eth1, ppp0, etc
case "$1" in
start)
########################
# Attivazione Firewall #
########################
echo -n "Attivazione Firewall: "
#################################
# Caricamento Moduli del Kernel #
#################################
modprobe ip_tables
modprobe iptable_nat
modprobe ip_conntrack
modprobe ip_conntrack_ftp
modprobe ip_nat_ftp
modprobe ipt_LOG
modprobe ipt_MARK
modprobe ipt_MASQUERADE
modprobe ipt_REDIRECT
modprobe ipt_REJECT
modprobe ipt_TOS
modprobe ipt_limit
modprobe ipt_mac
modprobe ipt_mark
modprobe ipt_multiport
modprobe ipt_state
modprobe ipt_tos
modprobe iptable_mangle
############################
# Reset delle impostazioni #
############################
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -F -t mangle
$IPTABLES -X
$IPTABLES -X -t nat
$IPTABLES -X -t mangle
################################
# Impostazione Policy standard #
################################
$IPTABLES -P INPUT DROP
$IPTABLES -P FORWARD DROP
$IPTABLES -P OUTPUT ACCEPT
#################################
# Abilitazione traffico interno #
#################################
$IPTABLES -A INPUT -i $IFLO -j ACCEPT
$IPTABLES -A OUTPUT -o $IFLO -j ACCEPT
#############################################################################
# Abilitazione traffico in entrata solo se relativo a pacchetti in risposta #
#############################################################################
$IPTABLES -A INPUT -p tcp -i $IFEXT1 -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -p icmp -i $IFEXT1 -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A INPUT -p udp -i $IFEXT1 -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
#$IPTABLES -A INPUT -p tcp -i $IFEXT2 -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
#$IPTABLES -A INPUT -p icmp -i $IFEXT2 -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
#$IPTABLES -A INPUT -p udp -i $IFEXT2 -m state -s 0/0 --state ESTABLISHED,RELATED -j ACCEPT
#########
# samba #
#########
#$IPTABLES -A INPUT -p udp -m udp -s 192.168.0.0/24 --dport 137 -j ACCEPT
#$IPTABLES -A INPUT -p udp -m udp -s 192.168.0.0/24 --dport 138 -j ACCEPT
#$IPTABLES -A INPUT -m state --state NEW -m tcp -p tcp -s 192.168.0.0/24 --dport 139 -j ACCEPT
#$IPTABLES -A INPUT -m state --state NEW -m tcp -p tcp -s 192.168.0.0/24 --dport 445 -j ACCEPT
########################
# Apertura porte aMule #
########################
$IPTABLES -A INPUT -p tcp --dport 4662 -j ACCEPT
$IPTABLES -A INPUT -p udp --dport 4665 -j ACCEPT
$IPTABLES -A INPUT -p udp --dport 4672 -j ACCEPT
##########################
# transmission #
##########################
#$IPTABLES -A INPUT -p tcp --dport 51413 -j ACCEPT
#$IPTABLES -A FORWARD -p tcp --dport 51413 -j ACCEPT
#$IPTABLES -A OUTPUT -p tcp --dport 51413 -j ACCEPT
#$IPTABLES -A INPUT -p udp --dport 51413 -j ACCEPT
#$IPTABLES -A FORWARD -p udp --dport 51413 -j ACCEPT
#$IPTABLES -A OUTPUT -p udp --dport 51413 -j ACCEPT
#######################
# Apertura porte giFT #
#######################
#$IPTABLES -A INPUT -p tcp --dport 1213 -j ACCEPT
#$IPTABLES -A INPUT -p tcp --dport 2176 -j ACCEPT
#######################
# Apertura porte Msn #
#######################
$IPTABLES -A INPUT -p tcp --dport 1683 -j ACCEPT
#$IPTABLES -A INPUT -p tcp --dport 6981 -j ACCEPT
##############################
# Apertura porte smtp e pop3 #
##############################
#$IPTABLES -A INPUT -p tcp --dport 1024 -j ACCEPT
#$IPTABLES -A INPUT -p tcp --dport 1025 -j ACCEPT
##############################
# Contro attacchi hacker #
##############################
#Rifiuto di rispondere ai ping inviati all'indirizzo broadcast della rete:
echo 0 > /proc/sys/net/ipv4/conf/all/accept_redirects
echo 0 > /proc/sys/net/ipv4/conf/all/accept_source_route
#Rifiuto pacchetti ICMP di route redirection
echo 1 > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter
#Protezione contro attacchi spoofing
echo 1 > /proc/sys/net/ipv4/conf/all/log_martians
#Scarto un flood di pacchetti ICMP fuori taglia (dimensione massima 93 bytes)
$IPTABLES -A INPUT -p ICMP --icmp-type 8 -m length --length 93: -j DROP
### SETTING IPFORWARDING ###
echo "1" > /proc/sys/net/ipv4/ip_forward
### DISABLE RESPOND TO BROADCAST ICMP ###
echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
#log pacchetti drop in var/log/messages
$IPTABLES -A INPUT -j LOG --log-prefix "FW DROP IN: "
echo "ok"
;;
stop)
###########################
# Disattivazione Firewall #
###########################
echo -n "Disattivazione Firewall: "
$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -F -t mangle
$IPTABLES -X
$IPTABLES -X -t nat
$IPTABLES -X -t mangle
$IPTABLES -P INPUT ACCEPT
$IPTABLES -P FORWARD ACCEPT
$IPTABLES -P OUTPUT ACCEPT
echo "ok"
;;
status)
##############################
# Display stato del Firewall #
##############################
echo -n "Regole attuali nel Firewall: "
$IPTABLES -L
;;
restart|reload)
$0 stop
$0 start
;;
*)
echo "Utilizzo: firewall {start|stop|restart|reload|status}" >&2
exit 1
;;
esac
exit 0
COME MAI?
|
|
Gimli
Moderatore
    
.jpg)
Città: Belluno
1870 Messaggi |
Inserito il - 29/04/2008 : 22:24:22
|
Dalla manpage di nmap, opzione '-PR': " ARP scan puts Nmap and its optimized algorithms in charge of ARP requests. And if it gets a response back, Nmap doesn´t even need to worry about the IP-based ping packets since it already knows the host is up. This makes ARP scan much faster and more reliable than IP-based scans. So it is done by default when scanning ethernet hosts that Nmap detects are on a local ethernet network. Even if different ping types (such as -PE or -PS) are specified, Nmap uses ARP instead for any of the targets which are on the same LAN. If you absolutely don´t want to do an ARP scan, specify --send-ip. " Ciao |
 |
|
volley_3
Advanced Member
    

Nota:
672 Messaggi |
Inserito il - 29/04/2008 : 23:19:22
|
quindi? in italiano? |
 |
|
ori
Moderatore
    

Città: Verona
2043 Messaggi |
Inserito il - 30/04/2008 : 00:15:43
|
Riprova aggiungendo l'opzione --send-ip
In pratica, quello che dice la manpage e` che nmap e` ottimizzato nell'usare l'ARP (address resolution protocol) per verificare se un host e` attivo o no. Questo e` fattibile se l'host destinazione e` nella rete locale (senza dover passare da gateway, ad esempio), dato che se c'e` una risposta alla richiesta arp, allora si sa che l'host destinazione e` attivo, senza bisogno di passare ai ping effettivi. |
 |
|
volley_3
Advanced Member
    

Nota:
672 Messaggi |
Inserito il - 30/04/2008 : 09:37:57
|
e quindi perkè mi dice che è down? cioè chi io stesso non sono online?
|
 |
|
ori
Moderatore
    

Città: Verona
2043 Messaggi |
Inserito il - 30/04/2008 : 11:45:27
|
Potrebbe essere iptables che ha impedito il pacchetto di ritorno. Oppure un piccolo errore di nmap. Prova a tirar giu` il firewall e rilanciare nmap e guarda se ottieni risultati diversi. |
 |
|
volley_3
Advanced Member
    

Nota:
672 Messaggi |
Inserito il - 30/04/2008 : 13:38:40
|
sempre stesso errore anche senza firewall... non capisco perkè? sarà fastweb? ma tipo un mesetto fa riuscivo a farlo... bo!
ipotesi? |
 |
|
oRsO
Advanced Member
    

739 Messaggi |
Inserito il - 30/04/2008 : 15:50:49
|
Ho provato sul mio pc..
Citazione: orso[No-Spam]orso-ubu:~$ sudo nmap -v -PN -sS -sV -sR --reason 192.168.0.2 -e wlan0 -S 72.14.221.104 --spoof-mac 0
Starting Nmap 4.53 ( htt*://insecure.org ) at 2008-04-30 15:22 CEST Spoofing MAC address CD:CC:FF:B7:B2:E1 (No registered vendor) Initiating ARP Ping Scan at 15:22 Scanning 192.168.0.2 [1 port] Completed ARP Ping Scan at 15:22, 0.23s elapsed (1 total hosts) Read data files from: /usr/share/nmap Nmap done: 1 IP address (0 hosts up) scanned in 0.414 seconds Raw packets sent: 2 (84B) | Rcvd: 0 (0B) orso[No-Spam]orso-ubu:~$
Da quello che ho potuto constatare i due parametri incriminati sono -S 72.14.221.104 e --spoof-mac 0 Provando ad eliminare i due parametri, infatti, l'output è esattamente quello che ci si aspetta:
Citazione: orso[No-Spam]orso-ubu:~$ sudo nmap -v -PN -sS -sV -sR --reason 192.168.0.2 -e wlan0
Starting Nmap 4.53 ( htt*://insecure.org ) at 2008-04-30 15:25 CEST Initiating ARP Ping Scan at 15:25 Scanning 192.168.0.2 [1 port] Completed ARP Ping Scan at 15:25, 0.01s elapsed (1 total hosts) Initiating SYN Stealth Scan at 15:25 Scanning PC-DESKTOP (192.168.0.2) [1714 ports] Discovered open port 5900/tcp on 192.168.0.2 Discovered open port 139/tcp on 192.168.0.2 Discovered open port 902/tcp on 192.168.0.2 Discovered open port 5800/tcp on 192.168.0.2 Discovered open port 445/tcp on 192.168.0.2 Completed SYN Stealth Scan at 15:25, 11.39s elapsed (1714 total ports) Initiating Service scan at 15:25 Scanning 5 services on PC-DESKTOP (192.168.0.2) Completed Service scan at 15:25, 6.03s elapsed (5 services on 1 host) SCRIPT ENGINE: Initiating script scanning. Initiating SCRIPT ENGINE at 15:25 Completed SCRIPT ENGINE at 15:25, 0.21s elapsed Host PC-DESKTOP (192.168.0.2) appears to be up ... good. Interesting ports on PC-DESKTOP (192.168.0.2): Not shown: 1709 filtered ports Reason: 1709 no-responses PORT STATE SERVICE REASON VERSION 139/tcp open netbios-ssn syn-ack 445/tcp open microsoft-ds syn-ack Microsoft Windows XP microsoft-ds 902/tcp open vmware-auth syn-ack VMware GSX Authentication Daemon 1.10 (Uses VNC) 5800/tcp open vnc-htt* syn-ack TightVNC 5900/tcp open vnc syn-ack VNC (protocol 3.8) MAC Address: 00:12:23:AB:98:C1 (D-Link) Service Info: OS: Windows
Host script results: |_ Discover OS Version over NetBIOS and SMB: Windows XP
Read data files from: /usr/share/nmap Service detection performed. Please report any incorrect results at htt*://insecure.org/nmap/submit/ . Nmap done: 1 IP address (1 host up) scanned in 17.924 seconds Raw packets sent: 3424 (150.654KB) | Rcvd: 6 (272B) orso[No-Spam]orso-ubu:~$
|
Modificato da - oRsO in data 30/04/2008 15:51:42 |
 |
|
oRsO
Advanced Member
    

739 Messaggi |
Inserito il - 30/04/2008 : 15:59:37
|
Guarda se può esserti di aiuto questo.. Dalla Guida di riferimento di Nmap (pagina di manuale), in particolare dalla sezione Bypassing e Spoofing di Firewall e Intrusion Detection System (Firewall/IDS Evasion and Spoofing)):
Citazione: -S <IP_Address> (falsifica l'indirizzo sorgente - "spoof source address")
In talune circostanze Nmap potrebbe non essere in grado di determinare il proprio indirizzo sorgente (in questi casi Nmap avvertira` della problematica). Se cosi` fosse si puo` usare l'opzione -S seguita dall'indirizzo IP dell'interfaccia che si vuole usare per inviare pacchetti.
Un altro possibile uso di quest'opzione potrebbe essere per falsificare ("spoof") la scansione per far credere al bersaglio che qualcun altro li sta prendendo di mira e sta effettuando una scansione su di loro. Si immagini solo cosa potrebbe succedere se un'azienda si accorgesse di essere preda di port scan da parte dei propri concorrenti! L'opzione -e e` in genere richiesta per questo particolare utilizzo, e si consiglia anche di usare -P0.
Citazione: --spoof-mac <mac address, prefix, or vendor name> (Effettua uno spoof dell'indirizzo hardware (MAC))
Richiede a Nmap di usare l'indirizzo hardware (mac) per tutti i frame ethernet raw che invia. Quest'opzione implica --send-eth per garantire che Nmap invii di fatto pacchetti a livello ethernet. Il MAC puo` essere specificato in vari formati: nel caso in cui sia la stringa “0”, Nmap sceglie un MAC completamente random per la sessione. Se la stringa e` un numero pari di simboli esadecimali (con le coppie separate eventualmente dal simbolo di due punti), Nmap usera` questo come MAC. Se dovessero essere specificate meno di 12 cifre decimali, Nmap riempira` il resto dei 6 bytes con valori casuali. Se l'argomento non e` uno zero (0) o una stringa esadecimale, Nmap cerchera` nel file nmap-mac-prefixes per cercare il nome di un produttore contenente la stringa indicata (senza distinguere tra maiuscole e minuscole). Se trova una corrispondenza, Nmap usera` la parte OUI del produttore (il prefisso di 3 bytes) e riempira` i restanti 6 bytes in maniera casuale. Esempi validi dell'uso di --spoof-mac sono Apple, 0, 01:02:03:04:05:06, deadbeefcafe, 0020F2, e Cisco.
|
 |
|
volley_3
Advanced Member
    

Nota:
672 Messaggi |
Inserito il - 30/04/2008 : 17:57:08
|
si gia lo sapevo orso ma perkè un mese fa riuscivo a loggare i miei tentativi di autointrusione e ora non riesco più? cosa sarà successo? |
 |
|
Gimli
Moderatore
    
.jpg)
Città: Belluno
1870 Messaggi |
Inserito il - 01/05/2008 : 13:53:18
|
Quello che succede è: - tu chiedi a nmap di fare una scansione spoofando il tuo MAC address, quindi se il tuo MAC è AA:BB etc. lui invia i pacchetti con MAC BB:CC etc. - nmap si accorge di stare su una rete locale, quindi a prescindere da quello che gli hai detto con -PN fa arping $(TUO_IP), quindi manda dei bellissimi pacchetti 'arp who has $(TUO_IP) tell $(MAC_SPOOFATO)' in broadcast sulla tua rete - il tuo pc vede arrivare questi pacchetti e risponde 'arp IP $(TUO_IP) is at $(TUO_MAC)', diretto a $(MAC_SPOOFATO), dove non arriveranno mai. Capito? Edit: non ho testato con tcpdump, ma mi pare l'unica spiegazione plausibile |
Modificato da - Gimli in data 01/05/2008 14:04:10 |
 |
|
volley_3
Advanced Member
    

Nota:
672 Messaggi |
Inserito il - 01/05/2008 : 19:51:39
|
capito e perkè non funziona anche solo lo spoof ip con lopzione -e eth0 -S ip_fake ????
mentre prima funzionava? qualche aggiornamento di hardy? che gli da maggior sicurezza? |
 |
|
|
Discussione  |
|