  Memory-safety attacks have been one of the most critical threats against
computing systems. Although a wide-range of defense techniques have been
developed against these attacks, the existing mitigation strategies have
several limitations. In particular, most of the existing mitigation approaches
are based on aborting or restarting the victim program when a memory-safety
attack is detected, thus making the system unavailable. This might not be
acceptable in systems with stringent timing constraints, such as cyber-physical
systems (CPS), since the system unavailability leaves the control system in an
unsafe state. To address this problem, we propose CIMA -- a resilient and
light-weight mitigation technique that prevents invalid memory accesses at
runtime. CIMA manipulates the compiler-generated control flow graph to
automatically detect and bypass unsafe memory accesses at runtime, thereby
mitigating memory-safety attacks along the process. An appealing feature of
CIMA is that it also ensures system availability and resilience of the CPS even
under the presence of memory-safety attacks. To this end, we design our
experimental setup based on a realistic Secure Water Treatment (SWaT) and
Secure Urban Transportation System (SecUTS) testbeds and evaluate the
effectiveness and the efficiency of our approach. The experimental results
reveal that CIMA handles memory-safety attacks effectively with low overhead.
Moreover, it meets the real-time constraints and physical-state resiliency of
the CPS under test.
