Archivio per la categoria 'Sicurezza'

È la marea di svolta?

3 giugno 2010

Sono stato detto per anni che l'anti-virus non è più efficace e che una postura buona sicurezza deve includere lista bianca delle applicazioni. Ecco una citazione fresco da George Kurtz, chief technology officer di McAfee:

"Non si può fare affidamento solo sui software antivirus - e siamo una società di antivirus. E firewall da solo non forniscono una protezione adeguata ", ha detto.

Antivirus, firewall e rilevamento delle intrusioni sono un inizio. Ma "lista bianca" offre una difesa più forte. Vale a dire, essenzialmente di blocco computer in modo che solo i programmi fidati sono autorizzati a eseguire. Nulla può essere cambiato o aggiunto o aggiornato, se non da un amministratore di sistema.

McAfee ritiene che "è lì che il futuro sta andando", ha detto Kurtz.

Link alla storia completa

Moda in ritardo alla festa, ma lo prendo. ;-)

Sistemi virtualizzati sono più o meno sicuro?

18 MAGGIO 2010

Ho avuto la domanda di cui sopra ha chiesto abbastanza volte che mi è sembrato degno di un post sul blog. Mentre qualche anno fa la risposta potrebbe essere stato "meno sicuri", oggi la risposta è "entrambi". Lo so, suona come Chris è senza impegno, ma che rispondono davvero più accuratamente descrivono lo stato attuale della tecnologia.

Virtualizzazione Everything Changes

Ho sentito una considerazione alcune persone che la virtualizzazione è sul punto di impatto del settore stesso modo in cui Internet ha fatto negli anni 90. Per essere onesto, penso che ci sia merito nel suddetto parere. Nei primi anni '90, la maggior parte gente correva IPX, AppleTalk, NetBUI e una pletora di altri protocolli su reti chiuse. Alla fine degli anni 90, la maggior parte persone correvano IP esclusivamente con connettività a tutto il mondo. Il modo in cui abbiamo fatto di business, così come il modo in cui abbiamo applicato la sicurezza, completamente cambiata nel corso di 10 anni. Sia l'amministrazione della rete e delle competenze di sicurezza che sono state all'avanguardia nel 1990, sono stati tutti inutili, ma entro il 1999.

La virtualizzazione sta cominciando a rampa fino ad avere lo stesso impatto sul settore. Implementazione della virtualizzazione richiede un completo ripensamento delle modalità di applicazione di sicurezza. Torna nel 1990, gli amministratori che semplicemente collegato a Internet, senza preoccuparsi di come questo avrebbe un impatto sulla loro rete, ha bruciato alla grande. Siamo in coda per vedere un risultato simile a quella gente di adottare la virtualizzazione.

Che cosa rende meno sicura la virtualizzazione

Il tallone d'Achille della virtualizzazione è nel software stesso. Speriamo ci si possa fidare del software per mantenere i sistemi guest distanza gli uni dagli altri, così come l'host e / o hypervisor. Ci sono due grossi problemi con questa aspettativa:

  1. Nessun software è privo di bug
  2. Il software può essere configurato

Pochi anni fa la ricerca di base ha dimostrato di poter uscire da un ospite e ottenere il controllo completo del sistema operativo host . Mentre un hypervisor dovrebbe limitare quel tipo di esposizione, abbiamo sicuramente visto casi in cui anche l'hypervisor è stato scavalcato . Abbiamo anche visto casi sono stati il software diventa sfruttabile solo se eseguito in un ambiente virtualizzato . Questi link mostra una piccola sezione trasversale dei problemi di virtualizzazione che sono stati scoperti nel corso degli ultimi anni. Google può darvi una lista più completa, se siete interessati.

Così un prudente sicurezza professionale sta per essere cauti di ciecamente fidarsi di software per essere sicuro. Il problema è che i venditori non sempre tengono questo stesso approccio. Prendere VMware con i loro ESX (che sarà presto ESXi) prodotto come esempio. Molti di noi erano sbalorditi quando un rappresentante VMware ha annunciato al CanSecWest che era teoricamente impossibile per attaccare il hypervisor ESX . Quando abbiamo semplicemente assumere qualcosa è infrangibile, qualcuno più creativo sta andando a trovare un modo di perforare attraverso .

Una delle mie maggiori preoccupazioni con ESX / ESXi VMware è che l'ha progettata per essere modulare (via VMsafe ). Sul lato positivo, questo significa che i fornitori esterni in grado di creare prodotti per migliorare l'hypervisor di funzionalità e sicurezza. L'aspetto negativo questo aumenta notevolmente le probabilità di cattivo codice in fase di introduzione, che può compromettere la sicurezza.

Abbiamo visto un grande esempio di questo in passato. Marcus Ranum creato il firewall Gauntlet, che a quel tempo era uno dei dispositivi culo più sicuro e calci di sicurezza disponibili. Quando tre agenzie lettera voleva il meglio della sicurezza, si è rivolto a Gauntlet. Marcus venduto Gauntlet per Network Associates (in seguito divenne McAfee) che immediatamente iniziato ad aggiungere nelle caratteristiche. Non passò molto tempo prima di una stringa costante di vulnerabilità sono stati scoperti, ciascuno introdotto da queste nuove "features". Da lì, il prodotto ha perso la sua sicurezza cred e scivolò fuori del radar.

Ora è certamente possibile aggiungere funzioni e tenere le cose sicure. Il FreeBSD gente sono un ottimo esempio di come farlo correttamente. Per garantire la sicurezza mantengono un processo di revisione molto rigoroso . E 'perfetto? Assolutamente no, ma il loro processo di revisione contabile ha messo la barra per l'implementazione di software sicuro. Con po 'di fortuna VMware farà simile, ma non ho sentito alcun ronzio di questo essere il caso.

Ottenere la testa dritta

OK, quindi non possiamo ciecamente fidarsi software di virtualizzazione per tenere a bada gli aggressori. Possiamo però ancora prendere precauzioni per ridurre al minimo l'impatto se il peggio si verifica. Uno dei più grandi passi da fare è quello di considerare attentamente quali server si ospitati, e ciò che gli altri sistemi guest sono autorizzati a funzionare sulla stessa macchina. Il concetto di zona di sicurezza utilizzati da architetti di rete è altrettanto applicabile qui.

Una zona di sicurezza è semplicemente un insieme di sistemi che condividono lo stesso livello di rischio relativo. Ad esempio server Web, il nome e SMTP di solito sono tutti situati in una DMZ, perché tutti i rischi quota analoga da attacchi diretti. Sulla parte interna della rete, i desktop sono di solito collocato in una zona di sicurezza diverso da quello dei server. Questo perché i server hanno poco o nessun accesso a Internet, mentre i desktop sono normalmente autorizzati a comunicare direttamente. Questo pone il desktop a più alto rischio di attacco rispetto al server.

Possiamo applicare questa stessa logica in sede di attuazione di virtualizzazione. Un server DMZ e un server interno non dovrebbero essere gli ospiti sullo stesso hardware (CPU e disk array). In questo modo potrebbe consentire a un utente malintenzionato di creare un percorso alternativo nella nostra rete. Piuttosto che dover passare attraverso qualsiasi firewall, NIDS, NIPS, dispositivi ecc che è stato distribuito sul filo, un malintenzionato può essere in grado di accedere alle risorse interne tramite il software di virtualizzazione. E 'un attacco facile? Non da quello che abbiamo visto finora. Sfrutta funzionali sono stati scoperti però, e allora perché introducono rischi inutili se non è necessario.

A proposito, queste stesse regole di zona di sicurezza deve essere applicato l'attrezzatura rete virtualizzata. Ad esempio, è una cattiva idea di utilizzare lo stesso interruttore fisico per VLAN la DMZ e la rete interna. Ho visto un paio di clienti whacked ottenere in questo modo.

Che cosa rende la virtualizzazione più sicuro

Fortunatamente, dal punto di vista della sicurezza, la virtualizzazione non è solo brutte notizie. In realtà ci sono alcune pratiche di sicurezza molto cool è possibile applicare in un ambiente virtualizzato che semplicemente non può farne a meno. Questa fu una delle ragioni per cui abbiamo iniziato a utilizzare la virtualizzazione all'interno del Honeynet già nel 2000.

Una delle questioni più grande sicurezza che abbiamo di fronte oggi è rootkit a livello kernel . Ciò che rende questo ceppo di malware in modo insidioso è si trasforma in modo efficace il sistema operativo in malware. Questo rende estremamente difficile il rilevamento, in quanto tutti i controlli di sicurezza devono passare attraverso il kernel. Se il kernel stesso è compromesso, non possiamo fare affidamento sul kernel di segnalare con precisione le informazioni di sicurezza. Si finisce per dover spegnere il sistema, montare l'unità su un noto per essere pulita del sistema operativo, e l'esecuzione di nostri controlli forense da lì. Oh, naturalmente il problema con questo processo è che non scala bene. Se abbiamo decine o centinaia di server, semplicemente non c'è abbastanza tempo in un giorno per controllare tutti correttamente.

Come accennato in precedenza, VMware è ora permettendo fornitori di terze parti l'accesso ai hypervisor tramite API VMsafe. Questo consente l'accesso alle informazioni sullo stato privilegiate, come la memoria e il traffico di rete, su ciascuno dei sistemi operativi guest. Inserendo nel hypervisor, alcune opzioni di sicurezza estremamente freddo diventano possibili.

Per esempio diciamo che un sistema operativo guest viene attaccato da un rootkit a livello kernel. Analizzando la memoria degli ospiti, il rootkit possono essere rilevati al di fuori del sistema operativo virtuale. Quando si eseguono i controlli attraverso l'hypervisor, c'è molto meno di una possibilità che un rootkit può furtivamente la sua attività 'e passare inosservato. Come già accennato, non esiste alcuna opzione paragonabile a un non-sistema virtualizzato.

La spina API crea anche nuove possibilità per affrontare il traffico crittografato. Quando un capo all'altro la crittografia è impiegato (come una VPN), controlli di rete in base del livello di applicazione possono essere facilmente aggirate. L'unica opzione reale è stato quello di eseguire il software agente sul punto finale, per cui la sicurezza potrebbero essere attuate dopo il processo di decodifica. Naturalmente il problema qui è che se l'agente viene attaccato, tutte le scommesse sono spenti. Ancora una volta, inserendo nel hypervisor siamo in una posizione migliore per esaminare in modo più sicuro di questi dati.

Stiamo iniziando a vedere nuovi prodotti che sfruttano le API VMsafe spina . Dal momento che tutti i prodotti sono relativamente nuovi, la giuria è ancora fuori sulla loro efficacia può essere. Offerte eseguire la mossa di sostituire firewall basato su host e protezione IDS per l'applicazione delle policy pieno. Sarà interessante vedere come questo prodotto di nicchia scuote nel corso dell'anno prossimo.

Riassunto

Così come ho accennato all'inizio di questo post, la virtualizzazione ha la capacità di rendere il vostro ambiente più o meno sicuro, a seconda di come distribuirlo. Se semplicemente iniziare a correre tutto su una singola casella, probabilmente andando ottenere whacked. Se si estende la best practice che sono state sviluppate nel corso degli anni nel regno di virtualizzazione, oltre a sfruttare alcune delle nuove caratteristiche di sicurezza che vengono rilasciate, si può effettivamente creare una postura migliore sicurezza complessiva.

Combinando Logwatch e OSSEC - Parte 4

18 Febbraio 2010

Nel mio ultimo post abbiamo installato Logwatch così come OSSEC. E 'giunto il momento di ottenere Logwatch e OSSEC giocare insieme nella stessa sandbox. In questo post parlerò come raggiungere Logwatch di riassumere le informazioni che vengono generate da OSSEC.

Opzioni di distribuzione

Abbiamo due strade che possiamo seguire per impostare questa funzione:

  1. Hanno Logwatch analizzare i log OSSEC direttamente.
  2. Hanno OSSEC inviare le proprie segnalazioni a un server Syslog tipo, quindi eseguire Logwatch sul server Syslog.

Il vantaggio per l'opzione # 1 è che abbiamo bisogno di un solo sistema. Logwatch verrà eseguito sul sistema che ospita il server OSSEC. Il problema che stiamo andando a correre in quanto coinvolge il file OSSEC avviso. Voci di registro non vengono normalizzati. Ciò significa che il formato può cambiare da ingresso ingresso, e può anche distribuite su più righe. Sta andando essere un vero incubo per creare uno script Logwatch che filtrerà e sintetizzare le informazioni di allerta.

Se andiamo con opzione # 2, si richiederà un altro box di agire come i nostri server di registrazione centralizzata. Al fine di avere il server OSSEC accettare voci di registro da non-agente, deve ascoltare il UDP/514. Questa è la stessa porta utilizzata da un server di logging centralizzato, e non è possibile avere due applicazioni condividono la stessa porta (tranne che con Windows, ma l'accesso socket è molto disordinato). Sul lato positivo, le voci di allarme avranno normalizzato quando vengono trasmessi al server Syslog per la creazione di uno script di sintesi Logwatch sarà molto più facile. Inoltre, Logwatch sa già sui file Syslog standard, quindi dovremo lavorare di personalizzazione meno da fare.

Infine, ho accennato in un precedente post che OSSEC non è progettato per essere una SIM. Questo è perché non registrare tutto, solo gli eventi che generano un avviso. Quindi siamo probabilmente vorrà un server centralizzato in ogni caso, e ha senso farlo memorizzare le informazioni che vengono generate da OSSEC.

