공부/SPACE

SUCHAI-FS-Fuzzy-Testing 빌드 및 실행

JUNFUTURE 2024. 6. 5. 11:03

SUCHAI-FS-Fuzzy-Testing 을 이용해 칠레대학교의 위성 소프트웨어인 SUCHAI를 퍼징해본다.

SUCHAI-FS-Fuzzy-Testing 레포지토리는 주요 모듈들이 python으로 구현되어있어 별도의 빌드없이 편리하게 실행해볼 수 있다.

 

https://gitlab.com/tamigr.2293/SUCHAI-FS-Fuzzy-Testing

 

Tamara / SUCHAI-FS-Fuzzy-Testing · GitLab

GitLab.com

gitlab.com

 

pip dependency 설치

다음과 같은 디펜던시들을 설치해준다.

파이썬 모듈을 실행하기위해 필요한 디펜던시들이다.

pip install fuzzingbook
pip install markdown

 

 

suchai-fs-fuzzy-testing 설치 및 실행

아래 명령어를 이용해 git clone을 해준다.

git clone https://gitlab.com/tamigr.2293/SUCHAI-FS-Fuzzy-Testing

suchai-fuzz git repository

 

git clone 후에 디렉터리에 들어가보면 다음과 같은 파일들을 확인할 수 있다.

이때 run_experiment.py 를 실행해주면 되고 그냥 실행하면 아래와 같은 사용법을 마주할 수 있다.

그냥 run_experiment.py 실행시 결과

 

이에 아래와 같이 적절한 옵션을 주고 실행하면된다.

python3 run_experiment.py --csv_path CSV_report_jun --iterations 10000 --commands_number 10

 

이때 여기서 --iterations 변수에 있는 횟수만큼 퍼저가 작동한다.

이때 위와 같이 실행하게되면은 여러 오류를 마주할 수 있는데, 아래와 같이 해결할 수 있다.

 

 

Dummy-Folder 미존재 문제

처음실행하면 다음과 같이 Dummy-Folder를 못찾겠다는 오류가 뜬다.

이에 suchai-fuzz repository에 Dummy-Folder 디렉터리를 만들어주면 해결된다.

 

해결 : 

# SUCHAI-FS-Fuzzy-Testing repository로 이동
cd SUCHAI-FS-Fuzzy-Testing
mkdir Dummy-Folder

 

 

run_experiment.py 에 실행 경로 문제

run_experiment.py에 exec_dir exec_cmd 가 하드코딩되어있어 문제가 발생한다.

 

해결 : 

이에 run_experiment.py 에 있는 exec_dir exec_cmd 변수를

suchai를 설치한 위치로 적절히 잘 바꿔주면 잘 동작한다.

 

당연한 이야기지만 suchai-fuzz를 이용해 퍼징을 하려면 당연히 타겟 프로그램인 suchai가 있어야한다.

suchai 설치법은 아래와 같다.

https://juntheworld.tistory.com/193

 

SUCHAI (The Satellite of the University of Chile for Aerospace Investigation) 설치하기

The Satellite of the University of Chile for Aerospace Investigation (SUCHAI) 는 칠레대학교(Physics and Mechanical Engineering Departments of the Faculty of Physical and Mathematical Sciences (FCFM) at University of Chile)에서 만든 CubeSat 오픈

juntheworld.tistory.com

 

 

퍼저 실행완료

여기까지하면 퍼저가 잘 실행된다.

퍼저가 잘 실행되는 모습이다.

 

결과 확인 시에 오류

퍼징을 완료한 후 get_results_statistics.py 를 실행하면 또 오류가 발생하는데
해당 파이썬 안에 있는 하드코딩때문에 그렇다. 마찬가지로 경로를 아래와 같이 바꿔주자.

변경 전 (tamara가 누고)
변경 후 : 현재 디렉터리(SUCHAI-FS-Fuzzy-Testing)를 기점으로 상대경로로 바꿔주었다.