You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/ctfwriteups/examschedule.md
+56-1Lines changed: 56 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,4 +5,59 @@ ShowToc = false
5
5
author = ["connar"]
6
6
+++
7
7
8
-
Coming soon
8
+
## exams schedule writeup
9
+
This challenge provides us with an .xll file, which is basically a file used by excel as a plugin to add more functionalities, such as the one of code execution.
10
+
Thus, the .xll file must contain some code.
11
+
12
+
Running the command `file excel-εξεταστική.xll`, we might get a message saying `No such file or directory` because of the file name. Renaming it to any other name, for example `exceladdin`, we see it is a `PE32+ executable (DLL) (GUI) x86-64, for MS Windows`.
13
+
14
+
Searching more about this filetype (`xll`), we will find out it can be created by either C/C++ or with C#. In the case of C#, the analysis is much more simple as we can use tools such as ILSPy for its decompilation. Let's assume it is written in C# since this is a moer common case for xll files.
15
+
16
+
For the code retrieval we can do it either by using `pedump` ([see here how](https://connar.github.io/posts/weaponizing-xll-files/#reversing-samples-to-get-payloads)) or via a tool named `exceldna-unpack`. We will follow the second approach since its more direct.
17
+
18
+
### Step 1
19
+
We can download the tool from the releases of the following project:
Since the tool needs version .NET 5, if we dont have it installed, we can install it from [here](https://aka.ms/dotnet-core-applaunch?framework=Microsoft.NETCore.App&framework_version=5.0.0&arch=x64&rid=win-x64).
23
+
24
+
### Step 2
25
+
After installing it, we run the following command on the sample:
26
+
`exceldna-unpack.exe --xllFile=exceladdin.xll`
27
+
28
+
The result is a folder with the resources of that file:
29
+
```
30
+
λ exceldna-unpack.exe --xllFile=exceladdin.xll
31
+
Excel-DNA Unpack Tool, version 2.1.0+60b3d6031babfd276f540b95f9fb298c18342a00
32
+
33
+
Analyzing exceladdin.xll . . . OK
34
+
35
+
Extracting EXCELDNA.MANAGEDHOST.dll (ASSEMBLY) . . . OK
36
+
Extracting CRACK-SOLUTION.dll (ASSEMBLY_LZMA) . . . OK
37
+
Extracting EXCELDNA.INTEGRATION.dll (ASSEMBLY_LZMA) . . . OK
38
+
Extracting EXCELDNA.LOADER.dll (ASSEMBLY_LZMA) . . . OK
39
+
Extracting __MAIN__.dna (DNA) . . . OK
40
+
```
41
+
42
+
The name `CRACK-SOLUTION.dll` seems very sus, so running the command `file` to see what filetype it is, we find the following:
43
+
```
44
+
λ file CRACK-SOLUTION.dll
45
+
CRACK-SOLUTION.dll: PE32 executable (DLL) (console) Intel 80386 Mono/.Net assembly, for MS Window
46
+
```
47
+
48
+
So we are now in position to load it to ILSPy to see its code!
49
+
50
+
### Step 3
51
+
Opening the file inside ILSPy, we see it stores a huge b64 string as a zip, it then opens it and runs the file `rigged.bat` that exists inside that zip file.
After we download the file as a zip and open it, we will see lots of files, where if we search what these files are, we will find out they are related to xmrig - a cryptominer for xmr.
60
+
Opening the `rigged.bat`, we see it contains a weird string that seems like b64. Decoding it, we get the flag:
0 commit comments