Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove use of unnecessary inferior functions #1

Merged
merged 1 commit into from
Aug 2, 2020
Merged

Remove use of unnecessary inferior functions #1

merged 1 commit into from
Aug 2, 2020

Conversation

am0nsec
Copy link
Contributor

@am0nsec am0nsec commented Aug 1, 2020

The current implementation of SharpAppLocker is using inferior functions from the following Assembly Types:

  • AppLockerPolicy; and
  • PolicyManager

The use of theses Assembly Type will load into the default application domain the following Assemblies:

  • Microsoft.Security.ApplicationId.PolicyManagement.PolicyEngineApi.Interop;
  • Microsoft.Security.ApplicationId.PolicyManagement.PolicyManager;
  • Microsoft.Security.ApplicationId.PolicyManagement.PolicyModel; and
  • Microsoft.Security.ApplicationId.PolicyManagement.XmlHelper

In terms of operational security, there is no need to load and use theses Assemblies when they are only wrappers around the IAppIdPolicyHandler COM interface. My PR aim to use the IAppIdPolicyHandler directly in order to avoid unnecessary Assembly to be loaded.

As show below, this is the Assembly loaded by SharpAppLocker
image-20200801203448401

Below the list of Assemblies loaded with my PR:
image-20200801224459045

The Get-AppLockerPolicy PowerShell Cmdlet is nothing more than a wrapper around the aforementioned COM interface. The definition of the interface can be easily found by reverse engineering the following two .NET Framework Assemblies:

  • Microsoft.Security.ApplicationId.PolicyManagement.PolicyManager; and
  • Microsoft.Security.ApplicationId.PolicyManagement.PolicyModel

Please note that for the moment the output of the application will be a bit different due to the methods from the COM interface return (in a BSTR varaible) the policies in an XML format.

Example with XML output of local AppLocker policies. In this case this is just the default policies.
image-20200801220710828

Another example with JSON output of effective AppLocker policies.
image-20200801220849969

@Flangvik
Copy link
Owner

Flangvik commented Aug 2, 2020

Appreciate the time and effort into this, great stuff! 🔥

@Flangvik Flangvik merged commit 2084bec into Flangvik:master Aug 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants