邪恶八进制信息安全团队技术讨论组's Archiver

sunwear 2005-11-19 14:04

[转载]MS05-010许可证记录服务漏洞允许执行代码的分析

信息来源:whitecell
文章作者:Polymorphours
-----------------------------------------
Author:  Polymorphours
Email:  [email]Polymorphours@whitecell.org[/email]
Homepage:[url]http://www.whitecell.org[/url]
Date:   2005-11-18


关于MS05-010: 许可证记录服务漏洞允许执行代码的分析

漏洞类型:静态数据区溢出漏洞
分析时间:2005-02-18

llssrv服务是用于许可登陆服务,该漏洞存在于llssrv这个服务中,经过分析发现
当服务器从LlsrLicenseRequestW收到数据后,会将第2个参数LPWSTR ProductID直
接传递给DispatchRequestLicense函数,该函数调用ServiceListAdd函数来添加一
个列表,在将生成的列表接点显示到屏幕上时,产生了溢出。

溢出发生在RegistryDisplayNameGet函数中

text:01006B5B Type        = dword ptr -8
.text:01006B5B hKey        = dword ptr -4
.text:01006B5B arg_0        = dword ptr  8
.text:01006B5B cbData       = dword ptr  0Ch
.text:01006B5B arg_8        = dword ptr  10h
.text:01006B5B
.text:01006B5B            push   ebp
.text:01006B5C            mov    ebp, esp
.text:01006B5E            push   ecx
.text:01006B5F            push   ecx
.text:01006B60            push   ebx
.text:01006B61            mov    ebx, ds:lstrcpyW
.text:01006B67            and    [ebp+hKey], 0
.text:01006B6B            push   esi
.text:01006B6C            push   edi
.text:01006B6D            mov    edi, offset unk_0_101EA78  <- 一块在BSS区域的内存
.text:01006B72            push   [ebp+cbData]   ; lpString2
.text:01006B75            push   edi         ; lpString1
.text:01006B76            call   ebx ; lstrcpyW  <- 直接将第2个参数的中的数据完全拷贝到了这块BSS中
.text:01006B78            mov    esi, offset unk_0_101D868
.text:01006B7D            push   offset dword_0_1001D2C ; lpString2
.text:01006B82            push   esi         ; lpString1
.text:01006B83            call   ebx ; lstrcpyW
.text:01006B85            push   [ebp+arg_0]    ; lpString2
.text:01006B88            push   esi         ; lpString1
.text:01006B89            call   ds:lstrcatW


下面来对照一下NT4的原代码

VOID
RegistryDisplayNameGet(
  LPTSTR ServiceName,
  LPTSTR DefaultName,
  LPTSTR *pDisplayName
  )

/*++

Routine Description:


Arguments:

  Service Name -

Return Value:

  None.

--*/

{
  HKEY              hKey2 = NULL;
  DWORD             dwType, dwSize;
  static TCHAR        RegKeyText[512];        //这里只分配了512字节的空间
  static TCHAR        DisplayName[512];
  LONG              Status;

#if DBG
  if (TraceFlags & TRACE_FUNCTION_TRACE)
    dprintf(TEXT("LLS TRACE: RegistryDisplayNameGet\n"));
#endif

  lstrcpy(DisplayName, DefaultName);
  lstrcpy(RegKeyText, TEXT("System\\CurrentControlSet\\Services\\LicenseInfo\\"));
  lstrcat(RegKeyText, ServiceName);
     。。。。。。。。。
}

结果很明显,从RegistryDisplayNameGet函数传下来的参数会直接拷贝到BSS中,
造成在BSS中覆盖任意内存但是该漏洞利用有一个条件,win2ksp4+windows20003
默认是不允许匿名访问系统命名管道llsrpc的,但是根据资料显示,从CD安装的
SP4默认允许改管道匿名连接,并且该漏洞存在于NT4中。



Whitecell Security Systems,一个非营利性民间技术组织,致力于各种系统安全技术的研究。坚持传统的hacker精神,追求技术的精纯。
Whitecell Website:[url]http://www.whitecell.org/[/url]
Whitecell Forum:[url]http://www.whitecell.org/forum/[/url]

页: [1]
© 1999-2008 EvilOctal Security Team