Per-User Custom Rules Not Applied During New User Login, Run As, or Scheduled Task Execution
search cancel

Per-User Custom Rules Not Applied During New User Login, Run As, or Scheduled Task Execution

book

Article ID: 396614

calendar_today

Updated On:

Products

Carbon Black App Control

Issue/Introduction

Custom rule are not being applied as expected when set to per-user or groups.  

Indicators: 

  • The issue occurs during user login (e.g., startup scripts or initial session tasks).
  • The issue occurs when using the "Run As" command to execute a process.
  • The issue occurs during Scheduled Tasks executed under a specific user context.
  • Key Indicator: The same rule works correctly when the user scope is changed to "Any User".

Environment

  • Carbon Black Application Control Agent: 8.10.0 and Newer
  • Microsoft Windows: All Supported Versions

Cause

The 8.10.0 Agent by disables the stalling of file operations upon a new user SID session by default to improve performance in most environments. Some environments need to add back the stalling of operations to allow the custom rule to expand and match. 

Resolution

Warning: This config should only be applied to a specific agent or a specific policy. Enabling the config on all agents could result in severe performance issues.

 

Applying the Configuration:

  1. Log into the App Control Console and go to https://[ServerAddress]/agent_config.php
  2. Check for an existing config:
    • Click Show Filters > Value > contains > kernelExpandRulesTimeoutMs
    • If a config exists, click View Details (pencil icon) to update. 
    • If no result, click Add Agent Config. 
  3. Add/Update Configuration:
    • Property Name: Rule Expansion Timeout (or similar)
    • Host ID: [Target Agent ID or 0 for all]
    • Value: 
      kernelExpandRulesTimeoutMs=1000
    • Platform: Windows
    • Create For: <Relevant Policies>
  4. Save and verify the Agent shows as Connected and Up to Date in Assets > Computers before testing again.

Testing:

Determine the minimum kernelExpandRulesTimeoutMs required for the environment. 

  1. Start with 1000ms (1 second). If the block persists, increment the value (e.g., 2000ms) until the rule is working correctly. 
  2. Reduce by a few hundred, once a good value is found, adding a few hundred for a buffer is recommended. 

Tuning:

  1. If a higher value is needed and causing performance issues, consider tuning rules and reducing what needs to be expanded. Balancing Narrow Patterns and Rule Expansion
  2. Make sure AV exclusions are in place for App Control and other security software in use.

Additional Information

  • Adding additional per-user rules can cause this setting to extend. The more per-user or group rules, the more that needs to expand at a user login.
  • Rules set to "All Users" are pre-expanded.