<!--
MARDUK  /  SYSMON DYNAMIX

       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,,,,,,,,,,,,.     ,,,,,,,,,,,,,,,,,,,,,,
       ,,,,,,,,,,,..,,,,,,,,,.     ,,,,,,,,,,.,,,,,,,,,,,
       ,,,,,,,,,,,    ..,,,,,.     ,,,,,..    ,,,,,,,,,,,
       ,,,,,,,,,,,        ..,.    .,..        ,,,,,,,,,,,

Detection attribution and licensing are documented in THIRD_PARTY_NOTICES.md.
MITRE ATT&amp;CK mapping: © 2026 The MITRE Corporation. This work is reproduced
and distributed with the permission of The MITRE Corporation.
-->
<Sysmon schemaversion="4.90">
  <EventFiltering>
    <RuleGroup name="" groupRelation="or">
      <ProcessCreate onmatch="include">
        <!-- This rule covers EventID=1 (ProcessCreate) where python.exe runs an install command.
             The correlation with a .pth FileCreate (EventID=11) is enforced in Splunk via stats/dc_event_id>1;
             Sysmon surfaces each event individually, so both halves are included here to feed that correlation. -->
        <Rule name="Python PTH File Creation During Package Installation" groupRelation="and">
          <Image name="technique_id=T1546,technique_name=Event Triggered Execution" condition="image">python.exe</Image>
          <CommandLine name="technique_id=T1546,technique_name=Event Triggered Execution" condition="contains"> install </CommandLine>
        </Rule>
        <Rule name="Python PTH File Creation During Package Installation" groupRelation="and">
          <OriginalFileName name="technique_id=T1546,technique_name=Event Triggered Execution" condition="is">python.exe</OriginalFileName>
          <CommandLine name="technique_id=T1546,technique_name=Event Triggered Execution" condition="contains"> install </CommandLine>
        </Rule>
      </ProcessCreate>
      <FileCreate onmatch="include">
        <!-- This rule covers EventID=11 (FileCreate) for .pth files created during package installation.
             The process_name="python.exe" filter from the SPL is expressed via the Image condition here. -->
        <Rule name="Python PTH File Creation During Package Installation" groupRelation="and">
          <Image name="technique_id=T1546,technique_name=Event Triggered Execution" condition="image">python.exe</Image>
          <TargetFilename name="technique_id=T1546,technique_name=Event Triggered Execution" condition="end with">.pth</TargetFilename>
        </Rule>
        <Rule name="Python PTH File Creation During Package Installation" groupRelation="and">
          <!-- OriginalFileName is not available in FileCreate events; Image is the correct field here.
               A second rule with OriginalFileName is not applicable for FileCreate event type. -->
          <Image name="technique_id=T1546,technique_name=Event Triggered Execution" condition="image">python.exe</Image>
          <TargetFilename name="technique_id=T1546,technique_name=Event Triggered Execution" condition="contains">site-packages</TargetFilename>
          <TargetFilename name="technique_id=T1546,technique_name=Event Triggered Execution" condition="end with">.pth</TargetFilename>
        </Rule>
      </FileCreate>
    </RuleGroup>
  </EventFiltering>
</Sysmon>