Mailing List Archive

Windows Registry Access
OK, I have been asked to write a scan that, with proper credentials,
can determine if the Windows XP Pro SP2 personal firewall is enabled
or not. It sounds pretty simple. Check access, check the Windows
version, check for the Service (SharedAccess) and then check a single
registry entry (SYSTEM\CurrentControlSet\Services\SharedAccess
\Parameters\FirewallPolicy\StandardProfile\EnableFirewall). If it is
a 1, it is enabled, otherwise it is a 0 and not enabled (as far as I
can tell).

I already enabled remote administration and allowing for local users
to log in.

So if the user I am using to log in with is not an Admin I always get
0. If I use an Admin account I get, nothing for that reg item. I
can connect from another windows box with regedit and the same
account and browse to the reg entry, but I can't seem to get it with
nessus.

My google-foo is failing me. Any ideas? I seem to remember reading
of restricted registry access, but everything I can find about using
winreg and the local security policy editor seem to not have any
effect on me getting a return for the key I want.

Thanks

Here is the basic (stripped down) idea of what I am trying.

key = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\";
item = "CurrentVersion";
ver = string(registry_get_sz(key:key, item:item));
# if it is XP
if (ver == '5.1') {
# if the service is running
if("SharedAccess" >< services ) {
key = "SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters
\FirewallPolicy\StandardProfile\";
item = "EnableFirewall";
enabled = string(registry_get_sz(key:key, item:item));
# if the firewall is enabled
if (int(enabled) != 1) {
# report not enabled
}
} else {
# report service not running
}
}
Re: Windows Registry Access [ In reply to ]
On Wed, May 18, 2005 at 02:25:26PM -0500, MadHat wrote:


> (SYSTEM\CurrentControlSet\Services\SharedAccess
> \Parameters\FirewallPolicy\StandardProfile\EnableFirewall)
> If it is a 1, it is enabled, otherwise it is a 0 and
> not enabled (as far as I can tell).
...
> key =
> "SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters
> \FirewallPolicy\StandardProfile\";
> item = "EnableFirewall";
> enabled = string(registry_get_sz(key:key, item:item))
> ;

You might double-check this, but I believe the value is a
DWORD (32-bit number) rather than an SZ (string). If so,
you'll want to use registry_get_dword() instead of
registry_get_sz() above.

George

--
theall@tenablesecurity.com
Re: Windows Registry Access [ In reply to ]
On May 21, 2005, at 12:23 PM, George A. Theall wrote:
> On Wed, May 18, 2005 at 02:25:26PM -0500, MadHat wrote:
>> (SYSTEM\CurrentControlSet\Services\SharedAccess
>> \Parameters\FirewallPolicy\StandardProfile\EnableFirewall)
>> If it is a 1, it is enabled, otherwise it is a 0 and
>> not enabled (as far as I can tell).
>>
> ...
>
>> key =
>> "SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters
>> \FirewallPolicy\StandardProfile\";
>> item = "EnableFirewall";
>> enabled = string(registry_get_sz(key:key, item:item))
>> ;
>>
>
> You might double-check this, but I believe the value is a
> DWORD (32-bit number) rather than an SZ (string). If so,
> you'll want to use registry_get_dword() instead of
> registry_get_sz() above.

Thanks. I feel stupid. Trying to do too many thing at once and too
much copy and paste.

I'll go back into my hole now.
RE: Windows Registry Access [ In reply to ]
Then again, if you can access it, then the firewall isn't enabled anyway
;-)
Re: Windows Registry Access [ In reply to ]
On May 21, 2005, at 4:34 PM, Michael Scheidell wrote:
> Then again, if you can access it, then the firewall isn't enabled
> anyway
> ;-)

Well, you have to have remote admin enabled from a specific IP or
subnet, which opens the usual ports. ;^)
There are some little details. Those usually trip me up.

Thanks again.