暗号化されたファイル fkduohv-d-jhvfklfnwhu-wr-gdun-dqjho-01.oodev と、実行可能ファイル zealotcrypt-01.exe が与えられた。
この実行可能ファイルをmain.main関数において、
main.findFilesWithExt関数で拡張子 .llabs のファイルを探し、main.encryptRc4関数で暗号化をしているようだった。
RC4は鍵から生成されたデータを平文にxorする暗号化形式なので、もし共通の鍵を用いてRC4で暗号化しているならば、もう1回暗号化すれば複号できるはずである。
そこで、まず実行した際の安全性を高めるため、os.Removeを呼び出している部分をNOPで埋めた。
すなわち、Ghidraの表示で005df723、ファイル中の位置で0x1DEB23バイト目 (0-origin) からの E8 98 C3 EC FF を、90 5個に書き換えた。
さらに、暗号化されたファイルを data.llabs という名前で同じディレクトリに置いて実行すると、復号結果のファイル gdwd.oodev が得られた。
この復号結果にflagが書かれていた。
An encrypted file fkduohv-d-jhvfklfnwhu-wr-gdun-dqjho-01.oodev and an executable file zealotcrypt-01.exe were given.
Decompiling the executable file via main.main searching for files with the extension .llabs using the function main.findFilesWithExt,
and encrypting the files via the function main.encryptRc4.
RC4 encrypts data by exclusive-oring data generated from the key to the plaintext, so another encryption will decrypt the data if the encryption is RC4 with a common key.
Firstly, I filled the part to call the function os.Remove with NOP to decrease the risk of executing the file.
In other words, I replaced E8 98 C3 EC FF, which is on 005df723 on Ghidra or 0x1DEB23-rd byte of the file (the first byte is 0th), with five 90s.
Then, I placed the encrypted data as a file data.llabs in the same directory as the executable and executed the patched executable.
As a result, a file gdwd.oodev that has the decrypted data appeared, and the flag was in the file.