Unusual Base64 Encoding/Decoding Activity | Elastic Security [8.19] | Elastic

Unusual Base64 Encoding/Decoding Activity

edit

IMPORTANT: This documentation is no longer updated. Refer to Elastic's version policy and the latest documentation.

Unusual Base64 Encoding/Decoding Activity

This rule leverages ESQL to detect unusual base64 encoding/decoding activity on Linux systems. Attackers may use base64 encoding/decoding to obfuscate data, such as command and control traffic or payloads, to evade detection by host- or network-based security controls. ESQL rules have limited fields available in its alert documents. Make sure to review the original documents to aid in the investigation of this alert.

Rule type: esql

Rule indices: None

Severity: low

Risk score: 21

Runs every: 1h

Searches indices from: now-61m ( Date Math format, see also [Additional look-back time](/content/guide/en/security/8.19/rules-ui-create.html#rule-schedule "Set the rule’s schedule"/index.html))

Maximum alerts per execution: 100

References: None

Tags:

Version: 12

Rule authors:

Rule license: Elastic License v2

Investigation guide

Triage and analysis

Disclaimer: This investigation guide was created using generative AI technology and has been reviewed to improve its accuracy and relevance. While every effort has been made to ensure its quality, we recommend validating the content and adapting it to suit your specific environment and operational needs.

Investigating Unusual Base64 Encoding/Decoding Activity

Base64 encoding is a method to convert binary data into ASCII text, often used for data transmission. Adversaries exploit this to obfuscate malicious payloads or commands, bypassing security controls. The detection rule identifies suspicious Base64 activity on Linux by monitoring specific processes and command patterns, flagging anomalies for further investigation.

Possible investigation steps

False positive analysis

Response and remediation

Setup

Setup

This rule requires data coming in from one of the following integrations: - Elastic Defend

Elastic Defend Integration Setup

Elastic Defend is integrated into the Elastic Agent using Fleet. Upon configuration, the integration allows the Elastic Agent to monitor events on your host and send data to the Elastic Security app.

Prerequisite Requirements:

The following steps should be executed in order to add the Elastic Defend integration on a Linux System:

Rule query

from logs-endpoint.events.process-* metadata _id, _index, _version
| mv_expand event.action
| where
    host.os.type == "linux" and
    event.type == "start" and
    event.action == "exec" and (
        (
            process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16") and
            process.command_line like "*-*d*"
        ) or
        (
            process.name == "openssl" and
            process.args == "enc" and
            process.args in ("-d", "-base64", "-a")
        ) or
        (
            process.name like "python*" and (
                (
                    process.args == "base64" and
                    process.args in ("-d", "-u", "-t")
                ) or
                (
                    process.args == "-c" and
                    process.command_line like "*base64*" and
                    process.command_line like "*b64decode*"
                )
            )
        ) or
        (
            process.name like "perl*" and
            process.command_line like "*decode_base64*"
        ) or
        (
            process.name like "ruby*" and
            process.args == "-e" and
            process.command_line like "*Base64.decode64*"
        )
    )
| keep
    @timestamp,
    _id,
    _index,
    _version,
    host.os.type,
    event.type,
    event.action,
    process.name,
    process.args,
    process.command_line,
    process.parent.name,
    process.parent.command_line,
    agent.id,
    host.name,
    data_stream.dataset,
    data_stream.namespace
| stats
    Esql.event_count = count(),
    Esql.process_parent_name_values = values(process.parent.name),
    Esql.process_parent_command_line_values = values(process.parent.command_line),
    Esql.agent_id_count_distinct = count_distinct(agent.id),
    Esql.host_name_values = values(host.name),
    Esql.agent_id_values = values(agent.id),
    Esql.data_stream_dataset_values = values(data_stream.dataset),
    Esql.data_stream_namespace_values = values(data_stream.namespace)
    by process.name, process.command_line
| where
    Esql.agent_id_count_distinct == 1 and
    Esql.event_count < 15
| sort Esql.event_count asc

// Extract unique values to ECS fields for alerts exclusion
| eval agent.id = mv_min(Esql.agent_id_values),
       host.name = mv_min(Esql.host_name_values)

| keep agent.id, host.name, process.name, process.command_line, Esql.*

Framework: MITRE ATT&CKTM

« Unusual AWS S3 Object Encryption with SSE-CUnusual Child Execution via Web Server »

On this page

Most Popular

Video

Get Started with Elasticsearch

Video

Intro to Kibana

Video

ELK for Logs & Metrics

Was this helpful?Feedback

LikeDislike

Thank you for your feedback.

a18132920325.cdn.optimizely.com

a18132920325.cdn.optimizely.com is blocked

This page has been blocked by an extension

ERR_BLOCKED_BY_CLIENT

Reload

This page has been blocked by an extension