References:
[1] Control Jujutsu: On the Weaknesses of Fine-Grained Control Flow Integrity. CCS, 2015.
A new attack on fine-grained CF that exploit the incompleteness of pointer analysis, when combined with common software engineering practices, to enable an attacker to execute arbitrary malicious code.
The threat model in this paper is a remote attacker trying to hijack control of a machine by exploiting memory vulnerabilities.
Secure Part:
Insecure Part:
Searching among all ICS:
ap_run_dirwalk_stat()
contains pHook[n].pFunc
, which invokes a function pointer.
Apache HTTPD and Nginx
piped_log_spawn
use heap memory corruption vulnerability to corrupt an entry in the _hooks
structure’s link_dirwalk_stat
field to point to piped_log_spawn
.
use same vulnerability to corrupt the struct in the request_rec->finfo
field such that, when viewed as a piped_log
struct, the fields read_fd
and write_fd
are null, and the field program
points to a string with the name and arguments of the program we intend to invoke, such as /bin/sh -c ...
.
Short answer: No fine-grained CFI with CFG generated by static analysis.
Long story:
A precise CFG requires a pointer analysis to determine the set of functions to which the pointer at each indirect call site can point.
Challenges
_hooks
is a global struct variable in Apache HTTPD. Each filed of it contains an array of function pointers. For example, field link_dirwalk_stat
contains an array of function pointers to implementation functions of the functionality dirwalk_stat
.apr_array_push()
, apr_array_make()
._hooks
.Static Analysis Trade-offs
Precise(sound and complete) pointer analysis is undecidable[41], for languages with if statements, loops, dynamic storage, and recursive data structures.
If you could revise
the fundmental principles of
computer system design
to improve security...
... what would you change?