Skip to content

[Rule Tuning] Basenc tool support in base64/base32/base16 related rules #7203

Open

Description

@FilipPwn

Link to Rules

https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_base16_or_base32_encoding_or_decoding_activity.toml
https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_base64_decoding_activity.toml
https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_interpreter_launched_from_decoded_payload.toml

Rule Tuning Type

False Negatives - Enhancing detection of true threats that were previously missed.

Description

Tool basenc - available in most of the latest Linux distributions is an alternative for other known tools like base16, base32, base64. It was added to coreutils in 2019 and supports both encoding and decoding different base* formats.

Example Data

Sample emulation (Ubuntu 24.04):

filip@ubuntu:~$ echo "echo Hello Elastic!" | basenc --base64
ZWNobyBIZWxsbyBFbGFzdGljIQo=
filip@ubuntu:~$ echo "echo Hello Elastic!" | basenc --base32
MVRWQ3ZAJBSWY3DPEBCWYYLTORUWGIIK
filip@ubuntu:~$ echo "echo Hello Elastic!" | basenc --base16
6563686F2048656C6C6F20456C6173746963210A
filip@ubuntu:~$ echo "ZWNobyBIZWxsbyBFbGFzdGljIQo=" | basenc --base64 -d | bash
Hello Elastic!
filip@ubuntu:~$ echo "MVRWQ3ZAJBSWY3DPEBCWYYLTORUWGIIK" | basenc --base32 -d | bash
Hello Elastic!
filip@ubuntu:~$ echo "6563686F2048656C6C6F20456C6173746963210A" | basenc --base16 -d | bash
Hello Elastic!
filip@ubuntu:~$
{
  "timestamp": "2026-11-18T19:29:58.57Z",
  "host": "ubuntu",
  "user": "filip",
  "process": {
    "name": "basenc",
    "args": ["basenc", "--base16", "-d"],
    "command_line": "basenc --base16 -d",
    "executable": "/usr/bin/basenc",
    "pid": 46538,
    "entity_id": "tqlTwcHwfkw/DexEM0zZbg"
  },
  "parent": {
    "command_line": "-bash",
    "pid": 41105,
    "entity_id": "XgFGyU2tqi+uiRMWwU3iXA"
  }
}

Proposed change

Add to base* related rules in Linux (I found 3) support to basenc utility.
If agreed to - I can make a pull request proposal.

https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_base16_or_base32_encoding_or_decoding_activity.toml

 process where host.os.type == "linux" and event.type == "start" and
 event.action in ("exec", "exec_event", "start", "ProcessRollup2", "executed", "process_started") and
-process.name in ("base16", "base32", "base32plain", "base32hex") and
+(
+  process.name in ("base16", "base32", "base32plain", "base32hex") or
+  (process.name == "basenc" and process.args in ("--base16", "--base32", "--base32hex"))
+) and
 not process.args in ("--help", "--version")

https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_base64_decoding_activity.toml

         (
-            process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16") and
+            process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16", "basenc") and
             (process.args like "--d*" or process.args like "-d*")
         ) or

https://github.com/elastic/detection-rules/blob/main/rules/linux/defense_evasion_interpreter_launched_from_decoded_payload.toml

   [process where host.os.type == "linux" and event.type == "start" and event.action in ("exec", "ProcessRollup2") and (
-    (process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16") and process.command_line like~ "*-*d*") or
+    (process.name in ("base64", "base64plain", "base64url", "base64mime", "base64pem", "base32", "base16", "basenc") and process.command_line like~ "*-*d*") or
     (process.name == "openssl" and process.args == "enc" and process.args in ("-d", "-base64", "-a")) or

Sources

https://man7.org/linux/man-pages/man1/basenc.1.html
https://gtfobins.org/gtfobins/basenc/

Activity

  1. added
    Rule: Tuning
    on Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Rule: TuningTeam: TRADEcommunity

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions