Table of Contents
Fetching ...

Evolving Assembly Code in an Adversarial Environment

Irina Maliukov, Gera Weiss, Oded Margalit, Achiya Elyasaf

TL;DR

This work tackles the challenge of evolving Assembly code to survive in CodeGuru Xtreme's adversarial memory-arena setting using Grammar-Guided Genetic Programming with a domain-agnostic Assembly Backus-Normal-Form. Survivors are synthesized from scratch and evaluated against human-written top survivors, identifying weaknesses and exploiting them. Key contributions include integrating random PRNG patterns into the grammar, applying a machine-learning-based fitness approximation to speed training, and introducing memetic operators that combine local search with GP, yielding strong performance against past winners. The approach has practical implications for cyber-security, enabling analysis of code weaknesses and offering a platform to study adversarial code evolution and potential virus-like behaviors in a controlled setting.

Abstract

In this work, we evolve Assembly code for the CodeGuru competition. The goal is to create a survivor -- an Assembly program that runs the longest in shared memory, by resisting attacks from adversary survivors and finding their weaknesses. For evolving top-notch solvers, we specify a Backus Normal Form (BNF) for the Assembly language and synthesize the code from scratch using Genetic Programming (GP). We evaluate the survivors by running CodeGuru games against human-written winning survivors. Our evolved programs found weaknesses in the programs they were trained against and utilized them. To push evolution further, we implemented memetic operators that utilize machine learning to explore the solution space effectively. This work has important applications for cyber-security as we utilize evolution to detect weaknesses in survivors. The Assembly BNF is domain-independent; thus, by modifying the fitness function, it can detect code weaknesses and help fix them. Finally, the CodeGuru competition offers a novel platform for analyzing GP and code evolution in adversarial environments. To support further research in this direction, we provide a thorough qualitative analysis of the evolved survivors and the weaknesses found.

Evolving Assembly Code in an Adversarial Environment

TL;DR

This work tackles the challenge of evolving Assembly code to survive in CodeGuru Xtreme's adversarial memory-arena setting using Grammar-Guided Genetic Programming with a domain-agnostic Assembly Backus-Normal-Form. Survivors are synthesized from scratch and evaluated against human-written top survivors, identifying weaknesses and exploiting them. Key contributions include integrating random PRNG patterns into the grammar, applying a machine-learning-based fitness approximation to speed training, and introducing memetic operators that combine local search with GP, yielding strong performance against past winners. The approach has practical implications for cyber-security, enabling analysis of code weaknesses and offering a platform to study adversarial code evolution and potential virus-like behaviors in a controlled setting.

Abstract

In this work, we evolve Assembly code for the CodeGuru competition. The goal is to create a survivor -- an Assembly program that runs the longest in shared memory, by resisting attacks from adversary survivors and finding their weaknesses. For evolving top-notch solvers, we specify a Backus Normal Form (BNF) for the Assembly language and synthesize the code from scratch using Genetic Programming (GP). We evaluate the survivors by running CodeGuru games against human-written winning survivors. Our evolved programs found weaknesses in the programs they were trained against and utilized them. To push evolution further, we implemented memetic operators that utilize machine learning to explore the solution space effectively. This work has important applications for cyber-security as we utilize evolution to detect weaknesses in survivors. The Assembly BNF is domain-independent; thus, by modifying the fitness function, it can detect code weaknesses and help fix them. Finally, the CodeGuru competition offers a novel platform for analyzing GP and code evolution in adversarial environments. To support further research in this direction, we provide a thorough qualitative analysis of the evolved survivors and the weaknesses found.
Paper Structure (25 sections, 1 equation, 17 figures, 5 tables)

This paper contains 25 sections, 1 equation, 17 figures, 5 tables.

Figures (17)

  • Figure 1: The CodeGuru Xtreme game. On the left are the survivors; on the center is the code of the selected survivor; and on the right is the arena, i.e., the memory status. Each survivor gets a different color in the arena, representing its written bytes.
  • Figure 2: Part 1
  • Figure 3: Part 2
  • Figure 5: BlocksOfGuru (2021)
  • Figure 6: The memory image of BlocksOfGuru vs. best individuals from generations 206, 256, and 1,769. The scattered green and pink dots are memory bytes written by the 1,769 and 256 individuals, respectively. The concentrated yellow dots are memory bytes written by the 206 individual.
  • ...and 12 more figures