Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 05-22-2013, 05:30 PM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Server › Web Server v
« Previous 1 2 3 4 5 ... 8 Next »

Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser

Home General Computer Multimedia Business Lounge

Post Reply 
Tweet
Threaded Mode | Linear Mode
Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser
06-08-2012, 05:55 AM
Post: #1
K4pT3N Offline
./Devilz Officer
Posts: 155
Joined: May 2010
Reputation: 61
Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser
Ini sebenarnya cara yang gak ane rekomendasikan buat implementasi web server. Karena dengan meng-allow root command melalui browser, kemungkinan apache di exploitasi semakin besar. Tapi kebetulan karena penerapan ini lagi ane butuhkan buat local project jadinya ya sah-sah aja (ngeles), yah itung-itung berbagi informasi lah. heuheu...

Maksud judulnya gimana sih?

Jika kita pengen mengeksekusi salah satu command di linux melalui browser yang membutuhkan authentikasi root, misalnya perintah perl, maka coding yang kita gunakan adalah :
PHP Code:
<?php exec("perl file.pl"); ?>
tapi berhubung karena untuk mengeksekusi perintah perl kita membutuhkan authentikasi root, maka kita perlu menambahkan "sudo" diawal command. Berhubung dalam penerapan artikel ini, OS yang ane gunakan Debian yang versi net-install. Jadinya banyak command yang belum terinstall, termasuk sudo. Jadi, kita install dulu command "sudo"

Code:
apt-get install sudo

Mencari File Instalasi Command

Berikutnya, kita perlu mencari lokasi command-command yang kita ingin bisa kita akses melalui browser. (Kalo dalam windows, command-command ini seperti file *.exe nya gitu lah). Dalam kasus ini misalnya command "perl". Untuk mengetahui lokasi perl, gunakan perintah
Code:
whereis perl
dan hasilnya
Code:
perl: /usr/bin/perl /etc/perl /usr/lib/perl /usr/share/perl /usr/share/man/man1/perl.1.gz

Nah, kita udah dapet lokasi untuk execute command perl ada di /usr/bin/perl . Selain di direktori /usr/bin biasanya lokasi command-command di linux terdapat di /usr/sbin <--- Kalo di windows tuh kayak "C:\Program Files" gitulah :)

Berikutnya, kita akan mendaftarkan command-command yang ingin kita eksekusi dari browser di dalam konfigurasi file sudoers
Code:
nano /etc/sudoers

lalu tambahkan beberapa baris perintah berikut
# memberi alias untuk user/group Apache
User_Alias APACHE = www-data
# membuat command alias, dalam hal ini adalah perl
Cmnd_Alias PERL = /usr/bin/perl
# memberi authentikasi user/group APACHE tanpa authentikasi
APACHE ALL = (ALL)NOPASSWD:PERL

Yarp. lalu restart apache
Code:
/etc/init.d/apache2 restart

Done.
Sekarang kita sudah bisa mengeksekusi perintah perl melalui browser, misalnya buat sebuah file perl dan simpan dengan nama file.pl
Code:
#!/usr/bin/perl
exec("sudo chmod 755 file");

Last, didalam codingan kita sudah bisa mengeksekusi command perl untuk menjalankan file.pl

PHP Code:
<?php exec("sudo perl file.pl"); ?>

au ah, pada ngarti apa kagak. Pokoknya gitulah. jiahahaha <--- dasar gak bertanggung jawab.

Intinya untuk mencegah shell command melalui browser, ya jangan menerapkan artikel ini deh. #lah :P
Find all posts by this user
Quote this message in a reply
 Reputed by :  rusuh(+1) , tabun(+1) , ditatompel(+1) , whitecoinDC(+1)
06-08-2012, 06:06 AM (This post was last modified: 06-08-2012 06:12 AM by rusuh.)
Post: #2
rusuh Away
sepik'ers
**
Moderators
Posts: 455
Joined: Oct 2011
Reputation: 77
RE: Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser
jadi keinget rusuh ALL=(ALL) ALL suram
Visit this user's website Find all posts by this user
Quote this message in a reply
06-08-2012, 08:39 AM
Post: #3
tabun Offline
./Junk3r C4d3t
Posts: 1,773
Joined: Dec 2011
Reputation: 33
RE: Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser
try.. belajar
Find all posts by this user
Quote this message in a reply
06-08-2012, 07:45 PM
Post: #4
kiddies Away
Administrator
*******
Administrators
Posts: 1,224
Joined: Dec 2009
Reputation: 40
RE: Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser
sama kaya eval gak nih boss...waduh nih orang langsung kaboorr....tutornya oke...cipok dulu yah pake lipstik ijoo
Find all posts by this user
Quote this message in a reply
06-10-2012, 12:05 AM
Post: #5
whitecoinDC Offline
security dc :metal
**
Moderators
Posts: 732
Joined: Apr 2011
Reputation: 18
RE: Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser
wew mantab om yarp yarp senengseneng
Visit this user's website Find all posts by this user
Quote this message in a reply
06-23-2012, 05:00 PM
Post: #6
apeman Offline
./Devilz 1st Cadet
Posts: 7
Joined: Jun 2012
Reputation: 0
RE: Menjalankan Apache Sebagai Root Untuk Execute Command Melalui Browser
Wah, bahaya juga om kalo apache dijalanin sebagai root. Bisa jadi bancakan kalo ada webserver yang beneran kaya gitu.
Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  webserver kecil untuk experimen dengan server dan php natveris 8 175 05-01-2013 06:10 PM
Last Post: natveris
  1 ip publik untuk banyak server ceoode 8 231 04-14-2013 04:08 AM
Last Post: ceoode
  Mempercantik directory Listing pada Apache arietux 8 194 02-20-2013 01:05 PM
Last Post: Eyang Subur
Tongue [Tutor] Install CMS phpBB untuk Web Forum sandimulyadi 7 1,002 11-01-2012 09:06 PM
Last Post: â„¢NewOrder
Question [Ask] Spesifikasi server vps yang kuat untuk nginx+perl+redis+mongodb monyett 2 259 07-05-2012 12:59 AM
Last Post: monyett
  [Ask] VPS apache error mulu chibi 11 1,037 06-25-2012 04:50 AM
Last Post: jemblink21
  [Tutor] Cara mengaktifkan mod_rewrite apache di ubuntu xiphiet 11 937 06-10-2012 09:36 PM
Last Post: easy2study
  instalasi mod_qos 10.2 untuk server apache oye nan unyu2 ev1lut10n 9 558 02-27-2012 08:22 PM
Last Post: whitecoinDC
  [Tutor] Instalasi PHP, Apache, MySQL dan PhpMyAdmin di Arch Linux ditatompel 7 951 02-24-2012 06:43 PM
Last Post: cupu80
  [Tutor] Menjalankan Apache Appserv dan IIS (Internet Information Services) Secara Bersamaan c0d3HitLER 6 1,690 07-10-2011 09:05 AM
Last Post: qball006_error

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 05-22-2013, 05:30 PM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE