问答
发起
提问
文章
攻防
活动
Toggle navigation
首页
(current)
问答
商城
实战攻防技术
漏洞分析与复现
NEW
活动
摸鱼办
搜索
登录
注册
某IP广播系统代码审计
漏洞分析
对某IP广播系统的一次代码审计
0x00 审计前的准备 =========== ```php 以下相关漏洞已全部提交cnvd ```  熟悉目录整体架构 php目录为 代码的功能实现 主要审计php目录 0x01 文件上传getshell ================= `uplaod/mt_parser.php` 漏洞关键位置代码  无任何过滤直接构造poc上传即可 ```html <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> <form action="http://127.0.0.1/upload/my_parser.php" enctype="multipart/form-data" method="post"> <input class="input_file" type="file" name="upload"/> <input class="button" type="submit" name="submit" value="upload"/> </form> </body> </html> ``` 漏洞证明截图  0x02 查看文件 ========= 开始审计php目录下的文件 发现均包含了`conversion.php`  进行查看 具体实现的功能 共写了八个方法,一个个看一下 1、`function arrayRecursive(&$array, $function, $apply_to_keys_also = false)`  大体实现了 第一个参数传`array` 第二个参数传`function` 分别对`array`的`value`进行`function`操作。 如果`apply_to_keys_also`为`true`还可以对传入的`array`进行改变`key`值 2、`function JSON($array, $want_url_encode = true)`  大体实现了 对传入的数组进行`json_encode` 然后`urldecode`操作(这里可能实现了中文字符的传入) 3、`function UdpSendJson($array, $msgType)`  大体实现了 一个传送JSON数据的功能 4、`function UdpSend($msg)`  大体实现了 对`8888`端口下的`AppWebService`的命令操作 具体干什么可能要看硬件设备了。 5、`function UdpSendAndRecvJson($array, $msgType)`  大体实现了 接收和发送JSON数据 6、`function UdpSendAndRecv($msg)`  大体实现了 发送和接收数据,对本地的`8888`端口发送一个`POST`请求 这里和`function UdpSend()`实现了一样的操作,只不过多加了一个Linux下的操作 7、`function phplog($data)`  大体实现了 写日志的功能 8、`function get_real_ip()`  大体实现了 通过`Client_ip`头获取了`ip` 接下来看php目录下文件实现的具体功能 0x03 任意文件上传 =========== php/addmediadata.php 漏洞关键位置代码  满足`$subpath`、`$fullpath`可以自定义目录,然后进行了一系列的检查如文件大小等 最后进入if条件中`move_upload_file`函数进行文件上传 构造poc  访问./upload/1/5.php成功访问  addmediadatapath.php存在相同问题 收获两枚通杀漏洞 `php/addscenedata.php` 漏洞关键位置代码  不多说了 自己看 构造poc  访问`./images/scene/5.php`  0x04 任意文件写入 =========== `$postData = $_POST['jsondata'];` 需要满足这个参数 看一下传参方式  然后满足`$caller`,`$callee`、`$imagename`、`$imagecontent`这三个参数不为空  满足`$imagename`用\_分割后等于三个  `$callee`参与了目录拼接 这里跨目录上传 (需要知道根目录才能解析成功)  只传入一串base64加密的内容 进入else条件   构造POC  成功上传  0x05 任意文件读取 =========== `php/exportrecord.php` 漏洞关键位置代码  获取了参数`downname` 需要下载的文件进行了`urldecode` 不用管 左思右想 想了半天也也不知道为什么要在37行加个basename 直接在`41`行 执行了`fread`操作  类似操作还有 `exprottts.php`  0x06 总结 ======= 此套代码几乎无过滤,这也是硬件设备的一个通病,很多厂商都以为不会"黑客"拿到源码。 还有很多漏洞 都是无过滤的 此处不一一写出来了
发表于 2022-05-10 09:44:04
阅读 ( 5898 )
分类:
漏洞分析
0 推荐
收藏
3 条评论
低级管理员
2022-05-10 10:45
还是要留点厂商线索,不然容易被骂
请先
登录
后评论
花北城
2022-05-11 11:39
下次一定
请先
登录
后评论
孤岛一L
2022-06-10 18:02
什么设备啊,想复现都找不到,透漏一点点也行啊
请先
登录
后评论
请先
登录
后评论
花北城
4 篇文章
×
发送私信
请先
登录
后发送私信
×
举报此文章
垃圾广告信息:
广告、推广、测试等内容
违规内容:
色情、暴力、血腥、敏感信息等内容
不友善内容:
人身攻击、挑衅辱骂、恶意行为
其他原因:
请补充说明
举报原因:
×
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!