Skip to main content

Research Repository

Advanced Search

Ret-gadgets in RISC-V-based Binaries Resulting in Traps for Hijackers

Oyinloye, Toyosi; Speakman, Lee; Eze, Thaddeus

Ret-gadgets in RISC-V-based Binaries Resulting in Traps for Hijackers Thumbnail


Authors

Toyosi Oyinloye

Thaddeus Eze



Abstract

The presence of instructions within executable programs is what makes the binaries executable. However, attackers leverage on the same to achieve some form of Control Flow Hijacking (CFH). Such code re-use attacks have also been found to lead to Denial of Service (DoS). An example of code re-use attack is Return Oriented Programming (ROP) which is caused by passing input crafted as chained sequences of instructions that are already existing as subroutines in the target program. The instructions are called gadgets and they would normally end with ret. The ret instructions enable the flow of hijacked execution from one set of instruction to another within the attacker’s control. There could however be exceptions depending on the structure of the chained gadgets where the chained gadget fails to run its course due to inability of specific gadgets to replace the value in the return address (ra) register. The dangers of chained gadgets are not a new idea but the possibility for an attacker’s gadget chain to fall into a trap during a ROP attack is not commonly addressed. In addition to this, recent studies have revealed that understanding the behaviours of gadgets would be useful for building information base in training machine learning (ML) models to combat ROP. This study explains the behaviour of certain ROP gadgets showing the possibility of occurrence of a loop in execution during exploitation. A sample program which accesses gadgets from the GNU C library (glibc) is used to demonstrate the findings. Gadgets identified with this possibility are poor for chaining as they do not contain instructions to load or move new values to the ra register and would produce unreliable exploits. This would result in a trap for the chained gadgets instead of arbitrary code execution, and DoS on the path of the user. This implies that the impact that a ROP chain could have on a targeted process does not only rely on the underlying system architecture but also relies on the structure of the chained gadget. In this paper, the RISC-V architecture is the focus, new gadget finders (scripts are available) are presented, and sample of chained gadgets are analysed on a RISC-V-based binary.

Presentation Conference Type Conference Paper (published)
Conference Name 18th International Conference on Cyber Warfare and Security
Start Date Mar 9, 2023
End Date Mar 10, 2023
Acceptance Date Jan 5, 2023
Online Publication Date Feb 28, 2023
Publication Date Mar 9, 2023
Deposit Date Mar 12, 2025
Publicly Available Date Mar 14, 2025
Journal International Conference on Cyber Warfare and Security
Print ISSN 2048-9889
Electronic ISSN 2048-9870
Publisher Academic Conferences and Publishing International
Peer Reviewed Peer Reviewed
Volume 18
Issue 1
Pages 291-299
DOI https://doi.org/10.34190/iccws.18.1.968
Keywords RISC-V; Return Oriented Programming; Denial of Service; Ret-gadgets; Code-reuse; Control Flow Hijack

Files






You might also like



Downloadable Citations