Now the hex data in the array had been succesfully decoded.
Analysing the osascript
The decoded data seems to be an osascript. Basically a powershell but for Mac OS.
1
2
3
4
5
6
7
8
9
10
osascript -e \'
set release to true
set filegrabbers to true
if release then
...
...
continued
...
...
Looking through the script suggest that this malware is capable of stealing user credentials, accessing browser-related files like cookies and login databases, and encrypts files and manipulates directories.
There’s a function called encryptFlag(), as the name said, to encrypt flag.
This is how the function being called
1
encryptFlag(sussyfile, inputFile, outputFile)
sussyfile being declared as bangboo.png, which was mentioned earlier in this writeup.
flag.png was the original flag and flag.enc was the encrypted flag.
The encryptFlag() function uses AES CBC mode with the MD5 hash of bangboo.png as the key and the iv being the reversed string of the key
1
2
3
4
5
on encryptFlag(sussyfile, inputFile, outputFile)
set hexKey to (do shell script "md5 -q " & sussyfile)
set hexIV to (do shell script "echo \\"" & hexKey & "\\" | rev")
do shell script "openssl enc -aes-128-cbc -in " & quoted form of inputFile & " -out " & quoted form of outputFile & " -K " & hexKey & " -iv " & hexIV
end encryptFlag
Using the information retrieved, decrypt the flag.