Schneider电工IGS数据服务器(IGSSdataServer.exe)中可容发现多重漏洞
1)Opcode1(LOG)附加
IGSSdataServer请求包限制为0x1000字节带Opcode1消息可长0x1000字节并需要多次发送将第二个请求附加到现有消息数据时,IGSSDataServer.exe可错误计算缓冲位置存储接收请求,导致远程写攻击者控制数据
ocode1消息有以下格式:
lidist hdr {li16ReqSize/总req大小包括此字段le16unkle16unkle32编码le32unkle32Final/请求消息中最终片段}!structOpcode_1_req/h.opcode必须是1le16n/0xC字节项数FILETIMEftimeFiletimeftime2字节项目#0xC/0xC字节项目};
非认证远程攻击者可用大Opcode_1_req.nsdataServer.exe不检查收到请求中确实有项目字段数据项
接收第一个请求片段后, IGSSDataServer.exe使用从线上接收请求包大小标记当前消息大小,但也标注信息目前拥有数据nemits(攻击者指定的任意值)端端结果显示当前消息大小可大大小于项目字段表示的数量
第二次请求抵达后,服务器重定位消息缓冲存储请求中接收项目计算存储请求中项目所需的空间并添加到当前消息大小
IGSSDAServer.exev15.0.022082 <.snips.>.text:004A69A9 moveeax.text:004A69AC movzxex空间存储.text:004A69B0m4A69B6eaxmsg规模.text:004A69BF movex.text:004A69C2edxmsg缓冲区.text:004A69D2推eax.text:004A69D3调用ds
服务器后复制项目二请求当前扩展消息缓冲区,位置由Opcode_1_req.n项字段第一个请求确定使用此字段计算消息缓冲区内偏移值, 第一个请求中的项目将结束
IGSSDAServer.exev15.0.022082 <.snips.>.text:004A6A02 mvzxe攻击者控件->OB写.text:004A6A06imuledx,ecx,0Ch.text:004A6A09leaeax0C字节项目.text:004A6A0D推送ax.text:004A6A0E调用mcpy <.snip
字段可由攻击者任意大数并发Memcpy写址可能导致外写攻击者控制数据
概念证明
python3 igss_dataserver_appendRequest_oob_write.py -t
P12401-O1尝试用Ocode1连接0001:项目req=0002,实际项目=0001回溯:文件/Work/0day/gs_dataserver_appendrequest_ob_write.pi
s.connect((目标,端口))ConnectRefedError:[Errno111]Connect拒绝
由POC引起的堆化腐化
0:008> g Critical error detected c0000374 (27b0.8ec): Break instruction exception - code 80000003 (first chance) eax=00000000 ebx=054197d8 ecx=c0000374 edx=0092f541 esi=00000002 edi=00660000 eip=773c6ca2 esp=0092f6b0 ebp=0092f73c iopl=0 nv up ei pl zr na pe nc cs=0023 ss=002b ds=002b es=002b fs=0053 gs=002b efl=00000246 ntdll!RtlReportCriticalFailure+0x4b: 773c6ca2 cc int 3 0:008> kb # ChildEBP RetAddr Args to Child 00 0092f73c 773cfda4 00000001 77403990 773cdc99 ntdll!RtlReportCriticalFailure+0x4b 01 0092f748 773cdc99 ded7cede 00660000 0541a7e8 ntdll!RtlpReportHeapFailure+0x2f 02 0092f778 773d6110 00000003 00660000 0541a7e8 ntdll!RtlpHpHeapHandleError+0x89 03 0092f790 7732436f 0541a7e8 00000000 00000000 ntdll!RtlpLogHeapFailure+0x43 04 0092f8f8 773678fd 054197d8 054197e0 054197e0 ntdll!RtlpFreeHeap+0x70f 05 0092f954 77323c06 00000000 00000000 00000000 ntdll!RtlpFreeHeapInternal+0x783 06 0092f970 75373c9b 00660000 00000000 054197e0 ntdll!RtlFreeHeap+0x46 07 0092f984 75373c68 054197e0 00000000 0092f9b4 ucrtbase!_free_base+0x1b 08 0092f994 005cbf75 054197e0 90206481 04915f38 ucrtbase!free+0x18 WARNING: Stack unwind information not available.后台框架可能出错 。09099f90699909fffe092f9IGSDSSDServer+0x9f750a092f9c005697b092f6b09
+0x3f 10 0092fad8 77347a7e 053cdb887c292000KERNEL32
2) Opcode2(BCL)附加
外写时用2代码附加请求时也发生 obcode2
IGSSDAServer.exev15.0.022082 <.snips.>.text.0049E132mvzxe攻击者控件->OB写.text.0049E136imuledxH'.text.0049E139leaeax0x48字节项目.text:0049E13D推送ax.text:0049E13E调用mcpy <.snip
3)Opcode5(ONL)附加请求出境写作
外写时用Opcode5附加请求时也会出现
IGSSDAServer.exe v15.0.022082 <.snips.>.text:004A7602 mvzxe攻击者控件->OB写.text:004A7606leaedx8字节项目.text:004A760A推送edx.text:004A760B调用mcpy <.snip
4) Opcode 6
外写时用Opcode 6附加请求时也会出现 obcode 6
IGSSDAServer.exev15.0.022082 <.snips.>.text:004A34B6 mvzxe攻击者控件->OB写.text:004A34BAimuledxh'.text:004A34BDleaeax0x48字节项目.text:004A34C1推送eax无效*.text:004A34C2调用mcpy <.snip
5)Opcode9
外写时用Occode9附加请求:
IGSSDAServer.exev15.0.022082 <.snips.>.text.0049C292mvzxe攻击者控件->OB写.text.0049C296leaedx8字节项目.text.0049C29A推送edx无效*.text.0049C29B调用mcpy <.snip
6)Opcode16/20
外写时用代码16或20附加请求
IGSSdataServer.exev15.0.022082 <.snips.>.text:004A83C2mvzxe攻击者控件->OB写.text:004A83C6imuledx,ecx14h.text:004A83C9leaeax0x14字节项目.text:004A83CD推送eax无效*.text:004A83CE调用mcpy <.snip
7)Opcode18
外写时用Opcode18附加请求
IGSSdataServer.exev15.0.022082 <.snips.>.text.0049CB26 mvzxe攻击者控件->OB写.text.0049CB2Aleaedx4字节项目.text.0049CB2E推送edx无效*.text.0049CB2F调用mcpy <.snip