Tuesday, 15 October 2013

HOW INJECTION ATTACKS WORK




HOW INJECTION ATTACKS WORK





Injection attacks are based on a single problem that persists in many technologies: namely,

no strict separation exists between program instructions and user data (also referred to as

user input). This problem allows for attackers to sneak program instructions into places

where the developer expected only benign data. By sneaking in program instructions, the

attacker can instruct the program to perform actions of the attacker’s choosing.

To perform an injection attack, the attacker attempts to place data that is interpreted
as instructions in common inputs. A successful attack requires three elements:


• Identifying the technology that the web application is running. Injection attacks

are heavily dependent on the programming language or hardware possessing

the problem. This can be accomplished with some reconnaissance or by simply

trying all common injection attacks. To identify technologies, an attacker can

look at web page footers, view error pages, view page source code, and use

tools such as nessus, nmap, THC-amap, and others.



• Identifying all possible user inputs. Some user input is obvious, such as HTML

forms. However, an attacker can interact with a web application in many ways.

An attacker can manipulate hidden HTML form inputs, HTTP headers (such as

cookies), and even backend Asynchronous JavaScript and XML (AJAX) requests

that are not seen by end users. Essentially all data within every HTTP GET and

POST should be considered user input. To help identify all possible user inputs to

a web application, you can use a web proxy such as WebScarab, Paros, or Burp.



• Finding the user input that is susceptible to the attack. This may seem diffi cult,

but web application error pages sometimes provide great insight into what user

input is vulnerable.

The easiest way to explain injection attacks is through example. The following SQL

injection example provides a solid overview of an injection attack, while the other

examples simply focus on the problem with the specific language or hardware.





Attackers use SQL injection to do anything from circumvent authentication to gain

complete control of databases on a remote server.

SQL, the Structured Query Language, is the de facto standard for accessing databases.

Most web applications today use an SQL database to store persistent data for the

application. It is likely that any web application you are testing uses an SQL database in

the backend. Like many languages, SQL syntax is a mixture of database instructions and

user data. If a developer is not careful, the user data could be interpreted as instructions,

and a remote user could perform arbitrary instructions on the database.

Consider, for example, a simple web application that requires user authentication.

Assume that this application presents a login screen asking for a username and password.

The user sends the username and password over some HTTP request, whereby the web

application checks the username and password against a list of acceptable usernames

and passwords. Such a list is usually a database table within an SQL database.

A developer can create this list using the following SQL statement:

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

CREATE TABLE user_table (

id INTEGER PRIMARY KEY,

username VARCHAR(32),

password VARCHAR(41)

);

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


This SQL code creates a table with three columns. The first column stores an ID that

will be used to reference an authenticated user in the database. The second column holds

the username, which is arbitrarily assumed to be 32 characters at most. The third column

holds the password column, which contains a hash of the user’s password, because it is

bad practice to store user passwords in their original form.

We will use the SQL function PASSWORD() to hash the password. In MySQL, the

output of PASSWORD() is 41 characters.

Authenticating a user is as simple as comparing the user’s input (username and

password) with each row in the table. If a row matches both the username and password

provided, then the user will be authenticated as being the user with the corresponding

ID. Suppose that the user sent the username lonelynerd15 and password mypassword. The

user ID can be looked up:
-------------------------------------------------------------------------------------------

SELECT id FROM user_table WHERE username='lonelynerd15' AND

password=PASSWORD('mypassword')

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


If the user was in the database table, this SQL command would return the ID

associated with the user, implying that the user is authenticated. Otherwise, this SQL

command would return nothing, implying that the user is not authenticated.

Automating the login seems simple enough. Consider the following Java snippet

that receives the username and password from a user and authenticates the user via an

SQL query:

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

String username = req.getParameter("username");

String password = req.getParameter("password");

String query = "SELECT id FROM user_table WHERE " +

"username = '" + username + "' AND " +

"password = PASSWORD('" + password + "')";

ResultSet rs = stmt.executeQuery(query);

int id = -1; // -1 implies that the user is unauthenticated.

while (rs.next()) {

id = rs.getInt("id");

}

-------------------------------------------------------------------------------------------
The first two lines grab the user input from the HTTP request. The next line constructs

the SQL query. The query is executed, and the result is gathered in the while() loop. If

a username and password pair match, the correct ID is returned. Otherwise, the id stays

-1, which implies the user is not authenticated.

If the username and password pair match, then the user is authenticated. Otherwise,

the user will not be authenticated, right?

Wrong! There is nothing stopping an attacker from injecting SQL statements in the

username or password fields to change the SQL query.

Let’s re-examine the SQL query string:
-------------------------------------------------------------------------------------------

String query = "SELECT id FROM user_table WHERE " +

"username = '" + username + "' AND " +

"password = PASSWORD('" + password + "')";
-------------------------------------------------------------------------------------------

The code expects the username and password strings to be data. However, an

attacker can input any characters he or she pleases. Imagine if an attacker entered the

username ’OR 1=1 -- and password x; then the query string would look like this:
-------------------------------------------------------------------------------------------

SELECT id FROM user_table WHERE username = '' OR 1=1 -- ' AND password

= PASSWORD('x')
-------------------------------------------------------------------------------------------

The double dash (--) tells the SQL parser that everything to the right is a comment,

so the query string is equivalent to this:

-------------------------------------------------------------------------------------------
SELECT id FROM user_table WHERE username = '' OR 1=1
-------------------------------------------------------------------------------------------


The SELECT statement now acts much differently, because it will now return IDs

where the username is a zero length string ('') or where 1=1; but 1=1 is always true! So

this statement will return all the IDs from user_table.

In this case, the attacker placed SQL instructions ('OR 1=1 --) in the username

field instead of data.



Choosing Appropriate SQL Injection Code

To inject SQL instructions successfully, the attacker must turn the developer’s existing

SQL instructions into a valid SQL statement. For instance, single quotes must be closed.

Blindly doing so is a little difficult, and generally queries like these work:

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

• ' OR 1=1 --

• ') OR 1=1 --

-------------------------------------------------------------------------------------------
Also, many web applications provide extensive error reporting and debugging

information. For example, attempting ' OR 1=1 -- blindly in a web application often

gives you an educational error message like this:


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

Error executing query: You have an error in your SQL syntax; check the

manual that corresponds to your MySQL server version for the right

syntax to use near 'SELECT (title, body) FROM blog_table WHERE

cat='OR 1=1' at line 1

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



The particular error message shows the whole SQL statement. In this case, it appears

that the SQL database was expecting an integer, not a string, so the injection string

OR 1=1 --, without the proceeding apostrophe would work.

With most SQL databases, an attacker can place many SQL statements on a single line

as long as the syntax is correct for each statement. For the following code, we showed

that setting username to ' OR 1=1 and password to x returns that last user:


-------------------------------------------------------------------------------------------
String query = "SELECT id FROM user_table WHERE " +

"username = '" + username + "' AND " +

"password = PASSWORD('" + password + "')";


-------------------------------------------------------------------------------------------
However, the attacker could inject other queries. For example, setting the username to

this,
-------------------------------------------------------------------------------------------

' OR 1=1; DROP TABLE user_table; --

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


would change this query to this,
-------------------------------------------------------------------------------------------

SELECT id FROM user_table WHERE username='' OR 1=1; DROP TABLE

user_table; -- ' AND password = PASSWORD('x');

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

which is equivalent to this:
-------------------------------------------------------------------------------------------

SELECT id FROM user_table WHERE username='' OR 1=1; DROP TABLE

user_table;
-------------------------------------------------------------------------------------------



This statement will perform the syntactically correct SELECT statement and erase the

user_table with the SQL DROP command.



Injection attacks are not necessary blind attacks. Many web applications are developed

with open-source tools. To make injection attacks more successful, download free or

evaluation copies of products and set up your own test system. Once you have found an

error in your test system, it is highly probable that the same issue will exist on all web

applications using that tool.








Set Up VirtualBox

★ How To Set Up VirtualBox - Beginner ★

Here I will explain how to set up a virtual machine and in this case it's VirtualBox. There are many benefits to having a virtual box. It allows you to run another OS inside your current OS. You can also use it to test viruses/bots/keyloggers without having to worry about the infection spreading. Think of it as a disposable computer. Sandbox but on a much larger scale.

For this tutorial you will need:

  • VirtualBox
  • ISO, CD or bootable USB with the operating system of your choice.



[Image: eEVuw.png][Image: vak2t.gif]

Start of by downloading the VirtualBox installation. You can download it from the official site. Once installed, run VirtualBox and you'll be presented with the screen above.

Click on new and you'll be asked to choose your operating system that you're using. You can see the various options that are on offer. Choose the one you are installing and give your operating system a name. This doesn't have to relate to the operating system, it's just a name you pick like for a user profile.

[Image: WJINj.png]

Here you choose the amount of RAM to assign to the virtual operating system. Make sure the amount of RAM assigned is enough for the operating system but also insuring that your PC will not be under strain. I suggest not going over half of your total RAM. If you have 4GB installed, assign no more than 2GB to your virtual box.

[Image: iVF5j.png][Image: 2LwsG.png][Image: 4j6xS.png]

Were making a new machine here, so we'll pick the middle option. Here you'll also pick the type of virtual box hard drive file. Don't worry too much about what each option does, the one I've selected will do fine. If you pick a dynamically allocated space it just means the size of the virtual box file will increase as you go along and if you picked fixed size it will stay the same until you change it yourself.

[Image: KyfpU.png][Image: FK9Nv.png]

Once you've picked the size of your hard drive, you'll be presented with the final few steps. Press the Start button on this window.

[Image: gvTLC.png][Image: tpvDZ.png][Image: Q6ibf.png]

Click the folder icon and you'll be asked to pick a file. Choose your ISO & press start. Follow on-screen instructions to finalize the setup.

Troubleshooting:

Q: The internet on my Virtualbox doesn't work.

A: Make sure you installed the network adapter during install, make sure it installed properly and make sure your physical and virtual adapter are allowed to communicate.

Q: System error: Bootable media not found.


A: See screenshot below, you need to make sure Virtualbox is able to access the bootable media.

[Image: QoQAL.gif]

Sunday, 13 October 2013

Make your own Deface Page

Make your own Deface Page!
Today i will teach you guys the basics of making your very own deface pages.
It will teach you the basics to create your own unique defaces.


Preview:Click to Hide)
[Image: capturemnm.png]

