Abstract

During the software development developers often copy and paste fragments of code to achieve the desired result. Copying of code can lead to variety of errors, as well as can increase the size of the source and binary code. The problem of finding semantically similar pieces of code (clones) in binary code becomes actual due to the unavailability of source code of many software programs. The first part of the article is dedicated to the analysis of the existing methods for finding code clone in binary code. In the second part we provide a newly developed tool for finding code clones in binary code. The work of the tool is divided into three main stages. The first stage is based on the Binnavi [1] framework, which is responsible for generation of program dependence graphs (PDG). Program dependence graphs are generated using REIL (Reverse Engineering Intermediate Language). The usage of REIL language allows to generate graphs for multiple architectures (x86, x86-64, ARM, MIPS, PPC), thus providing the independence of the tool from the target architecture. In the second step code clones are found based on previously created graphs. Maximum common subgraph is built for each pair of graphs and based on it, code clones are detected. In the third stage, the detected clones are visualized for convenient analysis of the results.

Highlights

  • The first part of the article is dedicated to the analysis of the existing methods for finding code clone in binary code

  • In the second part we provide a newly developed tool for finding code clones in binary code

  • The first stage is based on the Binnavi [1] framework, which is responsible for generation of program dependence graphs (PDG)

Read more

Summary

Введение

Существует ряд методов поиска клонов кода, основанный на текстовом [2], лексическом [3], синтаксическом [4, 5, 6] и семантическом [6, 7, 8, 9, 10, 11, 12 13] анализе программы. В основном, все эти методы основаны требуют наличия исходного кода программы. Задача поиска клонов в бинарном коде мало изучена несмотря на то, что она является более важной с точки зрения поиска ошибок в программах, учитывая тот факт, что в основном программы распространяются без исходного кода. Первый тип – фрагменты кода, которые полностью совпадают. Второй тип – фрагменты кода, которые могут отличаться типами, значениями данных именами регистров. Третий тип – фрагменты кода, которые могут отличаться типами, значениями данных именами регистров, а также могут отличаться некоторыми инструкциями (в конкретном фрагменте могут присутствовать или отсутствовать некоторые инструкции). Клон второго типа от конкретного фрагмента отличается распределением регистра ecx в место eax. Клон третьего типа от конкретного фрагмента отличается распределением регистра ecx в место eax и отсутствием одной инструкции (imul eax, ebp+var_4])

Подходы поиска клонов в бинарном коде
Модель инструмента поиска клонов в бинарных файлах
Генерация ГЗП
Разделение ГЗП на подграфы
Анализ ГЗП графов
Фильтрация полученных клонов
Результаты
Дальнейшая работа
Заключение
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call