Skip to content

Commit 387b860

Browse files
committed
Updated solves
1 parent f98cf05 commit 387b860

File tree

8 files changed

+86
-21
lines changed

8 files changed

+86
-21
lines changed

dynamic/README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,39 @@
1-
# Workflow
1+
# Dynamic
2+
3+
## Solving
4+
5+
- Flag is 35 characters long, from the self modification
6+
7+
- Flag is encoded using the "ic..." sequence as key
8+
9+
### ![Extract Sequence and Encoded Flag](./6.png)
10+
11+
- Extract 35 rows of \x__ characters
12+
13+
- Characters with 'c' as key are bit subtracted by 0x47, while those with 'i' remain the same
14+
15+
- Decode characters using the above rule to obtain the flag
16+
17+
### ![Decode Flag](./7.png)
18+
19+
## Workflow
220

321
- Change file permissions to RWX, then to X when exited
422

5-
## ![Changing Binary Permissions](./4.png)
23+
### ![Changing Binary Permissions](./4.png)
624

725
- Check if binary is run by a debugger, then change strlen check in main() from 20 to 35
826

9-
## ![GDB Check](./1.png)
27+
### ![GDB Check](./1.png)
1028

1129
- Decode string using bit subtraction, then call DC() to load function dynamically
1230

13-
## ![Decode String and Call Loaded Function](./5.png)
31+
### ![Decode String and Call Loaded Function](./5.png)
1432

1533
- Finds function name within struct, and loads the function with the corresponding name
1634

17-
## ![Function loader](./3.png)
35+
### ![Function loader](./3.png)
1836

1937
- Call loaded function to validate input string using ty as the index
2038

21-
## ![Dynamically Loaded Function](./2.png)
39+
### ![Dynamically Loaded Function](./2.png)

dynamic/solve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
Guess the flag?
1111
iciicicciciicicicciciiciicciiciciic
1212
Correct
13-
<35 Rows of (OFFSET)\x__ Characters>
13+
<35 Rows of (OFFSET)0x__ Characters>
1414
"""
1515

1616
encoded_flag = f[f.find('Correct')+len('Correct'):][:35]

load/5.png

180 KB
Loading

load/6.png

19.2 KB
Loading

load/7.png

133 KB
Loading

load/README.md

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
1-
# Workflow
1+
# Load
2+
3+
## Solving
4+
5+
- call sym dbp() is a function that detects breakpoints when the binary is run within a debugger
6+
7+
### ![Decompiled binary](./5.png)
8+
9+
- Overwrite jump instruction to skip GDB check
10+
11+
### ![Overwrite ASM Instruction](./6.png)
12+
13+
- Use gdb to step through instructions till string compare function is called
14+
15+
- Stack is pushed to save the entire decoded flag when the loaded strcmp function is run, thus obtaining the flag
16+
17+
### ![Flag in Stack](./7.png)
18+
19+
## Workflow
220

321
- Strings are obfuscated via XOR, thus hidden from strings
422

5-
## ![Obfuscation technique](./1.png)
23+
### ![Obfuscation technique](./1.png)
624

725
- Compile library within /tmp/ file to hide files during runtime
826

9-
## ![Creation, Load, and Removal of Compiled Libary](./2.png)
27+
### ![Creation, Load, and Removal of Compiled Libary](./2.png)
1028

1129
- Load function within library
1230

13-
## ![Loaded Function Within Compiled Library](./3.png)
31+
### ![Loaded Function Within Compiled Library](./3.png)
1432

1533
- Call loaded function to validate input string
1634

17-
## ![Call Loaded Function](./4.png)
35+
### ![Call Loaded Function](./4.png)

rewrite/12.png

20.5 KB
Loading

rewrite/README.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,66 @@
1-
# Workflow
1+
# Rewrite
2+
3+
## Solving
4+
5+
- Encoded strings loaded as int arrays
6+
7+
### ![Encoded Strings](./9.png)
8+
9+
- Encoded flag loaded as int array
10+
11+
### ![Encoded Flag](./10.png)
12+
13+
- Encoded strings can be split by the differences in opcodes
14+
- eg. c745________ is a different int array compared to c785________
15+
16+
- Encoded strings tailer are the NULL character, which are 0x1A for the strings, and 0x56 for the flag
17+
18+
- XOR or bit addition/subtraction can be used to identify which is the encoding method
19+
20+
- By trial and error, bit subtraction is found to be the decoding method, thus bit addition is the encoding method
21+
22+
### ![Decode Function](./11.png)
23+
24+
- Extract the last character before the \x00 characters from each instruction to obtain the characters to form each string
25+
26+
- Similar to the encoded strings, only the bit offset is different (0x56 instead of 0x1A), which obtains the flag
27+
28+
### ![Output](./12.png)
29+
30+
## Workflow
231

332
- Strings are encoded via bit addition
433

5-
## ![Obfuscation technique](./1.png)
34+
### ![Obfuscation technique](./1.png)
635

736
- Concatenate initial string s from char array
837

9-
## ![Initial String](./2.png)
38+
### ![Initial String](./2.png)
1039

1140
- Fork process to thread functions
1241

1342
- Calculate pid, address and length of initial string, within the virtual memory of the primary process
1443

1544
- Write to pipe to transfer values to secondary process
1645

17-
## ![Calculate Important Values](./3.png)
46+
### ![Calculate Important Values](./3.png)
1847

1948
- Read from pipe and convert string values to integers
2049

21-
## ![Read Values from Primary Process](./4.png)
50+
### ![Read Values from Primary Process](./4.png)
2251

2352
- Secondary process to read /proc/{pid}/maps of primary process to ensure the heap of the primary process has the correct readable and writable permissions
2453

25-
## ![Read /proc/{pid}/maps](./5.png)
54+
### ![Read /proc/{pid}/maps](./5.png)
2655

2756
- Secondary process to read /proc/{pid}/mem of primary process, then overwrite a new string onto the same address of the initial string
2857

29-
## ![Read and Write to /proc/{pid}/mem](./6.png)
58+
### ![Read and Write to /proc/{pid}/mem](./6.png)
3059

3160
- Primary process prints the initial string, then parses the input string into the next string compare function while delaying for the secondary process to overwrite the initial string
3261

33-
## ![Validation Function](./7.png)
62+
### ![Validation Function](./7.png)
3463

3564
- Validates input string with overwritten string
3665

37-
## ![Strcmp Function](./8.png)
66+
### ![Strcmp Function](./8.png)

0 commit comments

Comments
 (0)