<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Cortex XDR Device Control Violation Query in Cortex XDR Discussions</title>
    <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1232018#M8450</link>
    <description>&lt;P data-start="144" data-end="157"&gt;Hi &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/928866483"&gt;@A.Elzedy&lt;/a&gt;,&lt;/P&gt;
&lt;P data-start="144" data-end="157"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="159" data-end="181"&gt;Thanks for this query.&lt;/P&gt;
&lt;P data-start="159" data-end="181"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="183" data-end="401"&gt;I’m seeing multiple results, but at the same time, I’m only seeing 18 results under the &lt;STRONG data-start="271" data-end="300"&gt;Device Control Violations&lt;/STRONG&gt; tab in the Cortex XDR management console. I’m expecting the same number of results in the XQL query.&lt;/P&gt;
&lt;P data-start="403" data-end="681"&gt;&lt;STRONG data-start="403" data-end="419"&gt;Please note:&lt;/STRONG&gt; Device Control policy is only enabled in block mode on 18 machines. The XDR agent has successfully prevented actions on these machines, and the violations are visible in the tab—18 results in total. Therefore, we expect the XQL query to return the same results.&lt;/P&gt;</description>
    <pubDate>Wed, 18 Jun 2025 09:49:15 GMT</pubDate>
    <dc:creator>Vinothkumar_SBA</dc:creator>
    <dc:date>2025-06-18T09:49:15Z</dc:date>
    <item>
      <title>Cortex XDR Device Control Violation Query</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1231081#M8381</link>
      <description>&lt;P&gt;Hi Team,&lt;/P&gt;
&lt;P&gt;How can I check device control violations using an XQL query? I have tried the query preset = device_controlbut I am only seeing details for USB device violations. I am expecting to see Bluetooth violations as well. Is this possible? If yes, please guide me.&lt;/P&gt;</description>
      <pubDate>Thu, 05 Jun 2025 12:35:01 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1231081#M8381</guid>
      <dc:creator>Vinothkumar_SBA</dc:creator>
      <dc:date>2025-06-05T12:35:01Z</dc:date>
    </item>
    <item>
      <title>Re: Cortex XDR Device Control Violation Query</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1231341#M8393</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/243138"&gt;@Vinothkumar_SBA&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for reaching out to us.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You may test with Bluetooth devices GUIDs (Globally Unique Identifiers) (action_device_class_guid) which are used to uniquely identify Bluetooth devices and are commonly used in Bluetooth device pairing and communication protocols or Vendor ID, Product ID and Serial using the field schema in the device control preset or xdr_data.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jun 2025 18:27:46 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1231341#M8393</guid>
      <dc:creator>nsinghvirk</dc:creator>
      <dc:date>2025-06-09T18:27:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cortex XDR Device Control Violation Query</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1231442#M8399</link>
      <description>&lt;P class="whitespace-normal break-words"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="whitespace-normal break-words"&gt;&lt;STRONG&gt;I agree with&amp;nbsp;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/256101"&gt;@nsinghvirk&lt;/a&gt;&amp;nbsp;'s recommendation.&lt;/STRONG&gt; The &lt;CODE class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]"&gt;preset = device_control&lt;/CODE&gt; has limited coverage and primarily captures USB mount/unmount events, which explains why &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/243138"&gt;@Vinothkumar_SBA&lt;/a&gt;&amp;nbsp; isn't seeing Bluetooth violations.&lt;/P&gt;
&lt;P class="whitespace-normal break-words"&gt;I've developed a query against &lt;CODE class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]"&gt;xdr_data&lt;/CODE&gt; that addresses some potential security violations. The query aggregates findings by violation type, making it easy to prioritize investigations and track device activity across your environment.&lt;/P&gt;
&lt;P class="whitespace-normal break-words"&gt;&lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/243138"&gt;@Vinothkumar_SBA&lt;/a&gt;&amp;nbsp;, this query should give you the Bluetooth violation visibility you're looking for, along with some enhanced USB device monitoring capabilities.&lt;/P&gt;
&lt;P class="whitespace-normal break-words"&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="python"&gt;dataset = xdr_data 
| filter _time &amp;gt; to_timestamp(subtract(to_epoch(current_time()), 604800), "SECONDS") //7 days