Quindi, se suona come io vi guida verso la scelta # 2, si è assolutamente corretto. Detto questo, io sto in realtà andando a coprire l'opzione # 1 in quanto è una configurazione molto più complesso.

Dealing With Date / Time Stamps

Date un'occhiata al file di log principale OSSEC e si dovrebbe vedere simile al seguente:

[Root @ fubar log] # tail -3 / var / OSSEC / log / ossec.log

2010/02/18 00:32:05 OSSEC-rootcheck: INFO: Fine scansione rootcheck.

2010/02/18 14:27:06 OSSEC-syscheckd: INFO: Starting syscheck scansione.

2010/02/18 14:39:21 OSSEC-syscheckd: INFO: Fine syscheck scansione.

Notare il modo in cui viene formattato la data / ora. Questo è diverso dalla maggior parte delle applicazioni, quindi la prima cosa avremo bisogno di fare è dire Logwatch come trattare con questo formato. Avremo bisogno di creare uno script che possiamo chiamare in caso di necessità, che comprende il formato sopra indicato.

Avviare muovendo nella directory condivisa script:

cd / usr / share / logwatch / scripts / shared

Utilizzando il vostro editor preferito, creare un file denominato "applylongdate":

vi applylongdate

Ecco che cosa avete bisogno all'interno di quel file. Sentitevi liberi di copia / incolla da questa pagina:

uso Logwatch ': date';

my $ debug = $ ENV {'LOGWATCH_DEBUG'} | | 0;

$ SearchDate = TimeFilter ('% Y /% m /% d% H:% M:% S');

if ($ debug> 5) {

print STDERR "DEBUG: ApplyLongDate Dentro ... \ n";

print "DEBUG: In cerca di:" STDERR. $ SearchDate. "\ N";

}

while (defined ($ questa_riga <STDIN> =)) {

if ($ questa_riga = ~ m / ^ $ SearchDate / o) {

print $ questa_riga = ~ s / ^ .... \ / .. \ / .. ..:..:.. / /;

print $ questa_riga;

}

}

# Vi: shiftwidth = 3 = sintassi perl tabstop = 3 et

Una volta salvato il file, ora abbiamo bisogno di impostare le autorizzazioni appropriate:

chmod 755 applylongdate

Configurazione del file di log

Poi abbiamo bisogno di dire Logwatch in cui i file di log OSSEC si trovano. Ogni volta che si aggiungono nuovi file di log o creare nuovi servizi per il monitoraggio in Logwatch, è necessario posizionare le modifiche sotto la directory / etc / logwatch. Abbiamo intenzione di creare due file di configurazione. Il primo si occuperà messaggi OSSEC, e il secondo si occuperà avvisi OSSEC e cambiamenti risposta attiva.

Cominciamo con la creazione del file di configurazione per le principali file di log OSSEC:

cd / etc / logwatch / conf / logfiles

vi ossec.conf

Il contenuto del file deve essere il più seguito:

LogFile = / var / OSSEC / log / ossec.log

* ApplyLongDate =

È ora possibile salvare e uscire dal file. Successivamente, creeremo il file di configurazione dei file di registro rimanenti:

vi OSSEC-alert.conf

Il contenuto di questo file deve essere il più seguito:

LogFile = / var / OSSEC / log / active-responses.log

LogFile = / var / OSSEC / log / avvisi / alerts.log

LogFile = / var / OSSEC / log / firewall / firewall.log

Una volta completata, salvare ed uscire. I permessi di default dovrebbe essere accettabile per la nostra impostazione.

Configurazione dei servizi OSSEC

Successivamente, è necessario per definire i servizi OSSEC e identificare ciò che vogliamo usare come titolo quando i report vengono generati. Ecco come creare il primo file:

cd / etc / logwatch / conf / servizi

vi ossec.conf

Il contenuto di questo file è molto semplice:

Title = "OSSEC Messaggi"

LogFile = OSSEC

Una volta completato è possibile salvare e uscire. Abbiamo bisogno di creare un file di più in questa directory:

vi OSSEC-alert.conf

Il contenuto di questo file deve essere:

Title = "OSSEC avvisi"

LogFile = OSSEC-alert

Al termine, salvare e uscire come al solito.

L'analisi di voci

Quindi, abbiamo bisogno di dire Logwatch come formattare le voci di registro all'interno del report. Avremo bisogno di creare uno script di personalizzazione per ogni insieme di servizi. Stiamo per iniziare utilizzando uno script di test in dotazione Logwatch, solo per fare verificato che tutto funzioni.

Avviare muovendo nella directory appropriata:

cd / etc / logwatch / scripts / servizi

Usa il tuo editor preferito per creare il tuo primo script:

vi OSSEC

Il contenuto dello script deve essere il più seguito:

#! / Bin / bash

# Questo script come è bello che vi mostrerà le linee si

# Essere l'elaborazione e report. Si visualizzerà prima la

# Variabili d'ambiente standard e poi ci vuole STDIN e

# Fare un dump terzino destro fuori su STDOUT.

# Queste sono le variabili d'ambiente standard. È possibile definire

# Più nel file di configurazione di servizio (vedi sopra).

echo "Intervallo date: $ LOGWATCH_DATE_RANGE"

echo "Livello di dettaglio: $ LOGWATCH_DETAIL_LEVEL"

echo "Temp Dir: $ LOGWATCH_TEMP_DIR"

echo "Livello di debug: $ LOGWATCH_DEBUG"

# Ora prendete STDIN e discarica a STDOUT

gatto

Ora create il vostro secondo script:

vi OSSEC-alert

e includere il contenuto esattamente lo stesso:

#! / Bin / bash

# Questo script come è bello che vi mostrerà le linee si

# Essere l'elaborazione e report. Si visualizzerà prima la

# Variabili d'ambiente standard e poi ci vuole STDIN e

# Fare un dump terzino destro fuori su STDOUT.

# Queste sono le variabili d'ambiente standard. È possibile definire

# Più nel file di configurazione di servizio (vedi sopra).

echo "Intervallo date: $ LOGWATCH_DATE_RANGE"

echo "Livello di dettaglio: $ LOGWATCH_DETAIL_LEVEL"

echo "Temp Dir: $ LOGWATCH_TEMP_DIR"

echo "Livello di debug: $ LOGWATCH_DEBUG"

# Ora prendete STDIN e discarica a STDOUT

gatto

Infine, abbiamo bisogno di impostare le autorizzazioni appropriate:

chmod 755 OSSEC *

L'installazione di prova

Il modo più semplice per testare la nostra nuova configurazione è di lanciare il comando:

logwatch | less

Se si desidera solo per visualizzare le modifiche, è possibile eseguire una relazione su ogni servizio, uno alla volta:

logwatch servizio OSSEC | less

logwatch-service OSSEC-alert | less

Personalizzazione ulteriormente

Una volta arrivati ​​tutto il lavoro di cui sopra, è possibile concentrarsi su come ottenere Logwatch di filtrare e sintetizzare le voci del registro. Logwatch è abbastanza flessibile, e si può personalizzare l'output nel modo desiderato. Una delle cose belle lo script di test è al di sopra che mostra esattamente quello che hai da lavorare. Così con un po 'di magia espressione regolare è possibile riassumere le voci nel modo che ritiene opportuno. Per alcune idee, controllare il file che si trovano sotto:

/ Usr / share / logwatch / scripts / servizi

Questi sono gli script di default fornito con sintesi Logwatch. In particolare, hanno uno sguardo al file "pam" e "sshd". Essi sono grandi esempi sia di una semplice e una complessa serie di filtri di sintesi.

Durante lo sviluppo script, prestare molta attenzione ai $ "variabile LOGWATCH_DETAIL_LEVEL. Questo vi permetterà di personalizzare il livello di uscita del rapporto a seconda di quanto verbosità l'utente sta cercando. Per esempio, mentre siete ancora nella directory sopra servizi, eseguire il seguente comando:

meno sshd

Quando la prima pagina del contenuto del file viene visualizzato, digitare:

/ Dettaglio <Inserisci key>

Il backslash ci permette di cercare il file una stringa di testo particolare. In questo caso siamo alla ricerca del "dettaglio" parola. Una volta premuto Invio la ricerca permette di saltare attraverso il file fino a che trova la prima istanza della stringa di testo. Sarà anche evidenziare la stringa di ricerca. Nella prima partita si nota che l'autore assegnato alla variabile "$ Detail" per essere lo stesso della variabile $ LOGWATCH_DETAIL_LEVEL ". Questo per risparmiare loro un po 'di digitazione.

Ora premete il tasto backslash ancora seguito dal tasto Invio. Questo saltare attraverso il file nella successiva istanza di "Detail". Si dovrebbe vedere:

