Custom byte-level encoding routine run inline against file data
Matches a shell one-liner that combines a bitwise byte operation with reading or writing file contents — the hand-rolled XOR or stream-cipher routine AN1213 describes as producing archive-like output with no standard archiving utility involved. Archiving utilities and their verbs are absent from the logic because that is T1560.001, and so are the .NET compression and cryptography stream classes, because library-backed archiving is T1560.002; what is left is the raw arithmetic that makes a method custom, which is what this sub-technique is about. The brief maps Security EventID 4688 onto the Sysmon-shaped `process_creation` category, and this rule is written in the Sysmon EventID 1 vocabulary (`Image`, `CommandLine`): the 4688 feed carries the same data under `NewProcessName` and needs a field mapping first, as well as both Audit Process Creation and the separate Include command line in process creation events policy, neither of which is enabled by default or by the CIS baseline. Only inline routines are visible here — a `-EncodedCommand` blob or a routine living in a .ps1 file puts none of these strings on the command line — and the interpreter list is confined to PowerShell because the operators matched are PowerShell syntax, so listing wscript or cscript would add selectors that can never fire. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0438, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full descriptionShow less
The detection
The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.
detection.yml
title: Custom byte-level encoding routine run inline against file dataid: ac389ad6-e0b0-4634-8aa3-c9bf5d2cd6d4status: experimentaldescription: | Matches a shell one-liner that combines a bitwise byte operation with reading or writing file contents — the hand-rolled XOR or stream-cipher routine AN1213 describes as producing archive-like output with no standard archiving utility involved. Archiving utilities and their verbs are absent from the logic because that is T1560.001, and so are the .NET compression and cryptography stream classes, because library-backed archiving is T1560.002; what is left is the raw arithmetic that makes a method custom, which is what this sub-technique is about. The brief maps Security EventID 4688 onto the Sysmon-shaped `process_creation` category, and this rule is written in the Sysmon EventID 1 vocabulary (`Image`, `CommandLine`): the 4688 feed carries the same data under `NewProcessName` and needs a field mapping first, as well as both Audit Process Creation and the separate Include command line in process creation events policy, neither of which is enabled by default or by the CIS baseline. Only inline routines are visible here — a `-EncodedCommand` blob or a routine living in a .ps1 file puts none of these strings on the command line — and the interpreter list is confined to PowerShell because the operators matched are PowerShell syntax, so listing wscript or cscript would add selectors that can never fire. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0438, not hand-written and not tested by its author. Any lab result is on this rule's own page.references: - https://attack.mitre.org/techniques/T1560/003 - https://attack.mitre.org/detectionstrategies/DET0438author: Siemphony pipeline (machine-derived from MITRE ATT&CK v19.2)date: 2026-08-16tags: - attack.collection - attack.t1560.003logsource: category: process_creation product: windowsdetection: selection_shell: Image|endswith: - '\powershell.exe' - '\pwsh.exe' selection_bitwise: CommandLine|contains: - '-bxor' - '-bnot' - '-band' - '-shl' - '-shr' selection_file_io: CommandLine|contains: - 'ReadAllBytes' - 'WriteAllBytes' - 'FileStream' - 'OpenRead' - 'OpenWrite' - 'Get-Content' - 'Set-Content' - '-AsByteStream' - '-Encoding Byte' condition: selection_shell and selection_bitwise and selection_file_iofalsepositives: - "In-house automation that folds bytes while converting a file — checksum and CRC helpers, binary patching, licence and header manipulation — which reads with ReadAllBytes or Get-Content and applies -bxor or -band before writing the result back. This is the most common way the rule fires and nothing in the event separates it from staging for exfiltration." - "Vendor installers, endpoint agent modules and deployment scripts that unpack an embedded, XOR-obfuscated payload to disk during setup; the routine is byte-identical to the malicious one and repeats on every host in a rollout wave." - "Telemetry and log converters that read a binary file as a byte stream and mask off flag bits before writing a normalised copy, typically running on a schedule from the same few servers." - "Malware analysis, detection engineering and training workstations, where operators run byte-manipulation one-liners against sample files as routine daily work."level: mediumSentinel · KQL
Run this as a search.
DeviceProcessEvents| where (((FolderPath endswith "\\powershell.exe" or FolderPath endswith "\\pwsh.exe") and (ProcessCommandLine contains "-bxor" or ProcessCommandLine contains "-bnot" or ProcessCommandLine contains "-band" or ProcessCommandLine contains "-shl" or ProcessCommandLine contains "-shr")) and (ProcessCommandLine contains "ReadAllBytes" or ProcessCommandLine contains "WriteAllBytes" or ProcessCommandLine contains "FileStream" or ProcessCommandLine contains "OpenRead" or ProcessCommandLine contains "OpenWrite" or ProcessCommandLine contains "Get-Content" or ProcessCommandLine contains "Set-Content" or ProcessCommandLine contains "-AsByteStream" or ProcessCommandLine contains "-Encoding Byte"))
Splunk · SPL
Run this as a search.
index=* (((Image="*\\powershell.exe" OR Image="*\\pwsh.exe") AND (CommandLine="*-bxor*" OR CommandLine="*-bnot*" OR CommandLine="*-band*" OR CommandLine="*-shl*" OR CommandLine="*-shr*")) AND (CommandLine="*ReadAllBytes*" OR CommandLine="*WriteAllBytes*" OR CommandLine="*FileStream*" OR CommandLine="*OpenRead*" OR CommandLine="*OpenWrite*" OR CommandLine="*Get-Content*" OR CommandLine="*Set-Content*" OR CommandLine="*-AsByteStream*" OR CommandLine="*-Encoding Byte*"))Elastic · ES|QL
Run this as a search.
FROM logs-*| WHERE (((TO_LOWER(process.executable) LIKE "*\\\\powershell.exe" OR TO_LOWER(process.executable) LIKE "*\\\\pwsh.exe") AND (TO_LOWER(process.command_line) LIKE "*-bxor*" OR TO_LOWER(process.command_line) LIKE "*-bnot*" OR TO_LOWER(process.command_line) LIKE "*-band*" OR TO_LOWER(process.command_line) LIKE "*-shl*" OR TO_LOWER(process.command_line) LIKE "*-shr*")) AND (TO_LOWER(process.command_line) LIKE "*readallbytes*" OR TO_LOWER(process.command_line) LIKE "*writeallbytes*" OR TO_LOWER(process.command_line) LIKE "*filestream*" OR TO_LOWER(process.command_line) LIKE "*openread*" OR TO_LOWER(process.command_line) LIKE "*openwrite*" OR TO_LOWER(process.command_line) LIKE "*get-content*" OR TO_LOWER(process.command_line) LIKE "*set-content*" OR TO_LOWER(process.command_line) LIKE "*-asbytestream*" OR TO_LOWER(process.command_line) LIKE "*-encoding byte*"))
Wazuh · XML rule
Deploy to your manager — this is a rule, not a search.
<group name="sigma,windows,process_creation,"> <!-- Rule ids must be unique on your manager; 100000+ is the user range. --> <rule id="100000" level="7"> <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. --> <field name="Image" type="pcre2">(?i)(\\powershell\.exe$|\\pwsh\.exe$)</field> <field name="CommandLine" type="pcre2">(?i)(-bxor|-bnot|-band|-shl|-shr)</field> <field name="CommandLine" type="pcre2">(?i)(ReadAllBytes|WriteAllBytes|FileStream|OpenRead|OpenWrite|Get-Content|Set-Content|-AsByteStream|-Encoding Byte)</field> <description>Custom byte-level encoding routine run inline against file data</description> <mitre> <id>T1560.003</id> </mitre> </rule></group>
Verdicts · reactions · comments
Community
Verdicts from engineers who actually deployed it, and the conversation around it.
Nobody has run this in a real environment and said what happened.
Verdicts from engineers who deployed it
0 castNo verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.
Log in to report a verdict.
Log in to join the discussion.
No comments yet. Someone who deploys this will have something to say about it.