// Comprehensive device control event detection
| filter (
    // USB Device detection using actual USB fields
    action_device_usb_vendor_name != null or 
    action_device_usb_product_name != null or
    action_device_usb_vendor_id != null or
    
    // Bluetooth Registry Violations
    (event_type = 4 and event_sub_type = 4 and 
        action_registry_key_name contains "BTHLEDevice") or
    
    // Process events involving device drivers
    (event_type = 1 and action_process_image_name in (
        "pnputil.exe", "devcon.exe", "driverquery.exe"
    )) or
    
    // Registry events for device policies
    (event_type = 4 and action_registry_key_name contains "DeviceInstall")
)

// Device violation classification
| alter 
    violation_type = if(
        action_device_usb_vendor_name != null, "🔌 USB_DEVICE_CONNECTED",
        action_device_usb_vendor_id != null, "🔌 USB_DEVICE_DETECTED",
        action_registry_key_name contains "BTHLEDevice", "📱 BLUETOOTH_ACTIVITY",
        action_registry_key_name contains "DeviceInstall", "⚙️ DEVICE_POLICY_CHANGE",
        action_process_image_name in ("pnputil.exe", "devcon.exe"), "🔧 DEVICE_MANAGEMENT_TOOL",
        "🔍 OTHER_DEVICE_EVENT"
    ),
    
    risk_level = if(
        action_device_usb_vendor_name = null and action_device_usb_product_name = null and action_device_usb_vendor_id != null, "🔴 UNKNOWN_USB_DEVICE",
        actor_effective_username != "NT AUTHORITY\\SYSTEM" and action_registry_key_name contains "BTHLEDevice", "🟠 USER_BLUETOOTH_MODIFICATION",
        extract_time(_time, "HOUR") &amp;gt;= 18 or extract_time(_time, "HOUR") &amp;lt;= 6, "🟡 AFTER_HOURS_DEVICE_ACTIVITY",
        "✅ STANDARD_DEVICE_ACTIVITY"
    ),
    
    device_identifier = if(
        action_device_usb_serial_number != null, action_device_usb_serial_number,
        action_device_usb_vendor_name != null, concat(action_device_usb_vendor_name, " - ", action_device_usb_product_name),
        action_registry_key_name contains "BTHLEDevice", "BLUETOOTH_DEVICE",
        "UNKNOWN_DEVICE"
    ),
    
    user_context = coalesce(actor_effective_username, "SYSTEM"),
    timestamp = format_timestamp("%Y-%m-%d %H:%M:%S", _time)

// Aggregate violations by type and risk
| comp 
    count() as violation_events,
    count_distinct(agent_hostname) as affected_hosts,
    count_distinct(device_identifier) as unique_devices,
    count_distinct(user_context) as users_involved,
    earliest(_time) as first_violation,
    latest(_time) as last_violation,
    values(agent_hostname) as hostnames,
    values(device_identifier) as device_list,
    values(user_context) as user_accounts
    by violation_type, risk_level

| alter 
    violation_timeframe = concat(
        format_timestamp("%Y-%m-%d %H:%M", first_violation),
        " → ",
        format_timestamp("%Y-%m-%d %H:%M", last_violation)
    ),
    
    violation_summary = concat(
        to_string(violation_events), " events | ",
        to_string(affected_hosts), " hosts | ",
        to_string(unique_devices), " devices | ",
        to_string(users_involved), " users"
    )

| fields 
    violation_type,
    risk_level,
    violation_timeframe,
    violation_summary,
    violation_events,
    affected_hosts,
    unique_devices,
    hostnames,
    device_list,
    user_accounts

| sort desc violation_events&lt;/LI-CODE&gt;
&lt;P class="whitespace-normal break-words"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="whitespace-normal break-words"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="whitespace-normal break-words"&gt;&lt;STRONG&gt;Query features:&lt;/STRONG&gt;&lt;/P&gt;
&lt;UL class="[&amp;amp;:not(:last-child)_ul]:pb-1 [&amp;amp;:not(:last-child)_ol]:pb-1 list-disc space-y-1.5 pl-7"&gt;
&lt;LI class="whitespace-normal break-words"&gt;Capture Bluetooth activity through registry modifications (&lt;CODE class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]"&gt;action_registry_key_name contains "BTHLEDevice"&lt;/CODE&gt;)&lt;/LI&gt;
&lt;LI class="whitespace-normal break-words"&gt;Detect unknown USB devices using vendor/product fields&lt;/LI&gt;
&lt;LI class="whitespace-normal break-words"&gt;Monitor device management tool usage (&lt;CODE class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]"&gt;pnputil.exe&lt;/CODE&gt;, &lt;CODE class="bg-text-200/5 border border-0.5 border-border-300 text-danger-000 whitespace-pre-wrap rounded-[0.4rem] px-1 py-px text-[0.9rem]"&gt;devcon.exe&lt;/CODE&gt;) to&amp;nbsp;&lt;EM&gt;catch bypass attempts&lt;/EM&gt;&lt;/LI&gt;
&lt;LI class="whitespace-normal break-words"&gt;Track policy modifications and after-hours device activity&lt;/LI&gt;
&lt;/UL&gt;
&lt;P class="whitespace-normal break-words"&gt;Feel free to integrate more features, tune it, or tailor it more for your needs.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jun 2025 15:49:09 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1231442#M8399</guid>
      <dc:creator>A.Elzedy</dc:creator>
      <dc:date>2025-06-10T15:49:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cortex XDR Device Control Violation Query</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1232018#M8450</link>
      <description>&lt;P data-start="144" data-end="157"&gt;Hi &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/928866483"&gt;@A.Elzedy&lt;/a&gt;,&lt;/P&gt;
&lt;P data-start="144" data-end="157"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="159" data-end="181"&gt;Thanks for this query.&lt;/P&gt;
&lt;P data-start="159" data-end="181"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="183" data-end="401"&gt;I’m seeing multiple results, but at the same time, I’m only seeing 18 results under the &lt;STRONG data-start="271" data-end="300"&gt;Device Control Violations&lt;/STRONG&gt; tab in the Cortex XDR management console. I’m expecting the same number of results in the XQL query.&lt;/P&gt;
&lt;P data-start="403" data-end="681"&gt;&lt;STRONG data-start="403" data-end="419"&gt;Please note:&lt;/STRONG&gt; Device Control policy is only enabled in block mode on 18 machines. The XDR agent has successfully prevented actions on these machines, and the violations are visible in the tab—18 results in total. Therefore, we expect the XQL query to return the same results.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 09:49:15 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1232018#M8450</guid>
      <dc:creator>Vinothkumar_SBA</dc:creator>
      <dc:date>2025-06-18T09:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cortex XDR Device Control Violation Query</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1232046#M8453</link>
      <description>&lt;P&gt;Thank you &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/243138"&gt;@Vinothkumar_SBA&lt;/a&gt;, would you please share the configuration details of your policy?&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jun 2025 14:51:53 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1232046#M8453</guid>
      <dc:creator>A.Elzedy</dc:creator>
      <dc:date>2025-06-18T14:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Cortex XDR Device Control Violation Query</title>
      <link>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1232091#M8455</link>
      <description>&lt;P data-start="157" data-end="170"&gt;Hi &lt;a href="https://live.paloaltonetworks.com/t5/user/viewprofilepage/user-id/928866483"&gt;@A.Elzedy&lt;/a&gt;,&lt;/P&gt;
&lt;P data-start="157" data-end="170"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P data-start="172" data-end="428"&gt;We have configured a specific user group to block access to disk drives, CD-ROM drives, Windows portable devices, floppy disk drives, and Bluetooth devices—while still allowing print jobs—through the Cortex XDR Device Control Policy configuration profiles.&lt;/P&gt;
&lt;P data-start="430" data-end="622"&gt;At the same time, for another set of endpoint groups, we blocked disk drives, CD-ROM drives, Windows portable devices, and floppy disk drives, but allowed access to Bluetooth and printer jobs.&lt;/P&gt;
&lt;P data-start="624" data-end="888"&gt;The policies were successfully configured. When a user tries to access USB or Bluetooth devices, the XDR agent successfully blocks the attempt. These violations are being recorded and displayed in the &lt;STRONG data-start="825" data-end="853"&gt;Device Control Violation&lt;/STRONG&gt; tab in the XDR Management Console.&lt;/P&gt;
&lt;P data-start="890" data-end="1164"&gt;We expect to see the same results reflected in the XQL queries, as we are using them to generate daily report templates. These reports are meant to show whether any user has violated the XDR Device Control Policy—meaning if they attempted to access USB or Bluetooth devices.&lt;/P&gt;
&lt;HR data-start="1166" data-end="1169" /&gt;</description>
      <pubDate>Thu, 19 Jun 2025 05:03:14 GMT</pubDate>
      <guid>https://live.paloaltonetworks.com/t5/cortex-xdr-discussions/cortex-xdr-device-control-violation-query/m-p/1232091#M8455</guid>
      <dc:creator>Vinothkumar_SBA</dc:creator>
      <dc:date>2025-06-19T05:03:14Z</dc:date>
    </item>
  </channel>
</rss>

