Skip to main content
AI
  • Get started with AI

    • Red Hat AI

      Accelerate the development and deployment of enterprise AI solutions.

    • AI learning hub

      Explore learning materials and tools, organized by task.

    • AI interactive demos

      Click through scenarios with Red Hat AI, including training LLMs and more.

    • AI/ML learning paths

      Expand your Red Hat OpenShift AI knowledge using these learning resources.

    • AI quickstarts

      Focused AI use cases designed for fast deployment on Red Hat AI platforms.

    • No-cost AI training

      Foundational Red Hat AI training.

  • Featured resources

    • Red Hat OpenShift AI
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

Red Hat AI Factory with NVIDIA

Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.

Learn
  • Self-guided

    • Documentation

      Find answers, get step-by-step guidance, and learn how to use Red Hat products.

    • Learning paths

      Explore curated walkthroughs for common development tasks.

    • Guided learning

      Receive custom learning paths powered by our AI assistant.

    • See all learning
  • Hands-on

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

    • Interactive labs

      Learn by doing in these hands-on, browser-based experiences.

    • Interactive demos

      Click through product features in these guided tours.

  • Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics
  • Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
Build
  • Get started

    • Red Hat build of Podman Desktop

      A downloadable, local development hub to experiment with our products and builds.

    • Developer Sandbox

      Spin up Red Hat's products and technologies without setup or configuration.

  • Download products

    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products
  • Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset
  • References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
Community
  • Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions
  • Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github
  • Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

Join the Red Hat Developer program

Download Red Hat products and project builds, access support documentation, learning content, and more.

ConsoleDocsSupport Search
New For you

Resources to explore

Check out popular resources, tools, and information from Red Hat. We'll recommend more as you browse.

  • Product downloads
  • Cheat sheets
  • Red Hat Developer learning portal
  • Developer blog
  • E-books
  • Developer Sandbox
Log in

Get more with a Red Hat Developer account

  • Product downloads
  • Console access
  • Event registration
  • Training & trials
Explore more account benefitsLog in or register

A subscription may be required for some services.

Contact us

Layered defense in Red Hat Enterprise Linux

Comparative security tests of Red Hat Enterprise Linux 9.8 configurations

December 3, 2026
Amy Ralph Lukas Vrabec
Related topics:
Security
Related products:
Red Hat Enterprise Linux

    Platform teams are often pressured to run setenforce 0 or to disable application controls to unblock software deployments. To measure the exact security cost of that compromise, we tested 4 post-exploitation attacks against default Red Hat Enterprise Linux 9.8 (RHEL) configurations. One host maintained RHEL's default security posture, with SELinux enforcing, fapolicyd, and kernel defaults on, and the other host had those controls turned off. To evaluate RHEL's application allowlisting capabilities, we also installed fapolicyd. On the other host, we turned those controls off. The first host blocked all 4 attacks, and the second host stopped none of them.

    Key findings

    Our testing revealed a stark contrast between a fully hardened RHEL 9.8 system and one with security controls disabled:

    • 100% block rate on the hardened host: The hardened RHEL 9.8 host successfully blocked all 4 post-exploitation attack vectors tested.
    • 0% block rate on permissive host: The permissive host failed to stop any of the 4 attack vectors, allowing full exfiltration and execution.
    • Effective layered enforcement: SELinux and fapolicyd effectively enforced mandatory access control (MAC) and application allowlisting at the system level, stopping file reads, network pivots, and untrusted binary execution.

    Methodology and test environment

    We provisioned 2 identical RHEL 9.8.0 virtual machines with these specifications:

    • Kernel: 5.14.0-687.5.1.el9_8.x86_64
    • Architecture: x86_64 KVM guests
    • Base image: The same RHEL 9.8.0 compose

    One system kept SELinux enforcing and the kernel defaults, and we installed fapolicyd ("hardened"). The other was deliberately weakened ("permissive") to simulate a host where an administrator has disabled security controls, a common pattern when administrators disable controls to quickly bypass application errors during deployment.

    We ran our tests on RHEL 9.8.0 (kernel 5.14.0-687.5.1.el9_8.x86_64) in October 2026. Our lab included KVM guests and bare metal, using the same compose. Our test scripts are available from github.com/Amy-Ra-lph/defense-in-depth-tte.

    Hardened host (SELinux enforcing, kernel defaults, fapolicyd added)

    • SELinux: Enforcing
    • fapolicyd: Active (default policy, permissive=0)
    • LSM stack: lockdown, capability, landlock, yama, selinux, bpf
    • kptr_restrict: 1 (kernel pointers hidden)
    • ASLR: Full (randomize_va_space=2)
    • Slab hardening: Kernel defaults (randomized freelists, init_on_alloc)
    • auditd: Active

    Permissive host (deliberately weakened)

    • SELinux: Permissive (setenforce 0 + /etc/selinux/config)
    • fapolicyd: Disabled (systemctl disable --now fapolicyd)
    • Slab hardening: Disabled (grubby --args="slab_nomerge init_on_alloc=0 init_on_free=0")
    • Firewall: Trusted zone (firewall-cmd --set-default-zone=trusted)

    We rebooted the permissive host so the kernel parameters took effect. Both hosts were running the same kernel.

    Attack simulation

    Each attack assumes the attacker already has a foothold, for example from a web application vulnerability, and is trying to expand it. The 4 vectors each aim at a specific control.

    Shell scripts connected to both hosts over SSH, ran each attack, and recorded the result and the script's "wall time" (how long the harness took to finish). Wall time here is dominated by SSH round-trip overhead, not the speed of the security decision itself. The actual allow or deny happens at the syscall level in microseconds. The meaningful result in the tables below is pass or fail, not the millisecond delta.

    Attack 1: Confined file read (SELinux)

    Scenario: An attacker compromises a web application (httpd) and uses a CGI web shell to read sensitive files outside the web root — specifically, user home directories containing credentials or personal identifiable information (PII).

    Method: We deployed a CGI script to /var/www/cgi-bin/ that attempts to cat /home/attacker/secrets.txt. The file has permissions 644, making it world-readable with discretionary access control (DAC), and the parent directory is 755. On a system without mandatory access control (MAC) controls, the apache user (running as httpd) can read this file.

    What's at risk: Web application compromises are the most common initial access vector. If httpd can read arbitrary files, then a single web vulnerability becomes a full data breach.

    Audit evidence (hardened host)

    • Result: Blocked
    • Wall time: 728ms
    • Defense layer: SELinux MAC (httpd_sys_script_t)
    type=AVC msg=audit(...): avc: denied { search }
      pid=24205 comm="cat" name="attacker"
      scontext=system_u:system_r:httpd_sys_script_t:s0
      tcontext=unconfined_u:object_r:user_home_dir_t:s0
      tclass=dir permissive=0

    Audit evidence (permissive host)

    • Result: Data leaked
    • Wall time: 673ms
    • Defense layer: None (DAC allows with 644 permissions)
    type=AVC msg=audit(...): avc: denied { read }
      name="secrets.txt"
      scontext=system_u:system_r:httpd_sys_script_t:s0
      tcontext=unconfined_u:object_r:user_home_t:s0
      tclass=file permissive=1
    
    type=SYSCALL: syscall=257 success=yes exit=3

    Analysis: The permissive=0 over permissive=1 flag is the critical difference. On the hardened host, SELinux enforced the policy and blocked the syscall. On the permissive host, SELinux logged the violation but allowed the read to succeed (success=yes). The sensitive data was exfiltrated. The audit2why output confirms this is a deliberate policy decision. The Boolean httpd_enable_homedirs is off by default and prevents httpd processes from accessing user home directories regardless of DAC permissions.

    Attack 2: Network escape (SELinux)

    Scenario: Following the file access attempt, an attacker uses httpd to connect to SSH (port 22) for lateral movement. SELinux blocked the network connection due to the httpd_can_network_connect policy being disabled by default, while the permissive host allowed the SSH banner to be retrieved.

    Key takeaway: SELinux blocks both file access and network escape attempts. This demonstrates that even when attackers attempt to chain multiple CVEs or launch simultaneous exploits, the attack path is fully mitigated with SELinux enabled.

    Audit evidence (hardened host)

    • Result: Blocked
    • Wall time: 864ms
    • Defense layer: SELinux network policy (name_connect)

    Audit evidence (permissive host)

    • Result: Blocked
    • Wall time: 674ms
    • Defense layer: None

    Attack 3: Untrusted binary execution from /tmp (fapolicyd)

    Scenario: The attacker downloads or compiles a payload binary and attempts to execute it. This is the most common post-exploitation pattern: Drop a tool in a writable directory and run it. Method: We compiled a small C program on the target host (simulating an attacker building a payload), placed it in /tmp, and executed it as an unprivileged user. The binary is not in any RPM package database — it is "untrusted" from the perspective of fapolicyd.

    Audit evidence (hardened host)

    • Result: Blocked
    • Wall time: 837ms
    • Defense layer: fapolicyd (FANOTIFY permission event)
    type=FANOTIFY msg=audit(...): resp=2 fan_type=1
      fan_info=D subj_trust=2 obj_trust=0
    type=SYSCALL: syscall=59 success=no exit=-1
      comm="bash" exe="/usr/bin/bash"

    Audit evidence (permissive host)

    • Result: EXECUTED (uid=1001)
    • Wall time: 690ms
    • Defense layer: None

    Analysis: fapolicyd uses the kernel's FANOTIFY framework to intercept execve() system calls. When the binary's hash does not match any entry in the RPM trust database (obj_trust=0), fapolicyd returns resp=2 (deny). The kernel then fails the execve() with EPERM. The fapolicyd policy uses a trust-based model: Only binaries installed as an RPM (tracked in a database of ~15,000 entries on a standard RHEL 9 install) are allowed to execute. Everything else, including attacker tools compiled on the system, is blocked.

    Attack 4: Memory-resident payload via /dev/shm (fapolicyd)

    Scenario: The attacker attempts to evade filesystem-based controls by placing a payload in shared memory (/dev/shm) — a tmpfs mount that exists only in RAM. This is a common evasion technique against traditional antivirus and file integrity monitoring tools. Method: We compiled a separate small C program directly in /dev/shm/ and executed it as an unprivileged user.

     HardenedPermissive
    ResultBLOCKED (Operation not permitted)EXECUTED
    Wall time775ms777ms
    Defense layerfapolicyd (FANOTIFY)None

    Analysis: fapolicyd intercepts at the execve() syscall level, not at the filesystem level. It doesn't matter whether the binary is on disk, in /tmp, or in shared memory. If the binary is not in the RPM trust database, then execution is denied. This makes fapolicyd effective against in-memory evasion techniques that bypass traditional file-based security tools.

    Audit evidence (hardened host)

    • Result: Blocked (operation not permitted)
    • Wall time: 775ms
    • Defense layer: fapolicyd (FANOTIFY)

    Audit evidence (permissive host)

    • Result: Permissive
    • Wall time: 777ms
    • Defense layer: None

    Recommendations

    From our experiments here, there emerges several best practices to keep in mind for your own systems:

    • Never disable SELinux. Our testing showed that SELinux's MAC controls blocked 2 of 4 attack vectors that succeeded on a permissive system. The file confinement and network confinement operate at the kernel level and cannot be bypassed by userspace attackers without a kernel exploit.
    • Deploy fapolicyd. Application allowlisting blocked 2 of 4 vectors, including the memory-resident payload in /dev/shm. Because fapolicyd operates at the execve() syscall level, it's effective against evasion techniques that bypass file-based security tools. Run fapolicyd-cli --update after installation.
    • Keep kernel defaults. The slab_nomerge and init_on_alloc=0 kernel parameters that some guides recommend for "performance tuning" remove heap protections that make exploit development significantly harder. Do not disable them unless you have measured a performance impact in your specific workload.
    • Set dmesg_restrict=1. Both our test hosts allowed unprivileged dmesg access, which can leak kernel addresses. Add kernel.dmesg_restrict=1 to /etc/sysctl.d/99-hardening.conf.
    • Monitor audit logs. Even on the permissive host, SELinux logged the policy violations (with permissive=1). If your organization is running SELinux in permissive mode as a stepping stone to enforcing, these logs tell you exactly what would break — and what you're currently exposed to.
    • Complement runtime controls with live patching: Mandatory access controls and allowlisting contain attackers after initial access, but pairing them with kpatch helps mitigate known vulnerabilities without requiring system reboots.

    Want to see this for yourself?

    Everything here ran on paired KVM guests built from the same compose. In the next article, we repeat the hardened-host results on bare metal to rule out virtualization artifacts, dig into what RHEL's kernel defaults protect against (beyond SELinux and fapolicyd), and walk through the exact steps to reproduce every attack on your own two RHEL 9 systems, with audit commands included.

    Ready to evaluate your own systems? Review our step-by-step RHEL 9 security hardening guide to audit your default configurations.

    Related Posts

    • How SELinux deny rules improve system security

    • How custom SELinux policies secure servers and containers

    • How SELinux improves Red Hat Enterprise Linux security

    Recent Posts

    • Deploying a sealed image mode system on AWS with secure boot

    • Resource management and capacity management on Red Hat OpenShift Virtualization

    • Layered defense in Red Hat Enterprise Linux

    • Kafka Monthly Digest: November 2026

    • Securing AI agent tool calls at the gateway with NeMo Guardrails

    What’s up next?

    E-book SELinux Coloring Book_Tile card

    SELinux Coloring Book

    Dan Walsh
    Red Hat Developers logo

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    Red Hat Developer

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility
    Ask AI