Step #1:

The first step is to create the file structure that we are going to use. Now remember, this is proper HTML coding and should always be used, keeps it neat and proffesional.
This should be done in a text editor, like notepad or notepad++

[Image: capturepzz.png]


Code:
==================================================================
<HTML> </HTML> - Are the HTML tags that specify that its a valid html document.

==================================================================

Code:
==================================================================

<HEAD> </HEAD> - Specify the head of the document, where you do all the styling and declaring of div's,link's,etc

==================================================================

Code:

==================================================================
<TITLE> HACKED! </TITLE> - Specifies the title of the html page.

==================================================================
Code:

==================================================================
<BODY> </BODY> - the body tags hold the majority of the deface page code.



==================================================================

Step #2:

Create a header and some text under the header. This has to be done in the "<body>" tags! nowhere else.
[Image: capturegw.png]

==================================================================

Code:

<CENTER> </CENTER> - Aligns all content between the tags directly in the middle.

==================================================================
Code:

<H1> </H1> - Is the Biggest Header tag, there are many other types like h1,h2,h3
==================================================================
Code:
<PRE> </PRE> - These tags work in a way that places the content inbetween them exactly where they are.
As you can see, all the content that we want displayed on the deface page is within the <body> tags! This is very important!

==================================================================
Step #3:

The final step. Here is where we are going to style the the deface page to give it a unique feel and appearance.
[Image: capturexwp.png]

========================================================================

==================================================================
Code:

<style type="text/css">

h1 {
color: #ddd;
font-size: 60pt;
}
</style>

This is CSS (Cascading Style Sheets) it basically styles whatever is declared, which in this case is the content within the <h1> tags.
two changes have been made, we changed the color to #ddd and the font-size to 60pt.
If you want to add images/pictures to a deface page, this can be done easily with the <img> tags.
==================================================================
Code:

<img src="http://www.linktoimage.com/" alt="Picture">
And if you want to add a youtube video to your deface page, thats easy aswell!

==================================================================
Code:

<embedded src="http://www.youtube.com/v/VIDEOIDHERE&autoplay=1&replay=1" width="1px" height="1px">
==================================================================

Avast 8 License Key.

                                     Avast 8 License Valid Till 2038




          Nothing to say detail about Avast antivirus.this is one of the most popular antivirus.are you looking for Avast License Key Valid Until 2038download link? yes now i will give you Avast License Key Valid Until 2038

                   Avast Features : 

     >>Avast antivirus has Streaming and real time virus database updates.
>>It has Files reputation system Features.
>>AVAST has Management Portal System.
>>Avast contain Remote Assistance Tool.
>>Avast has Customizable installation.

     Avast License Key Valid until 2038       :  


W6754380R9978A0910-4TZ59467

Saturday, 12 October 2013

Android 4.4 KitKat detailed again in new Nexus 5


Android 4.4 KitKat detailed again in new Nexus 5 

photo leak

Purported photos of Google's next flagship Nexus phone crop up showing what looks like a final version of Android 4.4 KitKat.


(Credit: Tutto Android)


Ahead of the much-anticipated debut of Android 4.4 KitKat are even more shots of Google's next flagship Nexus phone and the OS update.
Italian tech site Tutto Android has an extensive gallery of the device with notes on what's new or different. That list includes tweaked voice activated search, a new camera shortcut from the lock screen, a different app drawer, and a camera that appears to use image stabilization.

photos come a week after an extensive leak from tech blog GadgetHelpLine, which posted a gallery of 4.4 shots showing new features like wireless display support, cellular phone plan settings, and new printing and payment options.
Google announced the name of its next Android OS update last month, surprising some by licensing the popular candy bar namesake from Nestle. It follows July's release of Android 4.3 Jelly Bean, which was introduced in late July alongside Google'sNexus 7 tablet.
Google's expected to take the full wraps off the OS update at an event this month.