Kernel Level anticheat is coming to Linux

Admin

Administrator
Moderator
Messages
4,428
#1
It was always going to end up like that. The tools for enabling it already exists and all what was needed was linux gaining enough market share.

https://onlineservices.epicgames.com/news/introducing-easy-anti-cheat-linux-v2

I had a feeling we would get something like that. At least it doesn't (yet) rely on shady closed sourced kernel modules so it seems better than the typical windows implementation.

eBPF will be used to provide kernel level access for anticheat software. That does provide kernel level perms but within restrictions.

There are eBPF rootkits so do need to be careful with what you grant access to when it comes to these perms (similar to how you need to be careful with root access). I personally have a strict rule against that when it comes to closed sourced software.

https://www.researchgate.net/publication/372499508_eBPF-based_Malware

https://github.com/Gui774ume/ebpfkit

A badly coded eBPF program can allow for privilege escalation

https://github.com/pathtofile/bad-bpf

It's a powerful tool that can do a lot of damage in the wrong hands.

https://ebpf.io/what-is-ebpf/#loader--verification-architecture

While this isn't exactly an ideal solution it should still bring more people to linux which will also improve the availability of other types of software.

The people who care a lot about security might simply be a loud majority while there is a much larger pool of people who just want to play games online and very much don't want to play against cheaters.
 

Admin

Administrator
Moderator
Messages
4,428
#2
Sandboxing
Since the anticheat will run at the kernel level you can't sandbox it at the software level and the only way to protect yourself will be to use a separate linux install for games that require it (hoping your bios itself isn't going to be infected which requires safety on the hardware level) and disconnect any drive with sensitive data (which is impractical typically in the case of NVME drives).

But at this point you may as well just boot windows to be honest unless you have some specific reason for why you want to play on linux. At least you will get another option for games that will add support for kernel level anticheat on linux but it's obviously not a particularly great second option.
 

Admin

Administrator
Moderator
Messages
4,428
#3
The genshin impact incident
There was a case of randomware using a security issue in the genshin impact anticheat to disable peoples anti-virus software to encrypt all their data anyway. This illustrates the danger of granting kernel level access to anything because even if the software itself isn't malicious any security issue it has could get utilized by another piece of software to cause very significant damage.

https://www.trendmicro.com/en_gb/research/22/h/ransomware-actor-abuses-genshin-impact-anti-cheat-driver-to-kill-antivirus.html
 

Admin

Administrator
Moderator
Messages
4,428
#4
LSM control alone is quite dangerous
The linux security module is used for things like apparmor and SELINUX both of which are options for additional linux security. I personally use apparmor to limit wine and app images besides the default profiles.

But it turns out you can even use LSM to get around the standard access control such as accessing files you would otherwise need root access for.

Certain POSIX-compliant filesystems depend on the ability to grant accesses that would ordinarily be denied at a coarse level (DAC level) of granularity (check capabilities man page for CAP_DAC_OVERRIDE). LSM supports DAC override (a.k.a., permissive hooks) for particular objects such as POSIX-compliant filesystems, where the security module can grant access the kernel was about to deny.
https://github.com/kubearmor/KubeArmor/wiki/Introduction-to-Linux-Security-Modules-(LSMs)

That means that if some malware is able to exploit a security issue in EAC linux V2 said malware could encrypt every single file in addition to being able to access all of your data regardless of what security you tried to set up as long as it isn't some password protected zip folder where said password isn't physically accessable for the malware.

That's why the only decently reliable sandbox is physical disconnection (unplugging your main system and using a separate linux install just for those anticheat games).

Here is the main important details we know regarding the upcoming linux kernel level anticheat from epic games:
The LSM BPF feature enables eBPF programs to use Linux Security Module hooks for granular access control and monitoring. This enables anti-cheat to restrict other processes from reading or writing protected game process memory without needing a kernel module, as well as monitor for cheats loaded in different ways. We require the BPF LSM to be loaded and active.
Of course we don't know the details yet but i don't see any way to implement this in a safe manner.
 

Admin

Administrator
Moderator
Messages
4,428
#5
Kernel lockdown creates real problems right away
While kernel lockdown does have some security benefits (which isn't much compared to the massive security risks imposed by the kernel level anticheat) it will also stop various things from properly working including LACT (needed for proper GPU overclocking/undervolting on the nvidia side at least).

https://man.archlinux.org/man/kernel_lockdown.7

Of course there are probably ways in which they could make the anticheat works without breaking important functionality like that but it remains to be seen how it actually plays out in the end. Perhaps there could be a less restrictive kernel lockdown mode or perhaps eBPF could be used to provide the functionality needed (which would require extra work so not ideal).
 

Admin

Administrator
Moderator
Messages
4,428
#6
Epic games does not view the EAC linux V2 approach as the ideal solution
They at least claim to view it as a temporary option until they are able to make something effective that isn't egregiously intrusive.
The ideal solution for a cheat-free gaming environment is one where the operating system provides assurances to players that their data remains isolated from both anticheat and game companies while also ensuring that the gameplay cannot be tampered with. There have been many efforts over the years to build solutions like this including virtualization techniques to enable cheat free gaming, but to date they haven't gained traction. We hope they soon will, and we'll work with all willing companies in the industry to make this happen in the future. This includes continuing the Easy Anti-Cheat team's open line of communications with Valve to support Steam Hardware devices to the maximum extent technically possible.
But it's unclear of said "long-term solution" is ever doing to actually materialize or if linux gamers will forever have to choose between a linux version of kernel level anticheat or not playing the game via linux at all for popular multiplayer titles.
 

Admin

Administrator
Moderator
Messages
4,428
#7
Seems like LACT and cpupower works with the current cachyOS version
While this was always likely to get resolved eventually it seems like it has been resolved before EAC linux V2 even got launched.

TypicalLinuxHead wrote:

Alright I decided to test out the EAC v2 Kernel and it looks like lact still works and cpupower still works. So that’s been addressed. Nothing else has.
Still adding more to the list of reasons you shouldn’t install EAC v2 is the ongoing meltdown of the Epic Games CEO. If the company even exists long enough to deploy their Kernel AC in the first place.

https://www.youtube.com/watch?v=jHT4iHJxzOI

I want the company to crash and burn and this to be dead in the water so I can enjoy my safely isolated user space anti-cheat and not lose access to games without handing over system control.
 

Admin

Administrator
Moderator
Messages
4,428
#8
The beta for it is now here
It's via a beta for fortnite but you can play it.

https://onlineservices.epicgames.com/news/eac-linux-v2-brings-fortnite-to-linux-in-beta

I have not enabled eac v2 on my current system obviously.

https://www.youtube.com/watch?v=WxwXTix6epg

Maybe if i can play as a cute waifu similar to that i will overlook details regarding what privileges eac-linux-v2 is granted.

https://www.youtube.com/watch?v=0yYxPW2IlWk

Currently tournaments are still not available on linux (they don't view the current version sufficient for that) but that will hopefully change later.
 

Admin

Administrator
Moderator
Messages
4,428
#9
Easy anti-cheat V2 is using a custom eBPF module
So it's not just them using existing eBPF modules like some people thought. Currently said eBPF kernel module isn't even open sourced and it remains to be seen if that is ever going to change (they might eventually do so due to licensing reasons).

Prestigious-Kiwi1684 wrote:

They have a /var/lib/easyanticheat_eos/ folder with a third-party notices file that contains this:
================================================================================ Easy Anti-Cheat for Linux - Third-Party and Open Source Notices
Easy Anti-Cheat distributes the open source components covered below.
  1. Easy Anti-Cheat eBPF process-protection program GNU General Public License, version 2, and the MIT License
Easy Anti-Cheat embeds a compiled eBPF program that the Linux kernel loads and executes. That program is a separate work from Easy Anti-Cheat, which interacts with it only through the bpf() system call. The files are licensed as follows:
ProcessProtection.bpf.c GPL-2.0-only
ProcessProtectionEvents.h GPL-2.0-only OR MIT
ProcessProtectionHelpers.bpf.h GPL-2.0-only
Copyright Epic Games, Inc. All Rights Reserved.
Complete corresponding source for these files is published at:
https://github.com/EpicGames/eac-ebpf
The program embedded in this build was compiled from commit:
4cceae9efcc100f6528f97e3e05ade179a3f7aee
then GPLv2 licence full text
The repository is still private or doesn't exist.
 

Admin

Administrator
Moderator
Messages
4,428
#10
The code for the eBPF kernel module is now public so we can now get a better idea of what it actually does
Most likely the actual interesting stuff is still going to be closed sourced with the eBPF module simply being there to provide kernel level access to EAC linux V2.

https://github.com/EpicGames/eac-ebpf

I asked chatGPT to take a look and got this

EAC-linux-V2.png


1. The overall architecture
The interesting thing is that it isn't really a conventional anti-cheat scanner. It operates at the kernel level and protects processes, executable files and certain kernel objects against interference.

The kernel component is Kernel/ProcessProtection.bpf.c.

It attaches programs to Linux kernel events using two principal mechanisms:

  • LSM hooks: These allow the program to approve or reject certain security-sensitive operations.
  • Tracepoints: These allow the program to observe events happening in the kernel.
The userspace component is important because it supplies the information about which processes and kernel objects should be protected.

That userspace implementation is not included in this repository.

2. What does it actually protect?
There are five particularly interesting mechanisms.

A. Protection against ptrace
This is implemented through:
  • PtraceAccessCheck
  • PtraceTraceme
ptrace is a Linux mechanism that allows one process to inspect and control another process.

Debuggers use it, but it can also be used to inspect another process's memory, manipulate execution, set breakpoints and otherwise interfere with it.

EAC uses these hooks to prevent unauthorized processes from using ptrace against protected processes.

The logic is approximately:

1796302502419.png


There are two slightly different implementations worth understanding.

PtraceAccessCheck checks the process being targeted. It allows the EAC service and the target process itself, but denies other processes.

PtraceTraceme checks the calling process. Protected processes are forbidden from requesting to be traced by their parent, without the service exception.

When something is denied, the program returns -EPERM, which is the standard permission-denied error.

It also emits an event describing the attempted operation.

This is a fairly direct form of anti-tampering protection.

B. Protection of EAC's own BPF maps
This is implemented through BpfMap.

Linux BPF maps are kernel-managed data structures that can be used to exchange information between kernel and userspace programs.

EAC uses several such maps to hold security-related information.

The code maintains a list called:

ProtectedMapIds

It contains the IDs of BPF maps that should be protected.

When another process attempts to obtain a file descriptor for one of those maps, the kernel hook checks its ID.

If the map is protected and the requesting process isn't the EAC service, access is denied.

One important detail: the Linux bpf_map LSM hook runs when the kernel generates and returns a file descriptor for a BPF map. It is not a general interception of every subsequent operation on an already-open map descriptor.

https://linux.googlesource.com/linux/kernel/git/torvalds/linux/+/335c9017e333894c39853f6fc27db9f0ce44f48b/security/security.c?utm_source=chatgpt.com

This is primarily about preventing other processes from accessing or manipulating EAC's own BPF infrastructure.

C. Monitoring executable file mappings
This is one of the more interesting parts.

There are two hooks:
  • MmapFile
  • FileMprotect
They monitor when files become executable in a process's address space.

For example, consider a game loading a shared library:

  1. The game opens a shared library.
  2. It maps that file into its virtual address space.
  3. The mapping has executable permissions.
  4. The kernel invokes the relevant LSM hook.
  5. EAC records information about the mapped file.
The program only records these mappings for processes present in ProtectedTgids.

There are two different scenarios covered:

MmapFile

Detects a file being mapped with executable permissions.

FileMprotect

Detects an existing file-backed mapping being changed to executable.

The second case is important because executable permissions don't necessarily have to be requested at the initial mapping stage. A mapping can become executable later.

Neither hook actually blocks the operation. They both return success after recording the information.

What information gets recorded?
The resulting MappedFileRecord contains:

1796302631408.png


It also includes the file path itself.

The path is constructed by walking the kernel's directory and mount structures rather than simply copying a userspace-provided filename.

The implementation handles mount points, limits the walk to 64 steps and limits the stored path to 4096 bytes.

When it cannot reconstruct the complete path, it sets the PROTECTION_MAPPED_FILE_FLAG_TRUNCATED flag.

Duplicate suppression
There is another interesting mechanism here.

MappedFileSeen is an LRU hash map with 8192 entries.

Before generating an event, EAC checks whether it has already recorded the same combination of:
  • Inode
  • Device
  • Process ID
  • Process cookie
  • Mapping flags
If it has, it skips the duplicate event.

This prevents repeated mappings of the same file from generating an excessive number of events.

The LRU design also means old entries can eventually be evicted.

D. Preventing modifications to protected files
This is where the file protection mechanism gets particularly interesting.

The program defines two inode-storage maps:
  • FileTags
  • DenyTags
These are attached to individual filesystem inodes, meaning they associate information with the actual file object rather than merely its pathname.

Here's how the code works.

When a protected process maps a regular file as executable, ClaimMappedFile() calls AddFileTag().

This associates the file with the protected process.

It stores two pieces of information together:

  • The process ID (TGID).
  • A process cookie.
The cookie is important because process IDs can be reused. It helps distinguish an old process from a new process that happens to receive the same PID.

Later, the FileOpen hook checks whether somebody is trying to open a file for writing or truncation.

It then retrieves both inode tags.

The critical condition is:

The same currently protected process must appear in both FileTags and DenyTags.

When that condition is satisfied, the program emits a denial event and returns:

-ETXTBSY

That is the Linux Text file busy error.

In other words, the intention is to prevent modification or truncation of certain files associated with protected processes.

There is an important qualification here, though.

This repository never populates DenyTags.

It only looks up entries in that map. FileTags, on the other hand, is populated directly by the eBPF program.

Linux does support userspace lookup and updates of inode-storage map entries, so the missing functionality could be implemented by the companion EAC service.


eBPF Docs


But because the userspace implementation isn't included, we cannot establish exactly when or under what conditions EAC adds those deny tags.

There is also a limitation to the enforcement: FileOpen intercepts opening a file, not writes to an already-open file descriptor. This code alone therefore does not prevent subsequent writes through a descriptor that was already opened for writing.

E. Monitoring process execution
This is implemented by:

SchedProcessExec

It attaches to the sched_process_exec kernel tracepoint.

Unlike the previous mechanisms, this one is not restricted to protected processes.

It records information about process executions generally, including:
  • Process ID
  • User ID
  • Process name
  • Executable filename
  • Timestamp
The events are sent through a ring buffer called ExecEvents.

This gives the userspace EAC service visibility into process execution activity.

Importantly, this hook does not block execution or make any decisions about whether an executable is malicious.

It is a monitoring mechanism.

3. How information is exchanged
The eBPF program and userspace service communicate through BPF maps and ring buffers.

The repository defines the following important maps:

1796302835815.png


The event structures are defined in ProcessProtectionEvents.h.

1796302874751.png


An important distinction: losing an event does not necessarily mean losing the protection.

For example, if the denial event ring buffer is full, EmitDenial() simply fails to record the notification. The caller still returns -EPERM or -ETXTBSY.

4. How is it built?
The Makefile is quite straightforward.

The build process is:
  1. Generate vmlinux.h using the running kernel's BTF information.
  2. Compile ProcessProtection.bpf.c into a BPF object using Clang.
  3. Generate a libbpf skeleton using bpftool.
The resulting files are:
  • ProcessProtection.bpf.o
  • ProcessProtection.lskel.h
The skeleton is intended to make it easier for a userspace program to load and manage the BPF object.

The use of BTF and BPF_CORE_READ is important: it allows the program to access kernel structures such as task_struct, inode and file while accommodating differences in their layouts between kernel versions.

The README specifies that building requires:
  • Clang
  • bpftool
  • libbpf headers
  • A kernel built with CONFIG_DEBUG_INFO_BTF
One detail worth noting: the supplied Makefile explicitly targets x86 (-D__TARGET_ARCH_x86).

5. What does this actually mean for anti-cheat?
There are some important distinctions between what this code does and what people might assume an anti-cheat system does.

1796302943345.png


The absence of something here doesn't prove the entire EAC client lacks that functionality. It simply isn't implemented in this repository.

6. My overall assessment
I think the most important thing to understand about this project is that it provides kernel-level protection and telemetry, rather than a complete cheat-detection engine.

There are three main goals:
  1. Make protected processes harder to interfere with. The ptrace restrictions are probably the clearest example.
  2. Protect EAC's own infrastructure. The BPF map restrictions prevent unauthorized processes from obtaining access to selected internal maps.
  3. Observe activity surrounding protected processes. Executable file mappings and process executions provide information that the userspace service can potentially use for further analysis.
There are also some unanswered questions that I would particularly like to investigate:
  • What exactly populates DenyTags, and when?
  • How does the userspace client decide which processes enter ProtectedTgids?
  • What does it do with the executable mapping and execution events?
  • How does it respond to detected interference?
The repository README explicitly describes this as the eBPF component of the Linux client, published to satisfy the GPL source-distribution requirements. It is not the complete client.

My conclusion: The interesting part isn't so much the individual hooks as the combination of kernel enforcement and userspace-managed protection state. The kernel component establishes boundaries that ordinary userspace processes cannot simply bypass through normal process operations, while supplying information to the EAC service.

Understanding the missing userspace component would be the next major step toward understanding how EAC on Linux actually works as a complete system.

1796303175401.png


I asked about security implications and didn't get a good answer

1796303416309.png
 

Attachments

Admin

Administrator
Moderator
Messages
4,428
#11
ChatGPT risk assessment
Didn't find anything too bad but it may have missed something nasty of course.

I wouldn't automatically consider it unsafe simply because it operates in the kernel.

There are some positive aspects:
  • It uses standard Linux eBPF infrastructure rather than a conventional proprietary kernel module.
  • The kernel verifier checks the programs before execution.
  • The source code is publicly available.
  • The actual enforcement mechanisms are relatively specific rather than implementing unrestricted system monitoring.
However, I'd be more cautious about the privacy implications than the raw performance implications.

My biggest unanswered question is what happens to the system-wide process execution telemetry.
The source establishes that this information is collected, but doesn't establish whether it remains local or is transmitted to Epic.

That's something I'd want to understand before making a decision about using it.

The other missing piece is the userspace implementation. Without it, we cannot properly assess what information EAC collects, how long it retains it, or how it manages the kernel protections.

The likelihood of ordinary malware hijacking this particular component to gain kernel-level control is relatively low. However, the potential consequences of a genuine kernel or eBPF vulnerability could be severe.

After looking through the actual source code, I don't see an obvious mechanism that would let malware turn EAC into a general-purpose kernel backdoor.

There are several different scenarios worth distinguishing.

1. Can malware abuse EAC's existing eBPF programs?
Relatively difficult
The important thing is that the eBPF programs have a fairly limited set of capabilities.

I examined the actual functions in ProcessProtection.bpf.c and ProcessProtectionHelpers.bpf.h.

They primarily:
  • Read information about processes and files.
  • Maintain their own BPF map entries.
  • Record information in ring buffers.
  • Reject certain operations through LSM hooks.
  • Monitor process execution.
They do not contain functionality for arbitrary kernel memory writes, arbitrary filesystem modifications, terminating arbitrary processes or injecting code into other processes.

The Linux eBPF verifier also checks programs before they are loaded, including pointer access and memory safety.

The Linux Kernel documentation+1

This significantly limits the possibilities for abusing the existing program.

2. Could malware take control of EAC's BPF maps?
Potential attack surface

This is more interesting.

The program maintains several maps containing security-sensitive information.

For example:
  • ProtectedTgids determines which processes receive ptrace protection.
  • ProtectedMapIds determines which BPF maps are protected.
  • FileTags tracks files associated with protected processes.
  • DenyTags participates in file modification restrictions.
An attacker who managed to obtain write access to these maps could potentially interfere with EAC's protection mechanisms.

For example, manipulating ProtectedTgids could undermine process protection.

However, the implementation specifically protects selected BPF maps through its BpfMap LSM hook.

There is a nuance: Linux allows BPF file descriptors to be inherited, duplicated and transferred between processes. The map protection hook does not, by itself, establish that every operation through an already-obtained descriptor is protected.

We cannot evaluate how well EAC handles descriptor ownership because its userspace implementation isn't included.

The Linux Kernel documentation+1

3. Could malware exploit the eBPF program itself?
Low probability, potentially high impact

This is the scenario I'd take most seriously.

Although the verifier restricts what BPF programs can do, there are still potential vulnerabilities in:

  • The BPF verifier.
  • The kernel's BPF implementation.
  • The JIT compiler.
  • Kernel helper functions.
  • The interaction between BPF programs and kernel data structures.
A vulnerability in one of these components could potentially allow privilege escalation or kernel compromise.

This isn't purely theoretical: Linux has had vulnerabilities involving the eBPF verifier and JIT implementations.

The important distinction is that such an attack would exploit a kernel vulnerability, rather than simply instructing EAC's existing BPF program to perform arbitrary operations.

ACM SIGOPS+1

4. Could malware hijack the EAC userspace service?
This is another possible avenue.

The service communicates with the kernel component and manages important protection state.

Compromising it could potentially allow an attacker to:

  • Manipulate which processes are protected.
  • Interfere with EAC's telemetry.
  • Disrupt or disable parts of its protection.
  • Gain access to resources that the service itself can access.
The source contains an interesting protection here: attempts to ptrace the EAC service are explicitly rejected.

However, that doesn't protect against every possible way of compromising a privileged userspace service.

We would need the userspace source to evaluate this properly.

5. What if malware already has root privileges?
This changes the situation considerably.

Malware with sufficient privileges can potentially load its own eBPF programs, attach them to kernel hooks, manipulate kernel-level monitoring and interfere with existing BPF objects.

The Linux kernel documentation explicitly describes LSM-attached BPF programs as a mechanism for privileged users to implement system-wide security policies.

The Linux Kernel documentation+1

At that point, the attacker already has substantial control over the system. EAC isn't necessary to achieve most forms of serious damage.

1796304011939.png


From a system-security perspective, I consider the new Linux EAC implementation considerably less concerning by design than the Windows implementation. The biggest reason is how they execute code inside the kernel.

There is an important architectural difference: Linux EAC v2 deliberately avoids installing a conventional anti-cheat kernel driver. Epic explicitly confirms that Windows relies heavily on a kernel driver, whereas Linux v2 uses eBPF and existing Linux security mechanisms.




The distinction is significant.

A conventional Windows kernel driver executes native kernel-mode code. A programming error involving memory can potentially corrupt kernel memory.

An eBPF program, by contrast, must pass the Linux verifier before execution. The verifier examines possible execution paths and checks memory accesses, pointer types and other operations.

https://kernel.org/doc/html/latest/bpf/verifier.html?utm_source=chatgpt.com

This doesn't make eBPF invulnerable, but it provides a meaningful additional security boundary.

1796305291367.png
 
Top