I found that Qiling Framework 1.1.3 has a directory traversal bug that an emulated code can write files outside of rootfs. When I executed a sample code emulation_test.py, files were written in the following locations outside of rootfs directory (C:\Users\User\Desktop\rootfs\x8664_linux).
Hello,
I found that Qiling Framework 1.1.3 has a directory traversal bug that an emulated code can write files outside of rootfs. When I executed a sample code emulation_test.py, files were written in the following locations outside of rootfs directory (C:\Users\User\Desktop\rootfs\x8664_linux).
Sample code (emulation_test.py)
Sample code (write-test.c)
Compilation of write-test.c (on WSL1)
Output of emulation_test.py
How to fix
It seems that convert_for_native_os(), convert_posix_to_win32(), and convert_win32_to_posix() that are called from convert_path() in qiling/os/utils.py should normalize a path (for example, converting from "/../test1.txt" to "/test1.txt") when it is concatenated with rootfs path.
Current convert_for_native_os() in utils.py: