The detection rule identifies potential use of a 256-bit key ChaCha stream cipher constant, which may indicate the presence of encrypted data or communication that could be part of adversarial activity. SOC teams should proactively hunt for this behavior in Azure Sentinel to identify potential data exfiltration or encrypted command and control channels that may evade traditional detection methods.
YARA Rule
rule Chacha_256_constant {
meta:
author = "spelissier"
description = "Look for 256-bit key Chacha stream cipher constant"
date = "2019-12"
reference = "https://tools.ietf.org/html/rfc8439#page-8"
strings:
$c0 = "expand 32-byte k"
$split1 = "expand 3"
$split2 = "2-byte k"
condition:
$c0 or ( $split1 and $split2 )
}
This YARA rule can be deployed in the following contexts:
This rule contains 3 string patterns in its detection logic.
Scenario: Use of Chacha20 in secure communication tools like WireGuard or OpenVPN
Filter/Exclusion: Exclude processes related to wireguard or openvpn using the process.name field.
Example filter: process.name != "wireguard" AND process.name != "openvpn"
Scenario: Scheduled job running Ansible or SaltStack that uses encrypted data transfer
Filter/Exclusion: Exclude processes associated with Ansible or SaltStack by checking the process.name or process.args for keywords like ansible or salt.
Example filter: `process.name != “ansible” AND process.name != “salt”
Scenario: Logrotate or rsyslog using encrypted log transport
Filter/Exclusion: Exclude processes related to log management by checking the process.name or process.args for logrotate, rsyslog, or syslog-ng.
Example filter: process.name != "logrotate" AND process.name != "rsyslog" AND process.name != "syslog-ng"
Scenario: Vault or HashiCorp tools using encrypted secrets in transit
Filter/Exclusion: Exclude processes related to HashiCorp tools by checking the process.name or process.args for vault, terraform, or consul.
Example filter: process.name != "vault" AND process.name != "terraform" AND process.name != "consul"
Scenario: Database encryption using Chacha20 in PostgreSQL or MongoDB
Filter/Exclusion: Exclude database processes by checking the process.name for postgres, mongod, or mysql, and filter out known database encryption activities.
Example filter: `process.name !=