..-------------------------------..
..    Again Wind0ws fucking?     ..
.._______________________________..


Content:
I- local buffer overflow in explorer.exe
|- intro
|- bug description
|- outro
II - Errors in utils "dir" and "del"
III Errors in file system organisation in NTFS (compressed volume) and
FAT32
IV -The End!?


|- Intro:

   Let's look upon a history in a few years ago, concretely in april,2000.
   In bugfuq was posted warning about new bug  in  explorer.exe.  When you
   trying to get access  to  file, extension  of which  has  more than 160
   chars len, occures a buffer overflow in explorer.exe.  Its not bad, but
   i.e. if some asshole upload  file  with  long extension  on ftp-server,
   runned under win98, he can shut it up.

   I  remember,  what after this advisory was posted a new  one, about dir
   errors. If  you create  many folders inside the one, effect will be the
   same,  as in  previous  bug.  All  known  holes  in  fs  was patched by
   m$-sexpertz.


|- Bug Description:

   A few weeks ago, i discovered  new ways, how to obtain a bof on attempt
   to  open  a  dir/shortcut/file  with  long  name.  I  wanna  go through
   insufficiencyes, what  was  created by  ms-programmers.  A lots of time
   later,  i found some ways.  It's not  so good and i don't discovered it
   completely (i just have t00 small time).

   All this trash was tested on WinXP [ENG] [Version 5.1.2600] without SP,
   Windows  XP [RU] [version 5.1.2600] + SP1, and on Win2k [ENG] + SP 1,2(
   well, it looks like it should work on win9x also).

   When  we  entering  on  any  lan  resource  (via netbios sure), i.e. on
   \\server\soft, explorer creates a "network shortcut", on openin which we
   getin access to needed files. I.e. if you type "explorer \\server\music"
   it will be  created a network shortcut to  this  resource and  explorer
   opens  it  (for  us  it  looks  like  we  reading  local  dir). Now for
   understanding bug we need another one server (i.e. in  your lan). There
   we should create a hiden folder (in this xmpl its xxx$).

   ---------------------------------------------------------
   ATTENTION!!! remote  machine must be  unix,  i.e.  linux
   whith samba ( cuz  if  server  runned  under win  nothin'
   happens )
   ---------------------------------------------------------

   Path  to this  test-folder looks like  "\\server\xxx$".  Now in cmd.exe
   type:

   explorer  \\Server\xxx$%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20
     %20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20

   Here  about 250 "%20" (~850 chars at all). Now press enter and explorer
   will show you an error box:
   ___________________________
   |Windows Explorer      _0X|
   |Can't access this folder |
   |Path is too long.        |
   |_________________________|


   Explorer  alerted  us, but  he tried to open  this dir!  Okay, now look
   here: "explorer \\server\".  In result we'll  see a new net folder, but
   its  just a  net shortcut,  which we  tried to open.  In its u can find
   some file like this: xxx$%20%20%20%20%20%20%20 (explorer don't shows
   a full  name).  Now  on  any  attemption to access this file,  explorer
   crashes  with  lots  of  errors.  Click  on  "Debug" button to get more
   ac1d infaz :) If on your box it doesn't work, you can watch xpl movie:
   http://sunlimited.ru/defaced/files/example.avi  [4.62 mb]


|- Outro

   - i don't find way, howto use this bug remotely.So, it's only for local
     "phun and profit".

   - this bug  is not critical, cuz it can be used only locally and _only_
     with some conditions.

   - "\\server\xxx$"  i  used  only  for example. Btw, you can enter _any_
     folder name, even if it's not exists.

   Cmd should be like this: "explorer \\server\[path]<850 symbolz>"

   - i dunno, why  bof occures  only when user  wanna get  access to  file
     with  long  name, why explorer not falls immediately on creating this
     file?  Also, i've not  discover, why this shit don't  works if remote
     machine with Win OS.

   - it's  easy  to  write local exploit, but why? imho its not needed for
     anybody.


II - Errors in utils "dir" and "del"

   I noticed  what almost all utils checks length of argz, passed by user.
   I.e. on  this cmd: "md f:\%20%20...%20<this continues about 270 times>"
   cmd.exe  shows  us  error "The full path of [folder name] is too long".
   But,  not all  utlis checks filename length. Cmdz "dir" and "del":

   dir \\Server\xxx$%20%20%20 [850 symbols]
   del \\Server\%20%20%20 [850 symbols]

   After  execution  this  cmdz, cmd.exe  falls  without any warning. It's
   not  a  potentially  hole,  but it's interesting why ms-coders remained
   bugs in this utilz. As known, any tiny on  first sign vulnerability may
   create  serious  security holes later... ;)


III - Errors  in  file system organisation in NTFS (compressed volume) and
      FAT32

   Errors  appears  when  we  trying  to  access a folder with name of any
   dos-devices:

   C:\>mkdir aux
   [incorrect folder name]

   But if we add slash after name it'll be ok:

   C:\>mkdir aux\

   Directory with name aux\ [really its "aux"] was created.But in explorer
   we  cant  do anything with this folder [rename, delete, etc].  The same
   things happens  if  creating folders wtih other dos devices:  con, prn,
   aux, com1, com2, com3, com4, nul, lpt1, lpt2, lpt3.

   Deletion of this folders is easy:

   C:\>rmdir aux\


IV - The End!?

   After "forced" microsoft  connection to  Open-Source community  lots of
   bugz like  discussed in this article  will be finded.  And maybe  after
   many  patchez  from  M$-programers win-systems become more stability :]
   Big part of bugz fixed, but it's always possible to find another way to
   obtain  needed  target. So,  it's  time  to  stop  this article and say
   "eof" ;)
