当前位置: 首页 > ds >正文

RPCRT4!NdrConformantStructUnmarshall函数分析

RPCRT4!NdrConformantStructUnmarshall函数分析
第一部分:
0: kd> g
Breakpoint 5 hit
RPCRT4!NdrConformantStructUnmarshall:
001b:77c44859 55              push    ebp
0: kd> kc
 #
00 RPCRT4!NdrConformantStructUnmarshall
01 RPCRT4!NdrpPointerUnmarshall
02 RPCRT4!NdrpEmbeddedPointerUnmarshall
03 RPCRT4!NdrSimpleStructUnmarshall
04 RPCRT4!NdrpUnionUnmarshall
05 RPCRT4!NdrNonEncapsulatedUnionUnmarshall
06 RPCRT4!NdrpPointerUnmarshall
07 RPCRT4!NdrPointerUnmarshall
08 RPCRT4!NdrpPointerUnmarshall
09 RPCRT4!NdrPointerUnmarshall
0a RPCRT4!NdrpClientUnMarshal
0b RPCRT4!NdrClientCall2
0c ADVAPI32!LsarQueryInformationPolicy
0d ADVAPI32!LsaQueryInformationPolicy
0e services!ScGetAccountDomainInfo
0f services!ScInitServiceAccount
10 services!SvcctrlMain
11 services!main
12 services!mainCRTStartup
13 kernel32!BaseProcessStart
0: kd> dv
         pStubMsg = 0x0006fae0
         ppMemory = 0x00096490
          pFormat = 0x77d752d2 "???"
       fMustAlloc = 0x01 ''
       StructSize = 0x77d752d2
fIsEmbeddedStruct = 0x00 ''
  pCorrMemorySave = 0x77d75440 "???"

