首页 > 其他分享 >Symbolic pg walkthrough Intermediate window 利用302进行文件csrf

Symbolic pg walkthrough Intermediate window 利用302进行文件csrf

时间:2025-01-15 15:56:21浏览次数:7  
标签:读取 Windows 302 Symbolic rsa 192.168 walkthrough ssh id

nmap
nmap -p- -A -sS -T4 192.168.239.177
Starting Nmap 7.95 ( https://nmap.org ) at 2025-01-15 03:39 UTC
Nmap scan report for 192.168.239.177
Host is up (0.071s latency).
Not shown: 65533 filtered tcp ports (no-response)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH for_Windows_7.7 (protocol 2.0)
| ssh-hostkey: 
|   2048 3e:40:e2:ef:21:ea:c1:77:b6:14:a3:f7:04:59:45:28 (RSA)
|   256 f8:fb:e3:c6:16:3a:e2:62:d0:e2:ae:d4:f2:9e:6f:6d (ECDSA)
|_  256 94:5e:97:ad:f9:0f:81:b6:6b:3b:bd:98:43:c0:0d:6a (ED25519)
80/tcp open  http    Apache httpd 2.4.48 ((Win64) OpenSSL/1.1.1k PHP/8.0.7)
|_http-title: WebPage to PDF
| http-methods: 
|_  Potentially risky methods: TRACE
|_http-server-header: Apache/2.4.48 (Win64) OpenSSL/1.1.1k PHP/8.0.7
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running (JUST GUESSING): Microsoft Windows 2019|10 (92%)
OS CPE: cpe:/o:microsoft:windows_server_2019 cpe:/o:microsoft:windows_10
Aggressive OS guesses: Windows Server 2019 (92%), Microsoft Windows 10 1903 - 21H1 (85%), Microsoft Windows 10 1607 (85%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 4 hops

TRACEROUTE (using port 22/tcp)
HOP RTT      ADDRESS
1   70.41 ms 192.168.45.1
2   70.39 ms 192.168.45.254
3   72.03 ms 192.168.251.1
4   72.05 ms 192.168.239.177

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 108.27 seconds

只有80 和 22 那么突破口就是80了 这个网站是用来将web界面转化成pdf的

发现存在命令执行漏洞
image
但是发现除了curl好像其他执行不了
转化完pdf后自动跳转到生成的pdf文件那里

然后发现有个pdfs目录

里面有个私钥
image
那么我要要找用户是啥
image
在首页有这么一句话 那么猜测用户是p4yl0ad

果不其然ssh登录成功
image
ok

我认为下面这个方法才是正常的解法 上面那个方法应该是出题人忘记删了id_rsa 的pdf

这题还有另一种做法就是利用302跳转 做任意文件读取漏洞
image
我让他去读取我这个hearder的php文件他会跳转到etc/hosts 的文件夹 进行 文件读取

我们尝试一下这个方法
发现成功了!!!
image

然后利用这个方法读取用户的id_rsa
可以看到 这样也是成功的读取到了 用户的ssh 秘钥
image

进入提权环节
我信息收集了半天
发现有个 backup目录
同时backup目录下面有一个脚本
脚本的内容是循化备份
image
当我看到这个内容的时候第一个想到的就是环境变量劫持 或者直接写入提权命令 在这个脚本里面 提权 因为 linux靶机就经常出这种
但是我发现这两个方案好像不太行
然后就无从下手了
不知道要怎么提权了

然后我又发现在历史命令里面有一个比较有意思的命令
image
CreateSymlink.exe "C:\xampp\htdocs\logs\request.log" "C:\Users\Administrator\.ssh\id_rsa" 这个命令的意思类似于linux 的ln
就是将C:\xampp\htdocs\logs\request.log" 链接到 "C:\Users\Administrator.ssh\id_rsa

那如果这个能执行成功的话
那我们的备份文件将会看到Administrator 的ssh 私钥了

我们找找这个文件在哪里
找不到
直接下载一个
wget https://github.com/googleprojectzero/symboliclink-testing-tools/releases/download/v1.0/Release.7z
7za e Release.7z

然后上传到靶机上

然后执行.\CreateSymlink.exe "C:\xampp\htdocs\logs\request.log" "C:\Users\Administrator\.ssh\id_rsa"等待定时任务触发 应该就能够读取到ssh 的私钥了 但是 他靶场应该出了点问题导致 我执行的时候报错
image

靶场出问题了,思路懂了就行

标签:读取,Windows,302,Symbolic,rsa,192.168,walkthrough,ssh,id
From: https://www.cnblogs.com/wssw/p/18673211

相关文章