if ($ Dettaglio> = 20) {

Gli utenti $ {$ user} {$ host}} {$ Metodo + +;

Else {}

if ($ host! ~ / $ IgnoreHost /) {

Gli utenti $ {$ user} {} {$ host "(tutti )"}++;

Nota l'autore fornisce ulteriori informazioni se il livello di dettaglio è impostato a 20 (a metà strada tra la bassa e media) o superiore. Continuare a saltare attraverso il file e vedrete altri esempi in cui l'autore sfruttato questa tecnica.

Ora pagina fino alla fine del file e dovreste vedere questa dichiarazione:

if (keys% OtherList) {

print "\ n ** ** Le voci senza pari \ n";

print "$ _: $ OtherList {$ _} tempo (s) \ n" foreach keys% OtherList;

}

Questa sezione è estremamente importante, in quanto è un ripostiglio finale. Pensate ad una politica del firewall per un momento. La maggior parte di noi di creare una regolamentazione definitiva che dice: "Se non ho specificamente permesso il traffico attraverso un modello, negarla". In altre parole, se succede qualcosa di inaspettato, è così che voglio che tu gestirlo.

La dichiarazione di cui sopra serve allo stesso scopo durante l'analisi del file di log. Tutte le precedenti "if" tentativo di corrispondere una specifica stringa di testo nella voce di registro al fine di formattarlo correttamente. Questa voce dice: "Se non hai trovato e stampato una voce specifica log ancora, stampare in una sezione intitolata" Voci senza precedenti ** ** ". Questa fase è estremamente importante perché senza di essa non riusciremo mai a vedere le voci inaspettate. E 'l'inaspettato voci che sono probabilmente i più importanti e più interessanti.

Executive Summary

Sia OSSEC e Logwatch sono eccellenti strumenti gratuiti. OSSEC eccelle in allarme quando un modello di attacco conosciuto ha luogo. Logwatch è uno strumento formidabile per riassumere un pezzo il tempo dei tronchi così che gli umani possono realmente dare un senso a ciò che sta accadendo. Combinando i due strumenti è possibile creare una difesa molto più solida in profondità postura. Il tutto diventa più grande della somma delle parti.

Combinando Logwatch e OSSEC - Parte 3

17 febbraio 2010

Nei miei ultimi due post ho discusso Logwatch e OSSEC, e come essi possono essere sfruttare per aumentare la vostra sicurezza. In questa puntata parlerò come installare entrambi di questi strumenti.

Installazione Logwatch

Logwatch è abbastanza facile da installare. In realtà, è installato di default su molte distribuzioni Linux in modo da avere già una copia sul vostro sistema. Per controllare, l'accesso come root e provare ad eseguire Logwatch con la "-v" interruttore. Se si vede:

[Root @ fubar logwatch] # logwatch-v

Logwatch 7.3.6 (rilasciata 05/19/07)

Logwatch è installato e di avere una copia della versione più recente. Se non si dispone dell'ultima versione, è possibile afferrare dalla pagina di download Logwatch .

Ci sono tre tipi di Logwatch che può essere scaricato; binari in formato RPM, sorgente in formato RPM o sorgenti, in una palla di catrame. Se il sistema supporta la gestione dei pacchetti RPM, l'RPM binario è la scelta migliore. E 'semplice da installare e RPM aggiorna automaticamente il software quando sono disponibili nuove versioni.

Installazione Logwatch Da RPM

Per installare la versione binaria del RPM, semplicemente l'accesso come root e passare alla directory dove avete scaricato il file RPM. Ora eseguire il comando:

rpm-U logwatch-7.3.6-1.noarch.rpm

Non dimenticare è possibile utilizzare il tasto TAB per il completamento automatico del nome del file piuttosto che dover digitare l'intera faccenda.

Installazione Logwatch da sorgenti

L'installazione da sorgenti è un po 'più lunghi. Ricordate che per poter installare il codice sorgente è necessario avere già un compilatore (come gcc) installato sul vostro sistema. Di accesso come root e accedere alla directory in cui avete scaricato la palla Tar. Per estrarre l'archivio, eseguire il comando:

tar xvzf logwatch-7.3.6.tar.gz

Vedrete una struttura di directory sotto la posizione corrente vengono creati e un sacco di file da copiare pollici Abbiamo ora bisogno di spostarsi nella directory di livello superiore che è stato creato:

logwatch cd-7.3.6

Al fine di Logwatch a correre, ci sono un sacco di directory che devono essere creati sul sistema. Questi sono documentate nel file README nella directory corrente. Fortunatamente, Logwatch include uno script di installazione che può fare tutto il lavoro per voi. Sfortunatamente, lo script ha i permessi impostati in modo sbagliato non verrà eseguito di default. Questo è abbastanza facile da risolvere ma con il comando chmod:

chmod 500 install_logwatch.sh

Ora siamo in grado di eseguire lo script per impostare il nostro sistema:

. / Install_logwatch.sh

Non dimenticare il punto all'inizio della riga.

Test Logwatch

Per testare la configurazione Logwatch, eseguire il comando:

logwatch | less

Vedrete il vostro schermo del terminale va in bianco, ma questo è normale. Alla fine vedrete un rapporto Logwatch ottenere stampati a schermo che è possibile navigare attraverso l'utilizzo del "Page Up" e "Page Down". Come accedere ci vuole per il rapporto di mostrare sullo schermo dipende dalla quantità di informazioni di log deve avere analizzato. Si potrebbe richiedere alcuni secondi o un paio di minuti. Ad ogni modo, che vi darà la possibilità di familiarizzare con il formato del report.

Installazione OSSEC

Come ho detto nel mio ultimo post, hai due opzioni di installazione con OSSEC, locale o client / server. In questo post ho intenzione di concentrarsi sul client / server di configurazione, in quanto è un po 'più complessa. Se si sta eseguendo un'installazione locale, è sufficiente selezionare l'opzione "locale" durante il processo di installazione e saltare la sezione su come configurare un canale protetto tra l'agente e il server.

Inizia con il Server

OSSEC utilizza la crittografia Blowfish per proteggere la comunicazione tra il client e il server. Blowfish è la chiave simmetrica basata, in modo da entrambe le parti devono sapere quale valore chiave da utilizzare per comunicare. Il server è responsabile della generazione della chiave simmetrica, quindi dobbiamo installare il software del primo server. Durante il client di installazione ci verrà chiesto, per un valore chiave quindi ovviamente avremo bisogno di avere a portata di mano che prima del tempo.

Ecco un suggerimento risparmio di tempo. The key value is long and nearly impossible to remember. The easiest way to move the key value from the server system to the agent system is to use SSH. Create a secure connection to the OSSEC server, and extract the appropriate key (directions provided below). In a second terminal window, create an SSH session to the system where you will be installing the agent. When the client install prompts you for the key value, you can simply copy/paste between the two terminals.

Installing The OSSEC Server

The server software is available as a Tar ball, so you can grab a copy of the latest version from the OSSEC download page . You will then need to extract the contents of the Tar ball:

tar xvzf ossec-hids-2.3.tar.gz

Next, move into the directory structure you just created:

cd ossec-hids-2.3

OSSEC provides an install script to walk you through the process of installing the server. To start the script, type:

./install.sh

Don't forget the period at the beginning of the command. You will now be prompted through a number of install options:

  • Language – The default is English. Change as needed.
  • Confirmation of installation – Press Enter once you have read the screen.
  • Install type – Type in “server” without the quotes and press Enter.
  • Install location – Accept the default.
  • E-mail notification – Default is yes, select if you want e-mail alerts. If you select yes, you will be prompted for a valid e-mail address and mail server.
  • Integrity check – Default is yes. Select if you want the local system periodically checked for intrusions.
  • Root kit detection – Default is yes. Good option since we need to maintain a high level of integrity on this system.
  • Active response – Default is yes. Select this option if you wish to be able to respond to events.
  • Firewall drop – Permits the OSSEC server to defend it self if a direct attack is detected.
  • White list – This will permit you to add IP addresses from which possible attacks will be ignored. Be careful with this option. If you will not have console access to the OSSEC server, it might be wise to identify one IP address that can always get in. Just ensure the source IP is a trustworthy system.
  • Enable Syslog – Default is yes. Select this option if you wish to collect logs from system that cannot run an OSSEC agent (like firewalls, switches, routers, access points, etc.).
  • Log files to be monitored – This screen identifies all of the local log files OSSEC will monitor. It is purely information, so all you can do is press Enter to move past it. If you notice one or more log files missing from the list, you can add them later to the ossec.conf file.

At this point OSSEC will access the local complier and install all needed files onto the system. Once complete, you can start the OSSEC server by executing the command:

/var/ossec/bin/ossec-control start

Defining OSSEC Agents

We are not done with the OSSEC server just yet. Next, we need to pre-define any systems that will be running the OSSEC agent (client) software. This is performed using the manage_agents command. First however, we need to do a bit of homework. Make a list of all of the systems that will be running the OSSEC agent software. For each system, you will need a descriptive name as well as that system's IP address.

Now, execute the following from the command line:

/var/ossec/bin/manage_agents

This will produce the Agent Manager main menu. Press “A” followed by the Enter key to define your first system. Enter a descriptive name for the first system, followed by the system's IP address. Don't worry about the agent ID number. Simply accept the default and OSSEC will auto-assign the next available ID number. Once you confirm the information you entered, you will be returned to the Agent Manager main menu. Repeat the above process for each system that will be running an OSSEC agent.

Generating Keys

Once you have added in all of your systems, it is time to generate encryption keys. This step is also performed with the manage_agents utility. If you closed the tool after the last step, relaunch it now.

Press the “E” key followed by Enter to select the “Extract key for an agent” menu option. You will then be prompted for the ID number of the key you wish to extract. The descriptive names and IP addresses are listed with each ID number, so it should be trivial to identify which one you want. Start with the system you plan to install the agent software onto first.

OSSEC Agent Install On Linux

When installing the agent software on a Linux or UNIX client, you use the exact same Tar ball we used to install the server software. Run the same install script, but this time when you are prompted for the type of install you wish to perform, type in “agent” followed by the Enter key.

The client install has many of the same prompts as the server install. Use the info above to guide you through the process. The prompt that will vary however is that you will be asked to provide the IP address of the OSSEC server. Once complete, OSSEC will access the local complier and install all required files onto the system.

Next we need to import the Blowfish key from the OSSEC server. While still on the agent system, run the command:

/var/ossec/bin/manage_agents

When the Agent Manager menu appears, select “I” to import the Blowfish key.

When the next prompt appears, you need to manually enter the appropriate Blowfish key. Again, if you are running SSH to both systems at the same time, you can simply copy/paste between the two terminals. Make sure the key looks correct, press the Enter key, and then select “y” to confirm that the key looks correct. You will be returned to the Agent Manager menu. Select “q” in order to return to the command line.

Now we simply need to start the OSSEC agent. You can do so by executing the following command:

/var/ossec/bin/ossec-control start

You should see all of the OSSEC agent components start up, followed by a “Completed” message.

OSSEC Agent Install On Windows

OSSEC has a self-extracting executable that will permit you to install the agent software on a Windows system. Simply double click the executable to start the install process. You will be prompted to agree to the license as well as which components you wish to install. Simply follow the prompts till the OSSEC Agent Manager window appears.

The OSSEC Agent Manager window will prompt you for the IP address of the OSSEC server. It will also prompt you for the Blowfish key value to use, so extract the appropriate key on the server and enter the value in this field. Make sure you delete the prompt within this field before you paste in the Blowfish key. Otherwise communication with the server may fail.

Next, select “Manage” from the OSSEC Agent Manager menu, followed by “Start OSSEC”. You should now see the “Status:” indicator change to “Running…”.

Testing OSSEC

Once you have the server and agent software installed, started and the appropriate keys configured, it is now time to check our setup. Execute the following command on the OSSEC server:

cd /var/ossec/logs

And check out the ossec.log file:

less ossec.log

Check the log file for any errors. A common error is that OSSEC reports it cannot send e-mail. Make sure the mail server is running and that it is accepting connections. Once you are happy with the server setup, it is now time to check out the agents. Move down to the “alerts” directory:

cd alerts

And check out the alerts.log file:

less alerts.log

Specifically, you are looking for entries similar to the following:

2010 Feb 17 16:09:16 (desktop) 192.168.1.10->ossec

Rule: 501 (level 3) -> 'New ossec agent connected.'

Src IP: (none)

User: (none)

ossec: Agent started: 'test_system->192.168.1.10′.

You should see an entry for every system on which you installed the agent software.

More To Come

Caspita! That's more than enough for one post! In my next post I'll get into leveraging Logwatch to parse all of the alert information being generated by OSSEC.

Combining Logwatch and OSSEC – Part 2

February 16th, 2010

In my last post I described how Logwatch could be used to simplify the log review process. In this post we'll look at OSSEC and what it brings to the table.

What Is OSSEC?

OSSEC , abbreviazione di "Sicurezza Open Source", è un host basato su sistema di rilevamento delle intrusioni (HIDS). In altre parole, è progettato per rilevare attacchi o violazioni delle policy, se e quando si verificano. Anche se non ha la capacità di proteggere contro gli attacchi sconosciuti o 0-Day (che sarebbe la prevenzione delle intrusioni basata su host), che include una vasta gamma di strumenti che consentono di identificare una intrusione quando si verifica, così come la misura del danno che è stato causato.

Le piattaforme supportate

Per sfruttare al meglio tutte le caratteristiche OSSEC ha da offrire, è necessario eseguire un agente sul sistema protetto. Agenti OSSEC può essere eseguito su Windows, Mac OS X, Linux, e una vasta gamma di sistemi UNIX. Se siete interessati solo alla parte di analisi dei log però, una gamma ancora più ampia di sistemi possono essere supportati. Ciò include hardware di Cisco e Juniper. Un certo numero di prodotti specifici sono supportati anche come firewall Checkpoint, Symantec Anti-Virus, Snort, Squid, e Arpwatch, solo per citarne alcuni.

Quando si installa OSSEC si hanno due opzioni di configurazione, locale o client / server. Una installazione locale viene utilizzata quando è necessario eseguire tutto su un unico sistema. Il client / server di installazione consente di eseguire un ambiente distribuito proteggendo i sistemi multipli allo stesso tempo. Mentre la maggior parte delle distribuzioni sono client / server basato, se si vuole dare un giro si può facilmente eseguire tutto in un sistema singolo test utilizzando una installazione locale OSSEC.

Analisi log

OSSEC include un log-based Intrusion Detection System (LIDS). Questa ha la capacità di rivedere i file di log in tempo quasi reale, mentre li scrutando per schemi di attacco conosciuti. Quando un registro viene generato su un sistema protetto, l'agente si occupa di trasmettere in modo sicuro l'(cifratura Blowfish tramite una pre-shared secret) accedere nuovamente al server. Il server si occuperà quindi di eseguire l'analisi.

La maggior parte degli strumenti di analisi log processo le loro regole in un formato lineare. Con questo voglio dire se abbiamo 500 regole, la regola si è selezionata, regola due, poi la regola tre, e così via fino a quando un match è trovato o si arriva alla fine del set di regole. OSSEC funziona un po 'diverso in quanto implementa una struttura ieratica alle regole. Le voci del registro vengono prima classificati e poi verificati solo contro qualsiasi normativa è opportuna. Il risultato è che, piuttosto che dover elaborare tutte le 500 regole, maggior parte degli eventi avrà confrontati con 10 regole o meno. Questo riduce drasticamente la quantità di overhead necessario per elaborare il set di regole.

Verifica integrità

OSSEC include uno strumento denominato Syscheck per eseguire il controllo dell'integrità dei file e delle directory. Se si esegue un agente di Windows, è possibile anche includere i tasti specifici all'interno del registro di Windows per essere controllati sia. Modifiche apportate ai file possono essere rilevati utilizzando sia MD-5 e SHA-1 algoritmi hash. Il sistema è estremamente personalizzabile. È possibile includere o escludere singoli file o intere strutture di directory. È anche possibile impostare un flag per rilevare la creazione di nuovi file.

L'agente software è progettato per utilizzare una minima quantità di CPU durante il controllo di integrità. Anche se questo significa il controllo richiederà più tempo, ma aiuta anche a ridurre al minimo il calo di performance del sistema. Informazioni hash viene trasmessa al server. Il server si occuperà quindi di eseguire il confronto hash per vedere se qualcuno dei file critici del sistema sono state modificate. Il server memorizza anche una copia della politica di controllo di integrità, in modo che se cambia la politica sono fatte per l'agente, possono essere rilevate e segnalate pure.

Rilevamento delle anomalie

OSSEC va ben oltre la verifica del log per verificare l'integrità del sistema. Policy di utilizzo possono essere gestiti centralmente dal server, e poi spinto fuori agli agenti appropriati. Per esempio si potrebbe definire una politica che per quanto riguarda le applicazioni Windows sono accettabili (Office, Firefox, ecc) e quali no (client di messaggistica istantanea, Skype, ecc.) È anche possibile definire le opzioni di configurazione accettabile come verificare che gli hash NT vengono utilizzati per la password memorizzata, ma non gli hash LanMan.

OSSEC include una serie di altre cose interessanti al fine di contribuire a verificare l'integrità di un sistema. Per esempio OSSEC ha la capacità di eseguire comandi da agente e monitorare l'uscita che viene generato. Per esempio si potrebbe avere l'agente Linux eseguire il comando "df" a intervalli regolari e generare un allarme se l'utilizzo del disco supera il 90%. Un esempio Windows potrebbe essere quello di avere OSSEC generare un avviso ogni volta che file di informazioni viene scritto flussi di dati alternativi nell'area di NTFS.

Risposta attivo

Infine, OSSEC include la possibilità di rispondere quando viene rilevata un'attività sospetta. Le risposte possono essere generati dal server o l'agente, che mai si specifica. Le risposte possono essere benigni la generazione di una e-mail di avviso, di essere come proattiva come il blocco di un indirizzo IP remoto per un periodo limitato di tempo. Ci sono una serie di script inclusi risposta attiva è possibile disegnare, oppure si può facilmente scrivere il vostro.

Architettura sicuro

Gli autori OSSEC hanno fatto di tutto per proteggere tutti i componenti all'interno del prodotto. Attività quali il controllo dell'integrità vengono eseguite sul server, piuttosto che l'agente, così l'affidabilità del hash non può essere compromessa durante un attacco. I processi sono gestiti con il più basso livello di autorizzazioni possibili e diversi account utilizzati per eseguire ogni componente OSSEC. Ciò significa che un compromesso di una domanda unica ai OSSEC non immediatamente portare a un compromesso del pacchetto completo. Inoltre, la maggior parte dei componenti sono gestiti all'interno di una prigione chroot così il loro accesso al sistema è ulteriormente ristretta.

Le parole finali

Mentre OSSEC è uno strumento potente, è importante ricordare che si tratta di un HIDS e non una soluzione di gestione dei log. OSSEC possibile rivedere le voci del registro alla ricerca di segnali sospetti, ma sarà solo salvare le informazioni allerta. Così, mentre OSSEC non sostituisce il tuo Information Security Management (SIM) soluzione, può certamente aumentare la. È possibile configurare facilmente OSSEC a inoltrare tutte le segnalazioni che genera a un server centrale di registrazione .

Mentre OSSEC è un software open source, Trend Micro è principalmente lo sviluppo. If you need commercial support, you can purchase a support contract through them at a reasonable fee.

More To Come

In my next installment we'll look at installing OSSEC and Logwatch. After that, we'll move into integrating the two together.

Combining Logwatch and OSSEC

February 15th, 2010

I recently had a student ask me a question regarding the integration of Logwatch with OSSEC. I felt like this was a complex and yet cool enough idea that it warranted a series of posts to cover it in full. So over the next few days I'll talk about each of these tools, how to integrate them together, as well as what additional security visibility can be gained once the process is complete.

What Is Logwatch?

Logwatch is an excellent open source tool for generating daily human readable log reports. Log entries tend to fall into one of three categories:

  • Stuff you know is evil
  • Stuff you know is normal and can be safely ignored
  • Everything else

It is that “everything else” category where Logwatch really shines. For the stuff we know is evil, we will setup some form of alerting system. For example we may write an alert signature that warns the security analyst when an account is being brute forced. But what about the attacks we don't know about or are not sure what they look like? This would be a clear example of that “everything else” category. The traffic is not normal, but we have not seen it before to have a signature waiting to generate an alert. Since we will be unable to catch the attack in real time, we will need to catch it during a daily log review.

Of course the problem with doing daily log reviews is that it is tedious and time consuming. I mean let's be honest, who really wants to spend their day reviewing one million plus log entries? Even if you did, are you sure you would actually catch the out of the ordinary traffic?

Come funziona

What Logwatch does very well is permit you to reorganize your data into a format that is easier for humans to follow. Its real strength is that it permits you to move the stuff you understand out of the way (normal or evil), so that the unexpected log entries stand out like a sore thumb. In other words, Logwatch lets you summarize your log entries so the unusual stuff is easier to spot.

What I really love about Logwatch is that you don't lose anything. Many log review tools will only show you the stuff that has been pre-defined as being evil. The problem they all share is that when something evil but unexpected happens, it flies right under the wire. Because Logwatch lets you see everything, you no longer miss the unexpected.

Logwatch In Action

Lets discuss how Logwatch works using the SSH server service as an example. The scripts to deal with SSH have already been defined within Logwatch, so you do not need to do any tweaking to receive the features we are going to discuss.

When reviewing a log file, the first thing Logwatch does is reorganize log entries based on their message types. For example all Successful SSH logons are grouped together, as well as too many logon failures, refused connections, locked accounts, accounts without a proper shell, protocol mis-matches, etc. etc. etc. Once all the SSH messages are grouped by their type, the data is then summarized to reduce the amount of information being reported.

For example, the default is to summarize failed logon attempts by account and source IP. So a typical failed logon report section might look like this:

Failed logins from these:

bsmith/password from 1.2.3.4: 637 time(s)

jsmith/password from 1.2.3.5: 2 time(s)

So rather than having to review 639 log entries reporting a bad logon attempt, we have all the pertinent information summarized into three lines (if you include the title). Continue this process for all of the other SSH messages, and we have dramatically reduced the amount of time required to review our logs.

But what if something happens that Logwatch is not pre-programmed to recognize? When an unexpected log entry is found, Logwatch adds a section to the end of the service report called “Unmatched Entries”. So if we see this title in the SSH server section, we know some event has occurred that is either abnormal or unexpected for the SSH service. This could very well be some form of attack that we are not aware is making the rounds.

By focusing in on the unmatched entries section, we can quickly identify unexpected activity. As I stated earlier, this is really the main goal of doing daily log reviews. To find the stuff we don't expect which will sneak past our alerting system. Logwatch makes this process as quick and as painless as possible.

Feature Summary

In the above example I talked about doing daily log reviews, but to be honest Logwatch is highly customizable. You can specify any range you wish to use down to an interval of one second. For example let's say I'm investigating an intrusion rather than performing a daily log review. I could specify a range such as “2010/02/14 17:05:00 for that hour” to focus right in on the information that interest me. I can also focus in on one specific log file or service.

The detail level of the report is also customizable. Typically when you deal with security you get in the habit of always wanting the highest detail level of reporting. To be honest, with Logwatch a high level of detail is probably more than you will ever need. Personally I typically stick with “med” for medium and that works out nicely. You can also specify the reporting level as “low” or “high” or use a numeric range of 0-10 for a higher level of granularity (low =0, med=5, high=10).

Logwatch can be run automatically or as a manual process. Typically you will want to set it up to run automatically each day and summarize one day's worth of log entries. If you ever need to expand or focus the report, you can always run Logwatch from the command line while specifying exactly what you want to see. You can then use the “–save” option to specify a report name and directory location for storage.

More To Come

The above should give you a good idea as to the features Logwatch can bring to the table. In the next post I'll discuss OSSEC in the same level of detail. After that, I'll get into how to install each tool as well as how to integrate them together.

Day 2 Keynote

January 12th, 2010

Thanks to all who came out to the Encryption/DLP summit. Here are the slides from my keynote on day 2.

encryption-dlp-keynote

Poor Man's DLP

January 11th, 2010

Greets all,

I'm in New Orleans at the SANS Encryption & DLP conference giving a talk titled “Poor Man's Data Leak Prevention”. I promised the attendees a copy of the slides, so here ya go.

poor-mans-dlp

ICMPv6 Challenge – Answers

December 13th, 2009

The challenge was: “Write a tcpdump/windump filter that will capture ICMPv6 Multicast Listener packets.” I have an extensive write up on what makes the answer so complex. If you know IPv6 and just want the answer, skip to the end.

First, Some Background

Steinar made some comments to the previous posts and was 100% on track. If you read them and thought “Wow, that sounds really messy”, you understand the scope of the problem as well. :)

Protocol Vs. Next Header Field

With IPv4 we had the options field. This could cause the IP header to grow from 20 bytes to as large as 60 bytes in size. With IPv6, there is no longer an options field and the header is fixed at 40 bytes in size. When options are required, we use extension headers to identify them. This throws an interesting curve ball at us because with IPv4 the protocol field (byte 9) would (almost) always identify the upper level transport (TCP, UDP, etc.). With IPv6 the next header field (byte 6) might identify the upper layer transport, or it might identify an extension header which will include some number of options.

Here's a list of some IPv6 extension headers you might run into, as well as the RFCs that define them:

Option # Option Description RFC
0 Hop-by-Hop 2460
6 TCP 793
17 UDP 768
43 Routing 5095
44 Fragmentation 2460
50 ESP 4303
51 AH 4302
58 ICMPv6 4443
59 No next header 2460
60 Destination options 2460
135 Mobility 3775

IPv6 does not limit the number of extension headers you can use in a single packet.There is however a published “recommended order” as to how the headers should be laid out. The order is:

  • IPv6 Header
  • Hop-by-Hop Options
  • Routing Header
  • Fragment Header
  • AH
  • ESP
  • Destination Options
  • Mobility Header
  • TCP/UDP/ICMPv6

Note this list is “recommended” but not mandatory. An IPv6 host must be able to process the headers in what ever order they were received. This means you will probably find vendors following this list but not attackers. I've personally seen devices start acting really odd when you mess with the header order. In fact I've run across quite a bit of “IPv6 compatible code” which can't deal if the preferred order is not used.

Chasing The Protocol Header

So with IPv6 we can have multiple headers behind the IPv6 header. If this sounds like a new concept, it is actually not. In fact you've probably worked with it already. When you deploy IPSec the two possible security protocols are ESP and AH. These were actually borrowed from IPv6 and massaged to work on IPv4. Both AH and ESP include a next header field to identify what type of packet they are protecting.This is referred to as protocol chaining , as you effectively have multiple headers sitting behind the layer 3 protocol header.

So to figure out what upper level transport (TCP, UDP, etc.) is being used, you may have to search through multiple headers before you find the answer. This is referred to as “ chasing the header “, and tcpdump/Windump give us a filter option to perform this task. You may be fimiliar with the proto filter. In the IPv4 world, if I say:

ip proto tcp

That filter reads “check byte 9 of the IPv4 header and if the value is equal to 6 (protocol value for TCP), match on the packet”. This filter is not as effective in the IPv6 world of course because byte 6 of the IPv6 header might identify the upper layer transport, or it might just identify an optional extension header that is being used. To solve this problem, the protochain filter was introduced. Writing:

ip6 protochain tcp

Reads as “Check byte 6 of the IPv6 header to see if the value is equal to 6. If instead you find a value which identifies an optional extension header, check the extension header's next header field for a value of 6. If you find more optional extension headers, keep repeating the last test till you find the last extension header”.

Pretty simple to write in English, but this is a nightmare to implement in code. Most optional extension headers are variable in length which just adds to the complexity. I've done some testing with Scapy and you can actually see the difference in performance when protochain gets invoked. In fact you could probably do a pretty good job of DoSing an IDS/IPS by forcing it to process a lot of useless extension headers.

Writing our filter

So our first problem in writing the challenge filter is that the ICMPv6 header may not appear right after the IPv6 header. We have to watch out for optional extension headers. In fact RFC 2710 states: “All MLD messages described in this document are sent with a link-local IPv6 Source Address, an IPv6 Hop Limit of 1, and an IPv6 Router Alert option [RTR-ALERT] in a Hop-by-Hop Options header.” This means our multicast listener packet is required to have a Hop-by-Hop extension header with the Router Alert option set. With this in mind, our first check should be:

ip6 protochain icmp6

To ensure we are only looking at ICMPv6 packets. Now it is just a matter of checking to see if the type field (byte 0) is set to 130 (Multicast Listener Query) or 131 (Multicast Listener Report).This brings us to our second problem however. In the IPv4 world I can do a:

icmp[0]= <type value of interest>

If I try this with icmp6 I get:

[root@fubar ~]# tcpdump -nn icmp6[0]=130
tcpdump: IPv6 upper-layer protocol is not supported by proto[x]

In other words, I can't use offsets with icmp6 to search for specific values. Windump and tcpdump are advertised as IPv6 compatible, but don't expect to get all the same functionality you have with IPv4. YUCK!

So what do we do? We'll have to fall back on referencing the value from an ip6 offset. In other words, we'll have to measure through the IPv6 header, through the required Hop-by-Hop header, and into the ICMPv6 header to see if the type field is set to 130 or 131. Some things to take into consideration:

  • IPv6 header is fixed at 40 bytes in size
  • Hop-by-Hop header is variable, but 4 bytes with Router Alert set
  • The type field is byte 0 within the ICMPv6 header

So here is what we end up with:

ip6 protochain icmp6 and (ip6[44]=130 or ip6[44]=131)

Caspita! We finally got it! Or did we?

Q: What happens if the packet has additional extension headers?

A: Our filter will not work.

Q: What if the Hop-by-Hop header has more options set than Router Alert?

A: Our filter will not work.

Q: Can we fix the above two problems?

A: Not till tcpdump/Windump filtering adds IF/THEN loop support.

So if we want to capture normal ML traffic, the above filter will work fine. If however we want to insure we catch attacker trickiness as well, the filter is not going to fly.

What if we try something like this:

tcpdump -nn -s 1500 -x ip6 protochain icmp6 | grep -i multicast > multicast.txt

and then just use Wireshark's text2cap tool to convert it to Libpcap format? The problem here is we will only get the header info. Grep will match the summary line which contains the word “Multicast” but then skip all the Hex below it which is the actual contents of the packet.

So the final answer is: “Can't get theya from haya” ;)

So what if you really need to be able to see this traffic? Until support for IPv6 matures, the only 100% method is to grab all ICMPv6 traffic and then manually sort through it.

At least that's my view on this. If anyone can actually come up with a 100% working solution, I would love to hear it.

IP Lookup Completed

December 10th, 2009

Just finished a new tool called IP Lookup that I've submitted to the Apple App store. With any luck it will see the light of day over the next week or so.

I know, there are plenty of TCP/UDP port references out there. I've tried to make this the most complete list available. There are currently over 12,000 entries and I'm still growing the list.

One of the features I'm really psyched about is the real time searching. As you type in what you are looking for, the list is filtered in real time so you can see the results.

screenshot-2

More info can be found at my Mobile Security Hack site.

And now back to your commercial free educational material. ;)