← Back to SOC feed Coverage →

Linux Base64 Encoded Shebang In CLI

sigma MEDIUM SigmaHQ
T1140
imProcessCreate
This rule was pulled from an open-source repository and enriched with AI. Validate in a test environment before deploying to production.
View original rule at SigmaHQ →
Retrieved: 2026-03-25T02:50:08Z · Confidence: medium

Hunt Hypothesis

Adversaries may encode malicious payloads using base64 in CLI commands to evade simple string-based detection mechanisms. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential execution of hidden malicious code before it is decoded and executed.

Detection Rule

Sigma (Original)

title: Linux Base64 Encoded Shebang In CLI
id: fe2f9663-41cb-47e2-b954-8a228f3b9dff
status: test
description: Detects the presence of a base64 version of the shebang in the commandline, which could indicate a malicious payload about to be decoded
references:
    - https://www.trendmicro.com/pl_pl/research/20/i/the-evolution-of-malicious-shell-scripts.html
    - https://github.com/carlospolop/PEASS-ng/tree/master/linPEAS
author: Nasreddine Bencherchali (Nextron Systems)
date: 2022-09-15
tags:
    - attack.defense-evasion
    - attack.t1140
logsource:
    product: linux
    category: process_creation
detection:
    selection:
        CommandLine|contains:
            - "IyEvYmluL2Jhc2" # Note: #!/bin/bash"
            - "IyEvYmluL2Rhc2" # Note: #!/bin/dash"
            - "IyEvYmluL3pza" # Note: #!/bin/zsh"
            - "IyEvYmluL2Zpc2" # Note: #!/bin/fish
            - "IyEvYmluL3No" # Note: # !/bin/sh"
    condition: selection
falsepositives:
    - Legitimate administration activities
level: medium

KQL (Azure Sentinel)

imProcessCreate
| where TargetProcessCommandLine contains "IyEvYmluL2Jhc2" or TargetProcessCommandLine contains "IyEvYmluL2Rhc2" or TargetProcessCommandLine contains "IyEvYmluL3pza" or TargetProcessCommandLine contains "IyEvYmluL2Zpc2" or TargetProcessCommandLine contains "IyEvYmluL3No"

False Positive Guidance

MITRE ATT&CK Context

Original source: https://github.com/SigmaHQ/sigma/blob/master/rules/linux/process_creation/proc_creation_lnx_base64_shebang_cli.yml