Caught in the Net

Breve riflessione dal mio piccolo mondo virtuale

Non sono una persona che va ai concerti.

La registrazione in studio esplicita i processi logici che l'artista segue per arrivare al processo di consegna e questo mi ha sempre affascinato, in maniera assai maggiore della carica emotiva sprigionata da un concerto di notte.

Ma ci sono due artisti, Dale Crover dei Melvins e Jeff Mangum le cui performance live sono state per me, come spettatore, in qualche modo epifaniche.

Milano, dicembre del 2015, i Melvins stanno concludendo il loro piú recente tour in Europa quando Jeff Pinkus lascia cadere il basso sul pavimento, regola gli effetti sulla pedaliera e lo prende a calci finché non produce la giusta ripetizione di suoni. Lentamente ciascun musicista si allontana dal palco, il basso insistente, ancora a terra.

Quell'esecuzione mi fece riflettere sui processi di produzione che dominano la nostra comunicazione. Possiamo immaginarci delle fasi. La prima é quella di sperimentazione che é tanto piú ovvia quanto immediata e involontaria.

La seconda é quella del superamento. Superamento é la consapevolezza che il brano composto oggi verrá suonato diversamente domani, é la ragion d'essere delle bozze, anche quando infinite.

La terza e quella piú importante per comprendere le dinamiche di rete é la dissipazione. Attraverso la dissipazione l'opera, che fissata nel momento aveva acquisito una propria dimensione di senso, é costretta a ripiegarsi su se stessa, vana si perde a cause dell'assenza di memoria.

Le dinamiche della Rete

In rete l' accanimento si sostituisce alla dissipazione.

L' accanimento é il motivo per cui qualche migliaio di uomini di qualsiasi fattura sociale si riuniscono in gruppi e condividono foto delle loro mogli, fidanzate e qualche amica. Non c'é nessuno scandalo nella foto in sé, sono scatti quotidiani spesso "rubati" dagli stessi profili delle donne riprese.

Ne ha parlato Repubblica, se ne é parlato su reddit, perfino Mentana nella sua ridicola posizione da cavaliere bianco di Facebook ha urlato contro questo fenomeno.

Fenomeno che dal mio punto di vista nasce da una difficoltà di alcuni abitanti della rete ad affrontare l'assenza di dissipazione nella comunicazione online.

Le macchine non ricordano eppure non smettono di ricordarci, anzi invadono il nostro spazio in rete con un continuo susseguirsi di foto e momenti di vita delle altre persone.

Gli algoritmi non seguono il pacato moto del nostro tempo online e anzi lo spezzano, lo frammentano in attimi che hanno il ritmo di un giro della rotella del mouse, lo scorrere di un pollice.

Memoria

Nei miei primi anni le mie fugaci interazioni virtuali non avevano la qualitá della memoria.

Bulimico degli ascii, passavo da lunghe e sostenute conversazioni su irc al lurking di qualche mailing list, saltuariamente 4chan. Mi sentivo (e mi sento tutt'ora) obbligato ad archiviare qualsiasi riga che suscitasse un minimo di interesse o potesse avere qualche valore futuro.

Poi sono arrivate le cache, Wayback Machine, Reddit, e sembra che i contenuti non scompaiano piú.

Eppure mi ci é voluto un pó per capire che questa non é memoria, solo una forma nobile di accanimento.

Piace ai nostalgici, agli archivisti.

Spaventa a chi di Internet non vuole farsene una ragione.

Capire il Machine Learning (parte 3)

Riconoscimento delle immagini

Il machine learning viene utilizzato anche per il riconoscimento delle immagini. La tipologia di rete neurale utilizzata per questa applicazione è chiamata rete neural a convoluzione ( convolutional neural networks), abbreviata CNN.

Innanzitutto consideriamo che ogni immagine può essere codificata come una matrice di valori

pixel

Vediamo ora quali sono le operazioni compiute da una CNN per riconoscere delle immagini.

Convoluzione

Durante la fase di apprendimento, la rete neurale analizza moltissime immagini (categorizzate) utilizzando dei "filtri", ovvero delle funzioni che mescolate all'input originale permettono di evidenziare dei pattern nell'immagine. Questi pattern corrispondono alle caratteristiche proprie di un oggetto (quali possono essere ad esempio per un uccello il becco, le piume, le ali) e nel caso queste sono presenti, possiamo riconoscere l'immagine.

In questo esempio l'immagine di Wally é mescolata (l'operazione si chiama convoluzione) con un filtro "a cerchio" che risponde molto bene a caratteristiche come quella di possedere degli occhi.

waldoblue

La convoluzione é un'operazione che ha la proprietá di essere indipendente dalla posizione. Non importa la posizione degli occhi, quando applichiamo la convoluzione su un'immagine con un filtro "a cerchio" notiamo che gli occhi sono presenti.

Subsampling

Ogni segnale contiene del "rumore", ovvero degli elementi che la allontanano dal comportamento ideale.

ideal

real

Attraverso il subsampling possiamo ridurre il rumore e rendere il nostro algoritmo meno suscettibile a queste piccole variazioni; benché l'immagine abbia una risoluzione minore, i pattern rimangono.

waldosub

Connessione completa

Alla fine dell'analisi tutte le caratteristiche estrapolate vengono considerate nell'insieme e in questo modo possiamo capire a quale categoria appartiene l'immagine.

Questo procedimento a livello algoritmo si esplicita con una connessione completa fra tutti i nodi della rete neurale che possono poi restituire l'output (probabilitá che l'immagine appartenga ad una determinata categoria).

Fase di rinforzo

Durante il training é presente un'ultima fase (o strato), chiamato piú propriamente loss layer. Questo strato provvede a dare un feedback alla rete neurale analizzando l'output in relazione ai dati di partenza (ovvero le immagini giá categorizzate).

Capire il Machine Learning (parte 2)

Nel precedente post abbiamo preso in considerazione una rete neurale molto basica. Proviamo ora ad approfondire il concetto aggiungendo una proprietá fondamentale, la memoria.

Memoria e Stati

La rete neurale che abbiamo modellato non ha alcun tipo di memoria. con gli stessi dati di input, l'output è (quasi certamente) lo stesso. Possiamo ampliare il nostro modello introducendo il concetto di stato.

Poniamo il problema della vendita delle auto in questo modo: immaginiamo di avere un algoritmo di machine learning che valuti le auto e faccia delle offerte di vendita che conseguentemente vengono valutate da delle persone e accettate oppure rifiutate. Ogni volta che una proposta viene accettata la teniamo in memoria e nell'aggiustare i pesi per la seguente offerta, teniamo in considerazione la validità dei pesi usati in precedenza. In altre parloe, in ogni operazione di valutazione dell'auto salviamo lo stato dell'offerta precedente (rifiutata o accettata) e la consideriamo quando vogliamo proporre l'offerta successiva. Abbiamo in questo modo una recurrent neural network (RNN) dove ogni stato precedente viene utilizzato per modificare l'output dell'algoritmo.

Generazione di testo attraverso le RNN

Immaginiamo di voler creare un algoritmo che utilizzando una RNN possa generare del testo o prevedere quale sarà il prossimo carattere inserito (come nel caso del T9).

Inizialmente dobbiamo permettere alla RNN di analizzare almeno qualche sample del nostro testo. La RNN analizza carattere dopo carattere e costruisce un grande grafo dove collega ogni carattere al suo successivo. Inizialmente l'output della nostra RNN non ha alcun valore: in questo esempio, abbiamo l'output di una RNN allenata attraverso Guerra e Pace:

tyntd-iafhatawiaoihrdemot  lytdws  e ,tfti, astai f ogoh eoase rrranbyne 'nhthnee e 
plia tklrgd t o idoe ns,smtt   h ne etie h,hregtrs nigtike,aoaenns lngty

L'output prodotto dalla RNN, benchè non abbia nessun valore per un umano, viene analizzato dalla RNN per arricchire il grafo costituito inizialmente dai caratteri (e le loro relazioni) di Guerra e Pace. Questo procedimento continua all'infinito. Ogni volta che la RNN produce dell'output lo salva e lo riutilizza come input in maniera ricorsiva per generare nuovo output.

Dopo 300 iterazioni abbiamo un output di questo tipo:

"Tmont thithey" fomesscerliund
Keushey. Thom here
sheulke, anmerenith ol sivh I lalterthend Bleipile shuwy fil on aseterlome
coaniogennc Phe lism thond hon at. MeiDimorotion in ther thize."

