A code-reuse attack named “Segmentation Fault Oriented Programming (SFOP)” exploits weaknesses in signal handling and Intel CET in Linux systems.

To that end, SFOP is capable of bypassing Intel CET in any program by producing segmentation faults in sequence. The program under attack is first made to access a restricted area of memory and then repeatedly crashed by executing invalid instructions.

Every time it receives a SIGSEGV signal in return, the attacker registers a signal handler that succeeds in crashing the program.

Registering a different piece of code every time, the attacker advances step by step, achieving arbitrary code execution. SFOP ends up enabled by 12 previously unknown weaknesses that affect Linux signals, discovered by Marcos Bajo, Apostolos Chatzianagnostou, and Christian Rossow at the CISPA Helmholtz Center for Information Security, and Ritvik Goyal at the Indian Institute of Technology Kanpur.

Easy to Exploit

This new code-reuse attack is comparatively easy to exploit as it does not require any specific feature in the targeted program, being practicable across all programs run on a Linux system, according to Bajo, first author of the paper on SFOP.

Schneider Bold

SFOP achieves arbitrary code execution by busting Intel CET, a state-of-the-art Control Flow Integrity scheme (CFI), Bajo said.

“Nowadays, computers are protected from code-reuse attacks by CFI defenses, which end up meant to guarantee the correct program execution flow,” Bajo said. “What we tried in this attack is to achieve the same capabilities that were possible before the introduction of CFI schemes. The most important of these schemes that we target in SFOP is Intel CET. We say it is the most important because it is in both Windows and Linux by default – it has been in Intel processors since 2020. Every program that runs on your computer ends up protected by this defense.”

SFOP exploits segmentation faults triggered by a program’s attempts to access a restricted area of memory.

SFOP code-reuse attack

A SFOP attack is capable of bypassing Intel CET in any program by producing segmentation faults in sequence.
Source: CISPA/Janine Wichmann-Paulus

When a segmentation fault occurs, the kernel sends a signal called SIGSEGV to the program, challenging the transgression. It is this moment that allows an attacker to launch SFOP.

“The one signal we are targeting is SIGSEGV, the segmentation fault signal,” Bajo said. :When the application is executing and it requests access to some memory that it shouldn’t have access to or executes an instruction that is invalid under CET, the kernel detects this and says ‘this is not allowed, I will stop you.’ At this moment, the signal ends up sent to the application and the application must react to it.”

Inserting Code

In SFOP, the attacker leverages this mechanism, inserting pieces of code that act as signal handlers for the SIGSEGV signal and coordinate the program’s reaction to it.

“SFOP is really a chain of signal handlers. What the attacker is doing is registering signal handlers all the time so that the program stops what it’s doing, executes the code, crashes, then goes to next signal handler, executes it, crashes again, and so on,” Bajo said. “That’s why we call it segmentation fault oriented programming. The way it chains together small pieces of code is all the time producing segmentation faults, crashing the program.”

Inserting a different piece of code each time, the attacker can achieve different things at every step of this chain, from opening a file to sending data.

In Linux systems, signals serve to inform a running program of asynchronous events, asking it, for instance, to terminate, pause, or resume a process. Such asynchronous events tend to pose challenges to CFI defenses.

“We already had this experience from prior research that asynchronous mechanisms can be problematic for CFI schemes because they are not able to manage them well,” Bajo said. “Also, protections tend to be designed for either the programs or the kernel. But whenever there is a mechanism that moves between the programs and the kernel you can be suspicious that something may be going wrong with this.”

While Intel CET ended up implemented properly in Linux systems, Bajo and his collaborators detected 12 new weaknesses in the kernel itself that affect signal handling in Linux and taken together enable SFOP to achieve its full impact.

SFOP a Simple Attack

SFOP is among “the low-hanging fruit” of code-reuse attacks as it is practicable across all programs running on a Linux system.

“Signals are by default, and ingrained in Linux, and you cannot easily disable them. Signals are not something that the programmer needs to prepare the program for. Rather, if you create any program, it will have them already,” Bajo said.

Patching SFOP has thus involved addressing the weaknesses they found in the Linux kernel.

Working together with the Linux kernel security team, Bajo, Chatzianagnostou, Rossow, and Goyal developed a number of patches that successfully mitigate SFOP.

Click here to view the paper.

Pin It on Pinterest

Share This