0: kd> db 0x77d752d2
77d752d2  17 03 08 00 f0 ff 02 02-4c 00 e0 ff 5c 5b 1b 00  ........L...\[..


/* 328 */    
            0x17,        /* FC_CSTRUCT */
            0x3,        /* 3 */
/* 330 */    NdrFcShort( 0x8 ),    /* 8 */
/* 332 */    NdrFcShort( 0xfff0 ),    /* Offset= -16 (316) */
/* 334 */    0x2,        /* FC_CHAR */                    /* 334 */    0x2,        /* FC_CHAR */    不是 FC_PP
            0x2,        /* FC_CHAR */
/* 336 */    0x4c,        /* FC_EMBEDDED_COMPLEX */
            0x0,        /* 0 */
/* 338 */    NdrFcShort( 0xffe0 ),    /* Offset= -32 (306) */
/* 340 */    0x5c,        /* FC_PAD */
            0x5b,        /* FC_END */

0: kd> dd 0x00096490
00096490  000964d8

0: kd> dd 0x96488
00096488  00000000 000964b8 00000000 00000000
00096498  00000000 00000000 00000000 00000000
000964a8  00000000 00000000 00000000 00000000
000964b8  0054004e 00450044 002d0056 00510051
000964c8  00510054 004e0053 0044004c 00000058
000964d8  00000000 00000000 00000000 00000000
000964e8  00000000 00000000 00000000 00000000

    // Pointer section delimiter.
    FC_PP,                      // 0x4b


第二部分:

    // Add the size of the conformant array to the structure size.
    // check for possible mulitplication overflow attack here.
    StructSize += MultiplyWithOverflowCheck( (ulong)pStubMsg->MaxCount, *((ushort *)(pFormatArray + 2) ) );

    // Check the size and the buffer limit.


0: kd> dv
         pStubMsg = 0x0006fae0
         ppMemory = 0x00096490
          pFormat = 0x00000018 "--- memory read error at address 0x00000018 ---"
       fMustAlloc = 0x01 ''
       StructSize = 0x18        //正确:

0: kd> dt _sid
services!_SID
   +0x000 Revision         : UChar
   +0x001 SubAuthorityCount : UChar
   +0x002 IdentifierAuthority : _SID_IDENTIFIER_AUTHORITY
   +0x008 SubAuthority     : [1] Uint4B


第三部分:
    // Initialize the memory pointer if needed.
    if ( fMustAlloc )
        {
        *ppMemory = (uchar *) NdrAllocate( pStubMsg, StructSize );
        }

0: kd> dd 00096490
00096490  000964d8

0: kd> dd 000964d8
000964d8  00000000 00000000 00000000 00000000
000964e8  00000000 00000000 00000000 00000000
000964f8  00000000 000964f0 00096488 000964fc

第四部分:

    // Unmarshall embedded pointers before copying the struct.
    if ( *pFormat == FC_PP )                        没有运行/* 334 */    0x2,        /* FC_CHAR */
        {
        //
        // Set BufferMark to the beginning of the structure in the buffer.
        //
        pStubMsg->BufferMark = pBufferStart;

        NdrpEmbeddedPointerUnmarshall( pStubMsg,
                                       *ppMemory,
                                       pFormat,
                                       fMustAlloc );
        }


0: kd> db 77d752d8
77d752d8  02 02 4c 00 e0 ff 5c 5b-1b 00 01 00 00 59 00 00  ..L...\[.....Y..
77d752e8  00 00 02 5b 17 01 04 00-f0 ff 02 02 06 5b 16 03  ...[.........[..

    // Copy the struct if we're not using the rpc buffer.
    if ( *ppMemory != pBufferStart )
        {
        RpcpMemoryCopy( *ppMemory,
                        pBufferStart,
                        StructSize );
        }

0: kd> dd 000964d8
000964d8  00000401 05000000 00000015 256b2e0b
000964e8  81fdfed5 f7a65f2b

0: kd> dd 00096488
00096488  00000000 000964b8 000964d8 00000000
00096498  00000000 00000000 00000000 00000000
000964a8  00000000 00000000 00000000 00000000
000964b8  0054004e 00450044 002d0056 00510051
000964c8  00510054 004e0053 0044004c 00000058
000964d8  00000401 05000000 00000015 256b2e0b
000964e8  81fdfed5 f7a65f2b

http://www.xdnf.cn/news/2210.html

相关文章:

  • 模拟地与数字地单点接地的原理
  • 深度解析APPSCAN漏洞扫描:从入门到实战的全流程指南
  • 如何使用URDF搭建双臂UR移动机器人,并在RViz中可视化
  • c++11 :智能指针
  • QCustomPlot QCPItemText文字框可拖动
  • 关于vant4的showImagePreview在使用时可能出现布局显示不正常、缩放后拖动失效问题的粗暴解决方案
  • Jetbrains和Webstorm中设置自定义指令右键快捷键(自定义外部工具)
  • 检测特权访问活动:一个新的 Kibana 集成
  • [C]基础13.深入理解指针(5)
  • C++学习-入门到精通-【1】C++编程入门,输入/输出和运算符
  • Windows 10 系统关机后立即重启
  • 利用TTP协议 ETag + 路由守卫 实现前端发版后通知用户更新得一个方案
  • 过去 vs 现在:创业门槛的颠覆性变化
  • 系统架构师2025年论文《论软件架构评估2》
  • 什么是CN2专线?全面解析中国电信的高性能网络服务
  • 中国头部云服务商分析
  • SQL问题分析与诊断(8)——分析方法3
  • 【Deepseek学习大模型推理】MOONCAKE: A KVCache-centric Architecture实验部分(下)
  • 前端如何获取样式图里面的标准颜色RGB
  • 11.AOP开发
  • 【C语言】全局变量、静态本地变量
  • 百度文心4.5 Turbo与DeepSeek、豆包、元宝对比:技术路径与市场格局分析​​
  • 华为Pura X的智控键:让折叠机体验更上一层楼的设计
  • 服务器集群都有哪些优势?
  • 可编辑120页PPT | 数字化转型数据治理解决方案
  • Kubernetes 节点 Not Ready 时 Pod 驱逐机制深度解析(下)
  • 【网络】MQTT协议
  • Spring-Ai-McpSever从外到内
  • 深入 Vue 核心:通信、生命周期与 API 的全面解析
  • 如何通过电路测量运放的增益带宽积(GBP)和压摆率(SR)