Dopo quasi mille:

Aftair fall unsuch that the hall for Prince Velzonski's that me of
her hearly, and behs to so arwage fiving were to it beloge, pavu say falling misfort 
how, and Gogition is so overelical and ofter.

Duemila:

"Why do what that day," replied Natasha, and wishing to himself the fact the
princess, Princess Mary was easier, fed in had oftened him.
Pierre aking his soul came to the packs and drove up his father-in-law women.

Possiamo notare come l'output migliori visibilmente.

Nel prossimo post tratterò una variante di rete neurale utilizzata per classificare e riconoscere immagini.

Capire il Machine Learning (parte 1)

Questo è il primo di una serie di post che hanno l'obbiettivo di fornire una breve e generale introduzione al mondo del machine learning e delle intelligenze artificiali piú in generale. Mi auguro che questa breve introduzione al mondo dell'apprendimento automatico sia una sorta di vaccino contro il sensazionalismo mediatico e la disinformazione che negli ultimi anni fanno da contorno al progresso in questo settore.

Non c'è risultato senza algoritmo

Nelle scienze informatiche un algoritmo è un insieme di istruzioni che partendo da uno stato iniziale (input) permette di arrivare ad uno stato finale (output) attraverso una serie di step logici. Ogni algoritmo utilizza una logica propria e specifica per il problema di cui si occupa. Nel caso del machine learning l'algoritmo non viene progettato in base al tipo di problema bensí vengono utilizzati algoritmi generici adattabili attraverso dei parametri. L'algoritmo di machine learning analizza i vari parametri e i dati che riceve "in pasto" al fine di raggiungere lo stato di output ottimale. L'output ottimale è la migliore approssimazione di un risultato teorico che si raggiunge nella fase di "training".

La macchina impara

Nella fase di allenamento o di apprendimento, il "training", si possono adottare due tecniche differenti: apprendimento con supervisione ( supervised learning ) e apprendimento senza supervisione ( unsupervised learning ).

Supervised Learning

Immaginiamo di dover valutare il prezzo di un'automobile usata senza essere esperti in materia. Noi abbiamo questi dati:

PREZZO ORIGINALE Km percorsi stato di usura PREZZO FINALE
50 000 120 000 lieve 40 000
30 000 150 000 notevole 8 000
20 000 80 000 lieve 15 000
20 000 120 000 notevole ...

Dalla tabella possiamo dedurre la caratteristica fondamentale del supervised learning: abbiamo due vettori (serie di dati) di input (prezzo originale) e di output (prezzo finale) che hanno una correlazione certa e valida.

Possiamo dedurre intuitivamente quale sarà il prezzo dell'ultima auto se analizziamo i dati precedenti. Questo è quello che succede nel caso del supervised learning. Un algoritmo di machine learning che utilizza il supervised learning estrapolerà la relazione fra i vari dati e in questo modo potrà ottenere un determinato output partendo dai dati di input. Possiamo capire già da ora che nel caso ci fossero dati che "inquinano" il nostro data set, come ad esempio il colore dell'auto, l'algoritmo non sarà capace di fare un'analisi corretta.

La precisione della soluzione dipende dalla quantità di dati e dall'influenza che questi hanno nella situazione reale.

Unsupervised Learning

Nel caso di unsupervised learning ci troviamo di fronte agli stessi dati ma senza la possibilità di conoscere il prezzo finale.

PREZZO ORIGINALE Km percorsi stato di usura
50 000 120 000 lieve
30 000 150 000 notevole
20 000 80 000 lieve
20 000 120 000 notevole

Non siamo capaci di stabilire il prezzo finale attraverso l'unsupervised learning, ma possiamo stabilire dei pattern fra i vari dati. Non c'è nessun tipo di feedback (il prezzo finale) che possa aiutarci a capire se il risultato sia giusto ma possiamo analizzare le notevoli relazioni fra i dati.

Machine Learning e intelligenza

Concentriamoci sul supervised learning. Nel caso della vendita dell'automobile, abbiamo un semplice problema con una soluzione lineare di questo tipo: prezzo finale = prezzo originale + km percorsi + stato di usura

Ovviamente ogni incognita nella nostra equazione influisce diversamente sul prezzo finale e quindi possiamo riscriverla come: prezzo finale = A *prezzo originale + B *km percorsi + C * stato di usura

Se pensiamo ad un algoritmo possiamo ragionare in questo modo:

funzione: calcola_prezzo_auto:
    parametri: prezzo_originale, km_percorsi, stato_usura
    variabili: prezzo_finale = 0

    prezzo finale = prezzo_originale * 0.804246
    prezzo finale = prezzo_finale + km_percorsi * -0.000125
    prezzo finale = prezzo_finale + stato_usura * -2500

I valori di quelle costanti, stabilite casualmente nell'esempio, sono chiamate pesi e servono a stimare il prezzo finale. Una volta stabiliti i pesi, il nostro algoritmo di supervised learning applica questi pesi ai dati originali e ne valuta l'errore:

PREZZO ORIGINALE Km percorsi stato di usura PREZZO FINALE PREZZO STIMATO
50 000 120 000 lieve 40 000 374888
30 000 150 000 notevole 8 000 16000
20 000 80 000 lieve 15 000 13492
20 000 120 000 notevole ... 10988

Una volta valutato l'errore e la distanza dal prezzo finale, l'algoritmo di machine learning modifica i pesi di conseguenza e ripete la procedura fino ad arrivare al risultato che piú si avvicina ai dati iniziali. rete1 Ci sono varie funzioni che stimano l'errore e permettono di correggere i pesi o metodi che restringono lo spazio di ricerca fino a convergere alla soluzione, ovvero i pesi cercati.

Reti Neurali

Ora, come possiamo immaginare, il prezzo di un'auto ha molti fattori che si aggiungono a quelli elencati nell'esempio. Non solo, ma molti problemi non hanno una soluzione lineare, ovvero una soluzione che si puó semplicemente esprimere attraverso una funzione che aggiunge e moltiplica i valori una sola volta.

Possiamo arricchire l'esempio dell'automobile immaginando di avere più set di pesi e di ripetere il procedimento più volte:

|---------------------------------------------------|
| PREZZO_ORIG * peso A1 ----->                      |
| KM_PERCORSI * peso B1 ----->                      |
| STATO_USURA * peso C1 ----->                      |
|                            PREZZO FINALE STIMATO 1|
|---------------------------------------------------|

| --------------------------------------------------|
| PREZZO_ORIG * peso A2 ----->                      |
| KM_PERCORSI * peso B2 ----->                      |
| STATO_USURA * peso C2 ----->                      |
|                            PREZZO FINALE STIMATO 2|
|---------------------------------------------------|

| --------------------------------------------------|
| PREZZO_ORIG * peso A3 ----->                      |
| KM_PERCORSI * peso B3 ----->                      |
| STATO_USURA * peso C3 ----->                      |
|                            PREZZO FINALE STIMATO 3|
|---------------------------------------------------|

E ora immaginiamo di combinare ogni PREZZO FINALE STIMATO in un'ultimo risultato:

| --------------------------------------------------|
| PREZZO_1 * peso X  ----->                         |
| PREZZO_2 * peso Y  ----->                         |
| PREZZO_3 * peso Z  ----->                         |
|                            PREZZO FINALE DEF      |
|---------------------------------------------------|

Questa é, seppur molto basica, una rete neurale. Proviamo a visualizzarla in un'immagine dove i box arancioni sono i nodi di input e i rossi sono i nodi "nascosti" e temporanei.

rete2

In una rete neurale (neural networks) abbiamo:

  • i neuroni: la funzione di stima e i set di pesi;

  • le catene: i collegamenti fra neuroni che permettono di valutare il prezzo più volte.

Nel prossimo post cercherò di approfondire il concetto di rete neurale con degli esempi di applicazioni concrete.

A short talk about cryptography at the Berkman Klein Center

The 7th of July me and Aaron, as interns at the Berkman Klein for Internet and Society, gave a presentation on the basics of cryptography and a quick overview on the essential tools.

What follows is a short summary of that presentation. The slides are available here

Whose Security?

Let's define what security is. Security is the possibility to being set free from structural costraints, and as that we can distinguish various levels of security depending on who we are.

Also, if we want to investigate security we should also define our threats: security, as being set free, from intelligence surveillance can be our target. Our concerns as different if we consider instead security from censorship or corporation data mining.

uber god view facebook law enforcement form

What is shown above is the Uber God View, a tool Uber used to track a Buzzfeed's journalist locations, and the Facebook standard form that is given to law enforcement when requested.

Security is a state of mind

Security is hard. It is really rare to reach a state of complete security and even in that case, it depends on our target.

What is important is to train ourselves to security. Security is a state of mind and there are no tools that automatically protect us without our active partecipation.

Let's explore that in details.

The layers of security

We can distinguish four layers of security:

  • Device Security
  • Network Security
  • Message Security
  • Human Security
Device Security, where everything happens

Device security is related to the "physical host".

If the computer we use is tampered, at the hardware level, or the phone is bugged, there is no way to escape using higher level tools.

In other words, it doesn't matter if we use a super secure password if our computer is registering all our keystrokes and send them to a third party.

Also, device security is useful if we consider that our device can fall into the hands of attackers that may be able to traceback all the activities.

Some precautions for this purpose:

  • full disk encryption
  • minimal set of application installed
  • open source operating systems
Network Security

The network is the infrastructures that our device is attached to. In most of the case, when we consider our computer is the internet (and the GSM network in case of mobile phones).

Network security is essential to evade censorship, behavioural tracking and identity theft.

Some tools that may help in this case:

  • vpn
  • tor
  • p2p networks
  • mesh networks

And for the web:

  • opensource web browsers (such as firefox)
  • no google apps on android phones
  • https
Message Security

Message security is the level of protection regarding the content that you want to send or receive.

Message security is essential if you want to avoid any third party snooping and the confidentiality of your messages.

The tools we can use in this context:

  • OTR
  • opensource messaging protocols (XMPP, matrix)
  • Signal
  • PGP

Also, always remember that encrypting the content of the message doesn't guarantee that your identity and the metadata are hidden.

Everything comes down to the human level at a certain point.

This is way it is important to train ourselves in security.

If we consider Kevin Mitnick's history, or the recent FBI deputy director hack we see that social engineering plays a big role when we want to undermine the security of an individual of interest.

But security matters even if we are not target of interest.

For example let's consider our password. If we use the same password on every site and one cracker manages to gain access to just one of them, our whole activities online can be exposed and our identity stolen. This is relevant. Myspace had its database breached and the password of Zuckerberg (even a simple one) was exposed. Given that he used the same password on twitter and other sites, his multiple accounts were compromised.

What is TOR and how it works

When you visit a website with your mobile phone or a browser on your computer lots of things go on under the hoods.

Your computer, as a client, makes what is called an handshake with the server.

After telling the server that the client is interested in its content, a series of packets containing data is exchanged.

That is the content of a connection. Inside this packets there are a multitude of information of two kinds:

  • the web page or the content we are trying to visualize
  • information on the status of both the server and the client

The informations contained in every packet can be analized to understand the "identity" of the client that is requesting the content on the server, first of all the IP that is a sort of web address that every computer on the net has.

Not only, during the transmission of this packets, various entity on the communication channel can analize the content and mine our data.

Cute infographic

TOR still uses this kind of routine to gather the content of a web page, but instead of connecting directly to the destination server it goes through a series of other servers called relay: instead of going directly from A to B, it goes from A to C to D to E to F to B.

If the web was a kindergarden Alice instead of telling directly her phrase to Bob, she would tell the word to a friend that in turn would tell the word to a friend and so on, until Bob heards the word, without knowing that Alice said that at the beginning.

At this point you should ask yourself: are the data more protected if it goes through a network of relays? It actually is given that every time you send a packet through the TOR network, it gets encrypted so that no one knows it's content.

To tell the truth, actually the relay (called exit node) that will send the packet to the destination server, knows the content of the packet but does not know the origin.

Ultimately a website can be entirely hosted on the TOR network, called the onion network, so that the packets never exit from the relays and the relay don't know the phisycal location of the server, so every entity on the network reach a perfect level of anonimacy.

Who owns the relays?

Actually every one can host and own a relay if they are willing to do so. I personally host one right now and there are many others that share a little fraction of their network connection.

My little raspi is moving some packets right now

