Email Munging
This page illustrates an antispam tool that hides an email address in a web page from spamrobots. Information is also available in French and Italian.
What is spam?
Spam is the term which denotes any unsolicited, mass-mailed email message; it may consist of commercial advertisement, Make Money Fast letters, Ponzi schemes or other scams, etc. As electronic mail allows thousands of letters to be sent at a very low cost, spam mail has become a real plague on the Internet.
Spammers have several ways to collect valid email addresses: one
of their sources is Web pages. They use spam robots that crawl over all
the pages they can reach on the Internet (just like web spiders do to collect data for search engines),
scanning them for mailto: tags or whatever looks like something@something. Any
email address published on a webpage risks being collected and used as a target for mass mailing.
Furthermore, some viruses that spread themselves by email read the browser's cache of the
infected computer to find possible victims: so if an infected computer is used to browse a webpage
containing your address, the virus might sends itself to you via an infected mail from that computer.
Here I explain a simple way to prevent such dangers.
Address encoding to confuse spam robots
In HTML, any character can be expressed by its numeric reference (sometimes called entity). Thatis, you may enter a character as &#n; where n is the Unicode character value; for alphanumeric character and the most used signs, this value coincides with the ASCII 7-bit value. Thus A in the source of a HTML page shows an a when the page is visualized in a browser.
Hence, to hide an email address just substitute one or more letters with their numeric reference, e.g. dave@domain.com may become dAve@domAin.com. The browser interprets it, so from the point of view of human visitors there is no difference. However, as spam robots parse the HTML source of the page, they harvest the obfuscated (munged) address -- which is invalid.
This idea is due to Liam Quinn of
HTML Help and was originally
posted on comp.infosystems.www.authoring.html. As it is based on HTML language
specifications (RFC 1866),
it works with any browser under any OS.
It has been argued that it would be easy to program a spam robot to re-convert encodings into text again, hence thwarting the protection offered by munging. This is true in theory, but in practice spam robots never do this (not yet anyway). Taking the time to parse the text and to interpret all the encodings would slow down the spam robot, thus greatly reducing its performances; and as the majority of email addresses published on the Internet is in plain format, from the spammer's point of view it's not worth the trouble. This was shown in 2003 in a research report published by the Center for Democracy and Technology ("A CDT Report on Origins of Spam").
To verify whether this technique is really effective, I started an empiric test which is still in progress.
I put in this page these two email addresses: they look exactly the same, although
the first one is plain and the second one is obfuscated by munging
(you can easily check that by using the command View Page Source of your browser).
emailmungingtestrec_plain@yahoogroups.com
emailmungingtestrec_munged@yahoogroups.com
Please do NOT send any mail to the addresses above -- they are honeypots for spam only!
I chose two login names long enough so that probably they couldn't be found by a generator of random email addresses
(a common spammer tool).
No mail has ever been sent from these addresses. However, just because they were published in this web page, after a few
days these addresses became being spammed. Here are the figures of the received spam so far:
And here's a chart of the results (click the image to enlarge it):
The test is still in progress, and you can check the latest results by appending each email address' login name to
this URL.
The test showed that munging reduced the amount of spam mail received by about 95%.
The AEM
I wrote a Java applet that automatically obfuscates a complete email address.- Enter your email address in the blank line, then click on the Mung button or simply press Return. If the Link checkbox is selected, the relevant link for sending electronic mail will be added to the address (thatis, visitor of your web page could send you email by clicking on that link).
- Select and copy the code that appears in the field below: this is your email address, obfuscated.
- Paste the code wherever it is needed in your HTML source. That's all!
If you unselect the Link checkbox, you can use the AEM to hide sensitive data other than your email
address, e.g. your name or a telephone number.
Your email address is only converted on your local machine -- it won't be recorded nor transmitted
to anyone. Note that, once the applet has loaded, you can use the AEM even while you're offline.
Source code
The AEM is released as Open Source (under the GNU General Public License) and its source code can be freely downloaded as a standalone Java file.If you just want to install a copy of the AEM on your local machine or intranet, download this zip file that includes the precompiled Java class and an HTML file to use it. Please do not put it on a public website, as this may lead to outdated mirrors!
Here's also a Perl script that does the same thing.
Acknowledgements
Thanks to Richard James for rereading the english version,
and to Cécile Bredelet for rereading the french version.
This page has been inspired by Michael Fleming's
webpage MAILTO: Munging (dead link).
The Automatic Email Munger is referred to by:
"L'acchiappavirus" by Paolo Attivissimo (pag. 189),
La Gazette de Voluceau (N° 07, 23/02/2004) de l'INRIA Rocquencourt,
Virgilio,
GoTo.com,
Fighters4Web,
Gallery Webs,
Richard Hart (University of New Hampshire),
WebJuice,
Web Design Guide,
Dwoz,
FWBO Internet Wiki,
Dimitri Frost,
Michael Attwood's Mahaabaala weblog,
NitroAcquisti,
Laurent Le Pendeven (INRIA Rocquencourt),
Demando,
Google Answers,
Radu Horaud (INRIA Rhône-Alpes),
Myria's weblog,
Pork and pie,
Rob Collins,
blogExtra backBlog,
Christophe Joubert (INRIA Rhône-Alpes),
David,
The Center For Civic Engagement at UTB/TSC,
David Will's Freemasonry page,
Experts Exchange,
Crondall Weather,
Blue Anvil,
Radu Orghidan (EPS - Universitat de Girona),
Nadeau software consulting,
the mungeMailAddress() function doc in the Seagull PHP framework,
Donald Jenkins,
Illustrated Fluteplaying,
IS Web Designs,
and University of East Anglia.
Qu'est-ce que le spam?
Spam est le mot qui définit le "pourriel", le courrier poubelle, envoyé à un grand nombre de destinataires qui ne l'ont ni demandé ni désiré. Il peut s'agir de pub, d'arnaques pyramidales, etc. Comme le courrier électronique permet d'envoyer des milliers de lettres à un coût très faible, le spam est devenu un grand problème sur Internet.
Les spammers (ceux qui envoient du spam) ont plusieurs
façons de se procurer des adresses email valables; notamment via
les pages Web. Ils utilisent des webrobots,
c'est-à-dire des programmes qui scannent toutes les pages web qu'ils peuvent
atteindre à la recherche de balises mailto: ou de tout qui ressemble
à untel@machin.
Chaque fois qu'une adresse email paraît sur une page Web, elle est
exposée au risque d'être enregistrée dans une liste et
utilisée comme cible pour l'envoi de spam.
Dans ce site, je montre une
façon de se défendre.
Y a-t-il une façon de protéger une adresse email publiée dans une page Web?
Oui. Dans le langage HTML, on peut substituer à n'importe quel caractère le code &#n; où n est sa valeur Unicode (ou ASCII à 7 bits). Ainsi, A dans la source HTML apparaîtra comme la lettre a quand le document sera visualisé dans un navigateur Internet.
Pour se protéger, on peut donc tout simplement substituer une ou plusieurs
lettres de l'adresse par le code correspondant. Par exemple,
cecile@domaine.fr peut s'écrire
Cecile@domaine.fr.
Le navigateur sera capable de reconnaître ce code HTML et visualisera
l'adresse dans le "bon" format - le premier; pour les visiteurs, il n'y aura
aucune différence. Cependant, comme les webrobots traitent seulement
le texte pur, ils vont prendre l'adresse dans le deuxième format,
qui n'est pas valable.
Cette idée a été
publiée sur comp.infosystems.www.authoring.html
par Liam Quinn de HTML Help.
Comme elle est basée sur le langage HTML
(RFC 1866), elle
fonctionne sur tout navigateur et système d'exploitation.
Programmer un webrobot pour effectuer la conversion automatique des codes
&# serait facile; toutefois, cela le rendrait beaucoup plus lent. Cette protection
est donc tout à fait efficace (pour l'instant), comme l'a montré une recherche du
Centre Américain pour la Démocratie et la Technologie
("A CDT Report on Origins of Spam").
Un test empirique que j'ai effectué sur ce site a montré que la conversion HTML est efficace à 95%.
Veuillez lire la version anglaise pour plus d'infos.
Le AEM
J'ai écrit une applet Java pour la conversion automatique d'une adresse entière.- Tapez une adresse email dans la ligne vide et cliquez sur Mung, ou bien appuyez sur Entrée. Cochez la case Link pour ajouter le lien à l'adresse.
- Sélectionnez et copiez le texte qui va s'afficher dans le champ: c'est votre adresse après conversion.
- Collez le texte dans votre page HTML, à l'endroit ou aux endroits voulus. C'est tout!
Si vous ne cochez pas la case Link, vous pouvez utiliser l'AEM pour chiffrer
d'autres données sensibles, comme un nom ou un numéro de téléphone.
L'adresse que vous taperez ne sera pas conservée dans une liste,
ni transmise à personne.
Vous pouvez aussi utiliser l'AEM après avoir coupée la connexion.
Cos'è lo spam?
Con spam si indica la posta elettronica spazzatura spedita in massa ad un gran numero di destinatari: pubblicità di prodotti o siti vari, proposte commerciali truffaldine, eccetera. Poiché la posta elettronica permette di inviare migliaia di lettere ad un costo irrisorio, lo spam è diventato una vera piaga nel mondo di Internet.
Gli spammer hanno varie maniere di procurarsi indirizzi email validi, e una
delle fonti a cui attingono sono le pagine web. Essi utilizzano periodicamente degli spamrobot o spambot che percorrono
il World Wide Web seguendo un link dopo l'altro (analogamente a quanto fanno, per uno scopo socialmente più utile, i webrobot dei
motori di ricerca) cercando la parola chiave mailto:, che precede un indirizzo di posta elettronica,
o qualunque cosa che sia nel formato tizio@dominio.
Gli indirizzi trovati vengono registrati in un database e utilizzati per l'invio di spam.
È da notare inoltre che molti virus che si propagano via email analizzano la cache del browser del computer infetto per trovare indirizzi di
potenziali vittime.
In conclusione, pubblicando il vostro indirizzo email su una pagina web (ad esempio il vostro sito personale) rischiate di ricevere spam e virus in
gran quantità.
Di seguito illustro un semplice metodo per minimizzare tale rischio.
Rendere invisibile un indirizzo email agli spamrobot
Nel linguaggio HTML, è possibile definire e stampare qualsiasi carattere tramite la sua entità HTML &#n; dove n rappresenta il valore Unicode del carattere (per i caratteri alfanumerici e i simboli più utilizzati, questo valore corrisponde al valore ASCII a 7 bit). Perciò A nel sorgente HTML visualizzerà una a nel browser.
Quindi, per nascondere un indirizzo email, si può eseguire questa conversione su una o più lettere, per esempio marco@dominio.it potrebbe essere trasformato in mArco@dominio.it. I browser interpretano le entità HTML, quindi i visitatori umani del sito non notano nessuna differenza. Tuttavia, poiché gli spamrobot analizzano il sorgente HTML delle pagine web, registreranno l'email nel secondo formato - quello con gli &# - che non è valido.
Questo trucco è stato ideato da Liam Quinn di
HTML Help e originariamente
postato sul newsgroup comp.infosystems.www.authoring.html.
Essendo basato su delle specifiche del linguaggio HTML
(RFC 1866),
è compatibile con qualsiasi browser su qualunque sistema operativo.
Alcuni obiettano che sarebbe facile programmare uno spamrobot per riconvertire i codici HTML e aggirare così la protezione. Questo è teoricamente vero; in pratica, tuttavia, attualmente gli spamrobot non sono programmati in questo modo perché analizzare e riconvertire ogni singolo codice rallenterebbe molto le loro prestazioni. Poiché la maggior parte degli indirizzi email che si possono trovare su Internet sono codificati nel formato usuale, dal punto di vista degli spammer semplicemente non ne vale la pena. Quindi la conversione HTML è efficace per proteggere un indirizzo email, come confermato anche da un articolo ("Come ci si difende dallo spamming; i risultati di uno studio Usa") sulla Newsletter del 31/3/2003 del Garante per la Protezione dei Dati Personali, il quale riporta un recente studio condotto negli USA dal Center for Democracy and Technology (CDT).
Per verificare di persona l'efficacia di questa protezione, ho condotto per conto mio un test empirico.
Questa pagina web contiene questi due indirizzi email: sembrano simili, ma
il primo indirizzo è nel formato usuale mentre il secondo è stato codificato convertendo in HTML tutti i suoi caratteri (come potete
verificare col comando Visualizza il sorgente della pagina dal menu del vostro browser).
emailmungingtestrec_plain@yahoogroups.com
emailmungingtestrec_munged@yahoogroups.com
Non inviate posta a questi due indirizzi: sono degli honeypot il cui unico scopo è raccogliere spam.
Ho scelto due nomi di login appositamente lunghi per non esser trovati da un generatore di indirizzi casuali (una utility usata spesso dagli
spammer).
Questi indirizzi non sono mai stati usati per inviare email. Tuttavia, semplicemente per il fatto di trovarsi su una pagina web, dopo un
paio di giorni hanno iniziato ad essere bombardati di spam.
Il test ha mostrato che la codifica dell'indirizzo email è risultata efficace nel prevenire circa il 95% dello spam.
Per maggiori informazioni fate riferimento al testo in inglese qui sopra.
L'AEM
Ho scritto una applet Java per la codifica automatica di un indirizzo email.- Inserite un indirizzo email nella linea vuota, quindi fate clic su Mung o premete Invio. Se la casella Link è selezionata, verrà aggiunto all'indirizzo un link per la posta elettronica.
- Selezionate e copiate il codice che apparirà nel campo sottostante; questo è l'indirizzo email dopo la codifica.
- Incollate il codice nel sorgente della vostra pagina HTML, in tutti i punti in cui ne avete bisogno.
L'AEM è utile anche per rendere invisibili dai webrobot altri dati sensibili, come un nome o un numero di telefono; in questo
caso, non selezionate la casella Link.
L'indirizzo che inserite viene solo analizzato e codificato carattere per
carattere sul vostro computer. Non ne verrà fatto alcun altro utilizzo:
non sarà conservato in una lista, né trasmesso a me o a
terze persone.
Nota: una volta che la applet dell'AEM è stata caricata, potete utilizzarla anche scollegati dalla rete.

