当前位置:网站首页>wuzhicms代码审计
wuzhicms代码审计
2022-07-04 15:39:00 【zkzq】
零基础学黑客,搜索公众号:白帽子左一
作者:掌控安全—柚子
环境搭建
源码下载官网:https://www.wuzhicms.com/
放到本地phpstudy根目录下,访问install路径进行安装。
访问后台:
访问前台:
敏感信息泄露
直接后台挂个链接:
代码分析
前台sql注入
漏洞分析
搜索select的时候 发现在mysql.class文件下有一个函数里面有select 并且后面的拼接也没有任何的过滤
搜索哪里调用了这个函数,先是在api目录下的sms_check文件中发现调用了get_one函数 并且参数是通过前面的$code拼接。
我们可以看到code 先是通过$GLOBALS来获取参数param的值 从前面的介绍可以知道 $GLOBALS是可以获取post get的值 这个文件前面没有定义param变量 那么 这个param应该就是post 或者get 就是我们可控的 这也是导致注入的点
code还通过strip_tags 函数 而这个函数的作用是剥去html标签,过滤xss。
之后就直接传入了函数 继续更进函数 因为这个文件前面还引入了db类。
可以看到这个get-one函数里面 还调用了一个array2sql函数来处理$where
那先来看看这个函数的作用。
可以看到这个函数是用来过滤的。如果是数组 这进入if 把括号 单引号这些过滤掉。
不是则走else 过滤 %20 %27。然后返回参数,但也就是这个过滤的地方 没有防护到位。我们传的参数不是数组 所以就没有走if,而else里面过滤的却是 %20 %27。
我们传参的时候尽管是经过url编码的 但是web服务器会自动解码一次 所以 我们传到后端代码处的时候是没有进行url编码。
但是二次编码的就不一样了 因为web服务器只解码一次,如果是二次编码这里的else过滤就起效果,return 调用的get_one 则是最开始看见的mysql.class文件里面了。
下面就可以开始直接构造payload了 这里通过代码分析可以看到是单引号闭合。
漏洞复现
payload:
sms_check.php?param=1%27+or%20extractvalue(1,concat(0x7e,(select%20database)))%23](http://192.168.1.7/wuzhicms/api/sms_check.php?param=1'+or extractvalue(1,concat(0x7e,(select database)))%23)
后台sql注入一
漏洞分析
在www\api\sms_check.php中:
传参param给$code,然后直接拼接到sql语句中,导致sqli:
漏洞复现
后台sql注入二
在eframe\app\promote\admin\index.php中:
获取$keywords直接拼接到sql语句中,导致sqli:
后台任意文件读取、删除
coreframe\app\attachment\admin\index.php中存在dir方法:
分析逻辑发现,将…/,./,.\,…\替换成空再添加/结尾,这里可以通过多写绕过:
同时发现读取到的文件是可以删除的,每个后面都有删除的链接。
找到del方法:
通过url获取路径后,检测了ATTACHMENT_URL参数,替换为空,
define(‘ATTACHMENT_URL’,‘http://www.wuzhicmstest.com/uploadfile/’);//附件路径
然后没有其他过滤,传入my_unlink:
达到删除的目的。
逻辑漏洞
在\api\uc.php中:
通过传参可以调用uc_note类的任意方法:
可以更改用户名和密码等。
后台RCE
漏洞分析
在coreframe\app\core\libs\function\common.func.php中set_cache方法:
写入内容没有过滤,再搜索哪里调用了set_cache:
member模型中存在调用。
发现直接获取setting写入缓存。
利用,写入phpinfo:
漏洞复现
后台访问
拓展
全局搜索发现,同样的利用还有很多:
边栏推荐
- 中银证券网上开户安全吗?
- To sort out messy header files, I use include what you use
- It's too convenient. You can complete the code release and approval by nailing it!
- [glide] cache implementation - memory and disk cache
- Solution of commercial supply chain coordination system in the mineral industry: build a digital intelligent supply chain platform to ensure the safe supply of mineral resources
- NFT liquidity market security issues occur frequently - Analysis of the black incident of NFT trading platform quixotic
- ble HCI 流控机制
- 被PMP考试“折磨”出来的考试心得,值得你一览
- 网页游戏引擎
- Maximum subarray and matrix multiplication
猜你喜欢
Capvision Rongying's prospectus in Hong Kong was "invalid": it was strictly questioned by the CSRC and required supplementary disclosure
Perfectly integrated into win11 style, Microsoft's new onedrive client is the first to see
【云原生】服务网格是什么“格”?
kaili不能输入中文怎么办???
Internet addiction changes brain structure: language function is affected, making people unable to speak neatly
智慧物流園區供應鏈管理系統解决方案:數智化供應鏈賦能物流運輸行業供應鏈新模式
Firewall basic transparent mode deployment and dual machine hot standby
Congratulations to Mr. Zhang Pengfei, chief data scientist of artefact, for winning the campaign Asia tech MVP 2022
Readis configuration and optimization of NoSQL (final chapter)
Learn more about the basic situation of 2022pmp examination
随机推荐
电子元器件B2B商城系统开发:赋能企业构建进销存标准化流程实例
detectron2安装方法
聊聊异步编程的 7 种实现方式
Unity interview questions (continuously updated)
Understand ThreadLocal in one picture
ECCV 2022 released: 1629 papers were selected, and the employment rate was less than 20%
防火墙基础透明模式部署和双机热备
TP configuring multiple databases
ble HCI 流控机制
The 18th IET AC / DC transmission International Conference (acdc2022) was successfully held online
智慧物流园区供应链管理系统解决方案:数智化供应链赋能物流运输行业供应链新模式
Years of training, towards Kata 3.0! Enter the safe container experience out of the box | dragon lizard Technology
【Unity UGUI】ScrollRect 动态缩放格子大小,自动定位到中间的格子
Median and order statistics
To sort out messy header files, I use include what you use
利用win10计划任务程序定时自动运行jar包
整理混乱的头文件,我用include what you use
世界环境日 | 周大福用心服务推动减碳环保
To sort out messy header files, I use include what you use
Web game engine