Running a relay node is very easy and everybody should do so. Running an exit node instead is more troublesome and I don't suggest it if you are not a big entity that can handle some sorts of occasional trouble.

Don't play the fool on the TOR network

Of course TOR doesn't guarantee you perfect anonimacy. At the end it all comes to the human layer.

It's no use to surf the web through TOR if we then log in to our personal blog or our personal facebook page.

But there are other subtle factors that can be exploited by web companies to gather info and track their users.A

Such factors are:

  • the size of the screen and the colors supported by it
  • the timezone
  • canvas and images that the server asks your computer to generate
  • information about your OS that are sent through packets
  • the fonts available on your system
  • touch support
  • cookies
  • ads and cross site requests

In particular, most of these are exploitable using a web programming language, javascript, that lots of web pages uses to render content. TOR users should avoid the use of javascript.

Public Private Key Encryption

While TOR is recent technology, public key encryption is a concept way older.

What happens when we use public / private key encryption tools is conceptually similar to what happens with our physical correspondence.

A public key is similar to our mailbox.

Everyone that knows the location of a person's mailbox can write a message and put it inside but only the owner of that mailbox, using is own key can open the mailbox and read the various messages.

When we use PGP or GPG (an implementation of the public key encription concept) we generate a pair of key.

A public one that we should broadcast or at least share with our social circle, and a private key that must remain secret at any cost.

Everyone can encrypt every kind of digital content using our public key (that is just a really long string) and only the owner of the private key can proceed to decryption of the content.

This also means that we know who is gonna read the message if encrypted using this kind of technologies.

One easy tool for GPG encryption is GPA

Metadata

What would you do if you were asked to put under surveillance one person?

For sure placing a bug with microphone and recording capabilities would be the best option.

But what if, instead of recording every thing the subject does, we just take a note of all his actions, without taking care of the content. For example, if the subject speaks to someone, we record the time, the place, the duration of the conversation and all the info of the person he is talking with. What if, when the person walks into a mall, we record the time, the location, the shops he entered, the money he spent, the number of things bought, but not the things he bought, in detail.

You can see that you can have a fairly precise idea of the habits of the person under your surveillance.

Actually from metadata is easy to grab all kinds of personal information. Also, if a tiny portions of the information we have on the subject are more detailed (for example social network photos) we have a picture as clear as never.

This is not just one of the biggest concern that should pop into your mind when you are talking about nation wide mass surveillance, it is also the core of the business of corporations like Facebook and Google.

Whatsapp does not read the content of your messages but it stores every single bit of metadata that comes with it.

Metadatas are enought to build a complete profile of the users and they are even more dangerous in the hands of an evil state agency.

Nothing to hide

Even if we have nothing to hide, we have much to fear.

The "nothing to hide" argument is something that everyone of us in this room has heard, at least one time.

We should fear this sentence because it is the ultimate ammision of a big misunderstanding on the whole debate.

Privacy, first of all, is control over our data, not only the right to secrecy.

Transparency should be for everyone

There is a big incoherence when asking to your citizens to handle over their data.

Transparency should be a two way thing, while at the current state big three letter agencies, but high level people as well, cover their tracks and are not transparent on their reports.

This enhance a situation of big inequality between the people and the State.

Even worse, it is not the citizen by himself that can choose if he has something to hide, but the autority.

This may seem a little naive to say, but with Bruce words:

If you give me six lines written by the hand of the most honest of men, I will find something in them which will hang him.

This is true even without considering social discrimination and mass media manipolation.

The fundamental of society

Every action can be seen as either legal or illegal. When we take a decision this is one of the first, implicit concern.

This is not true in a surveillance system: when you are doing something your concern is all about the possibility of raising suspicion.

An idea not an action is what is needed in such a dystopic condition to prove a citizen guilty.

Sometimes two wrongs make a right

In America we are now discussing weed legalization.

Do you think that such debate would have been possible if no one could had the possibility, even if against the law, to try that substance and show other citizen the real implications of their actions?

The same goes for gay marriages, that we are discussing in Italy. Challenging the law, breaking it if needed, is a way to improve the current system.

Inside the panopticon every potential criminal would be persecuted and this kind of advancement would not be possible.

To hide is to care

A simple truth is that we don't close the windows to cover up our crimes.

Our innermost experiences become in our intimacy, which is the most sacred place.