YARA Rules — Community Threat Intelligence

AppArmor Bypass 2026 protection yara rules

Join the BastionGuard community Sign in to start discussions, reply, follow topics and receive notifications.

We are publishing a YARA rule to be inserted into

/usr/share/BastionGuard/data/yara/

.

sudo nano Linux_Ransomware_AppArmor_Bypass_2026.yara
rule Linux_Ransomware_AppArmor_Bypass_2026
{
    meta:
        author = "Calogero Scarnà"
        date = "2026-03-13"
        description = "Ransomware using AppArmor bypass as pre-encryption step"
        reference = "CrackArmor + ransomware chain"
        confidence = "high"
        scope = "file"

    strings:
        /* AppArmor disable/bypass */
        $aa1 = "/sys/kernel/security/apparmor/.remove" ascii
        $aa2 = "unconfined" ascii
        $aa3 = "apparmor_parser" ascii

        /* Ransomware encryption indicators */
        $r1  = "AES" ascii nocase
        $r2  = "chacha20" ascii nocase
        $r3  = "EVP_EncryptInit" ascii
        $r4  = ".encrypted" ascii
        $r5  = ".locked" ascii
        $r6  = "README_DECRYPT" ascii nocase
        $r7  = "YOUR_FILES_ARE_ENCRYPTED" ascii nocase
        $r8  = "bitcoin" ascii nocase
        $r9  = "ransom" ascii nocase
        $r10 = "tor2web" ascii nocase

        /* File system mass operation indicators */
        $f1 = "inotify_add_watch" ascii
        $f2 = "fanotify_init" ascii
        $f3 = "opendir" ascii
        $f4 = "rename(" ascii

        /* ELF header */
        $elf = { 7F 45 4C 46 }

    condition:
        $elf at 0
        and 1 of ($aa1, $aa2, $aa3)
        and
        (
            2 of (
                $r1, $r2, $r3, $r4, $r5,
                $r6, $r7, $r8, $r9, $r10
            )
            or
            (
                1 of ($r6, $r7, $r8, $r9, $r10)
                and 2 of ($f1, $f2, $f3, $f4)
            )
        )
}

This YARA rule provides heuristic detection of Linux ELF binaries containing indicators associated with potential AppArmor security profile bypass techniques and ransomware-related functionality.

The detection logic correlates AppArmor manipulation indicators with encryption-related strings, ransom-note artifacts, and file system operation functions. Its purpose is to identify suspicious binaries that may combine attempts to weaken mandatory access controls with ransomware-like behavior.

Restart BastionGuard Real-Time Protection

After saving the YARA rule, restart the BastionGuard real-time protection service to apply the updated detection configuration:

sudo systemctl restart BastionGuard-ransomware-realtime.service

Warning: This heuristic detection rule may generate false positives, particularly when scanning legitimate security utilities or binaries containing common cryptographic and file system operation strings. It is recommended for security research and controlled testing environments. Production deployment should only be considered after thorough validation and tuning.

0

This topic is closed to new replies.