Configuration structure of access rules

The configuration structure of access rules contains definitions of securable objects in XML format. Structure elements are non-mandatory and all are using their default values when not specified explicitly.

The XML configuration structure contains a root <SelfDefense> element that contains several child elements. Each of the child elements corresponds to a particular type of securable objects and contains values for each the specific setting.

The following table lists settings that configure access rules for Self Defense.

Access rules for Secure Defense

Element

Description

<SelfDefense>

Start-tag for SelfDefense root element.

<ResourceList>

Start-tag for ResourceList element that nests types of securable objects.

<FilePath mask=""/>

File element specifies file system objects to be protected by Self Defense.

Supported type: file.

The following attributes are available for the element:

  • mask

    A path to the file.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

<Folder path="" protectParent ="1|0" protectChildren = "1|0">

Folder element specifies file system objects to be protected by Self Defense.

Supported type: folder.

The following attributes are available for the element:

  • path

    A full path to the folder.

  • protectParent

    Turns on inheritance to enable protection of parent folders for the specified folder path.

  • protectChildren

    Turns on recursion to propagate protection to nested objects underneath the specified folder path.

<RegistryKey rootType="LocalMachine|AnyUser|AnyControlSet" keyMask=""/>

RegistryKey element specifies registry objects to be protected by Self Defense.

Supported type: registry key.

The following attributes are available for the element:

  • rootType

    A handle of the root registry key.

    Possible values:

    LocalMachine—HKEY_LOCAL_MACHINE

    AnyUser—HKEY_USERS and HKEY_CURRENT_USER

    AnyControlSet—HKEY_LOCAL_MACHINE\SYSTEM\*ControlSet*

  • keyMask

    A registry key container under the specified root.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

<RegistryValue rootType="LocalMachine|AnyUser|AnyControlSet" keyMask="" valueMask="" valueDataMask=""

/>

RegistryValue element specifies registry value or key to be protected by Self Defense.

Supported type: registry value.

The following attributes are available for the element:

  • rootType

    A handle of the root registry key.

    Possible values:

    LocalMachine—HKEY_LOCAL_MACHINE

    AnyUser—HKEY_USERS and HKEY_CURRENT_USER

    AnyControlSet—HKEY_LOCAL_MACHINE\SYSTEM\*ControlSet*

  • keyMask

    A registry key container under the specified root.

    When running 32-bit processes in a 64-bit environment, do not forget to add rules for Wow6432Node.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

  • valueMask

    A name of the value stored in the specified registry key.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

  • valueDataMask

    Value data stored in the specified registry key.

    Specify the value of valueDataMask inside the quotes to protect only the data of the value set in valueMask. It will be possible to delete and rename the value itself.

    The following setting does not allow changing %ProgramFiles%, but allows the value ProgramFilesPath itself to be renamed or deleted:

    <RegistryValue rootType="LocalMachine" keyMask="SOFTWARE\Microsoft\Windows\CurrentVersion" valueMask="ProgramFilesPath" valueDataMask="%ProgramFiles%"

    />

    The following setting does not allow changing Path value data, but one could delete the value or change its name:

    <RegistryValue rootType="LocalMachine" keyMask="*" valueMask="Path" valueDataMask="*"/>

    To fully protect the registry value specified in the valueMask option and restrict deletion or renaming the value while allowing changes to its data, do not add anything between the quotes.

    The following setting protects ProgramFilesPath value and its data:

    <RegistryValue rootType="LocalMachine" keyMask="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion" valueMask="ProgramFilesPath" valueDataMask=""

    />

    With the following setting one would not be able to rename Path, change its data or delete the value:

    <RegistryValue rootType="LocalMachine" keyMask="*" valueMask="Path" valueDataMask=""/>

    Only string data types are supported: REG_SZ, REG_MULTI_SZ, REG_EXPAND_SZ.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

<Executable filePath="" invisibility="1|0"/>

Executable element specifies file system objects to be protected by Self Defense.

Supported type: executable file.

The following attributes are available for the element:

  • filePath

    A full path to an executable file. Expansions, substitutions, aliases or file links are not allowed. Folders are not supported.

  • invisibility

    Visibility for the process created by operating system when the file at filePath executes.

    Possible values:

    true (or 1), process must be not visible and is not monitored by Self Defense.

    false (or 0), process is visible and is monitored by Self Defense.

<RegistryKeyExclusion rootType="LocalMachine|AnyUser|AnyControlSet" keyMask=""/>

RegistryKeyExclusion element specifies registry objects to be excluded from protection by Self Defense.

Supported type: registry key.

The following attributes are available for the element:

  • rootType

    A handle of the root registry key.

    Possible values:

    LocalMachine—HKEY_LOCAL_MACHINE

    AnyUser—HKEY_USERS and HKEY_CURRENT_USER

    AnyControlSet—HKEY_LOCAL_MACHINE\SYSTEM\*ControlSet*

  • keyMask

    A registry key container under the specified root.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

<RegistryKeyValueExclusion rootType="LocalMachine|AnyUser|AnyControlSet" keyMask="" valueMask="" />

RegistryValueExclusion element specifies registry objects to be excluded from protection by Self Defense.

Supported type: registry value.

The following attributes are available for the element:

  • rootType

    A handle of the root registry key.

    Possible values:

    LocalMachine—HKEY_LOCAL_MACHINE

    AnyUser—HKEY_USERS and HKEY_CURRENT_USER

    AnyControlSet—HKEY_LOCAL_MACHINE\SYSTEM\*ControlSet*

  • keyMask

    A registry key container under the specified root.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

  • valueMask

    A value stored in the specified registry key.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

<FilePathExclusion mask=""/>

FileExclusion element specifies file system objects to be protected by Self Defense.

Supported type: file.

The following attributes are available for the element:

  • mask

    A path to the file or folder.

    Supported substitutions: * (asterisk) and ? (question mark) wildcards.

    You can add to exclusions for:

  • folder and its nested folders and files

    Use the filter with the * (asterisk) wildcard at the end of the specified path, for example: C:\example\*

  • folder only

    Use the filter without wildcards: C:\example

    If the filename or path contains spaces, enclose the filename and path in quotes.

</ResourceList>

End-tag for ResourceList element.

</SelfDefense>

End-tag for SelfDefense root element.

Limitations

Environment variables are not supported in the folder path. Please always specify expanded paths when configuring access rules.

Incorrect configuration:

<FilePathExclusion mask=""%programfiles%\*""/>

Correct configuration:

<FilePathExclusion mask=""C:\Program Files\*""/>

Sample configuration

A sample configuration that you may pass in the argument of kaveSelfDefenseSetConfig is listed below.

Example:

<SelfDefense>

<ResourceList>

<FilePath mask="" />

<Folder path="" protectParent="1|0" protectChildren="1|0" />

<RegistryKey rootType="LocalMachine|AnyUser|AnyControlSet" keyMask="" />

<RegistryValue rootType="LocalMachine|AnyUser|AnyControlSet" keyMask="" valueMask="" valueDataMask="" />

<Executable filePath="" invisibility="1|0" />

<RegistryKeyExclusion rootType="LocalMachine|AnyUser|AnyControlSet" keyMask="" />

<RegistryKeyValueExclusion rootType="LocalMachine|AnyUser|AnyControlSet" keyMask="" valueMask="" />

<FilePathExclusion mask="" />

</ResourceList>

</SelfDefense>

Page top