Skip to content

Commit f46e5d2

Browse files
committed
Fix lint
1 parent 2b96a52 commit f46e5d2

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

assets/scss/post.scss

+1
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@
8585
pre {
8686
overflow-x: auto;
8787
background-color: #272822;
88+
padding: 5px;
8889
}
8990

9091
ol {

content/blog/googlectf2024-auxin2/index.md

+10-4
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,21 @@ tldr: "codegolf uxntal assembly challenge"
1111
date: "2024-06-25T18:22:53+03:00"
1212
tags: [misc]
1313
summary: |
14-
We were given a ROM for the Varvara system running on Uxntal assembly. The ROM loads the provided shellcode into memory, checks if the lower 4 bits of each byte are not in [0, 2, 3, 6, 7, 0xe], and if true, executes it. The goal is to read the flag located at "flag".
14+
We were given a ROM for the Varvara system running on Uxntal assembly. The ROM loads the provided shellcode into memory, checks if the lower 4 bits of each byte are not in [0, 2, 3, 6, 7, 0xe], and if true, executes it. The goal is to read the flag located at `"flag"`.
1515
---
1616

1717
## Basics
1818

19-
We were given a ROM for the Varvara system running on Uxntal assembly. The ROM loads the provided shellcode into memory, checks if the lower 4 bits of each byte are not in [0, 2, 3, 6, 7, 0xe], and if true, executes it. The goal is to read the flag located at `flag`.
19+
We were given a ROM for the Varvara system running on Uxntal assembly. The ROM loads the provided shellcode into memory, checks if the lower 4 bits of each byte are not in [0, 2, 3, 6, 7, 0xe], and if true, executes it. The goal is to read the flag located at `"flag"`.
2020

2121
## The ROM
2222

2323
The provided script simply runs:
24+
2425
```python
2526
subprocess.run(['./uxncli', 'auxin2.rom', s], timeout=0.5, capture_output=True)
2627
```
28+
2729
and gives us the output. The [ROM](auxin2.rom) loads the provided hex-encoded code to address 0x1d0, checks the lower 4 bits of each byte, and executes it if they are not forbidden. Our output has to be <= 112 bytes.
2830

2931
## Shellcode Without Constraints
@@ -45,7 +47,9 @@ We communicate with the I/O through `DEO` and `DEI` to load the flag at a specif
4547

4648
## Initial Plan
4749

48-
After deliberation, we decided to write a self-modifying shellcode, where the last n bytes are the shellcode itself without forbidden bytes, and the prior bytes modify the shellcode to contain forbidden bytes. Here is the instruction table (forbidden instructions are marked in red): ![Opcode Table](opcode_table.webp)
50+
After deliberation, we decided to write a self-modifying shellcode, where the last n bytes are the shellcode itself without forbidden bytes, and the prior bytes modify the shellcode to contain forbidden bytes. Here is the instruction table (forbidden instructions are marked in red):
51+
52+
![Opcode Table](opcode_table.webp)
4953

5054
No `PUSH`, `POP`, `DEO`, `DEI`, or `DUP` are allowed. Luckily, most instructions in this assembly come with a `k` variant, meaning the instruction will execute but not pop values from the stack. Since the `INC` instruction is allowed, we come up with the following plan:
5155

@@ -75,7 +79,9 @@ LDA2k INC2 SWP2 STA2k
7579
The final step is to obtain the address 0x223 (where our shellcode to be changed starts). Luckily, one of our teammates comes up with a way to do so using the initial state of the stack ([02, 04]). All we have to do then is implement the [program](decoder.tal) and write a short [script](pepe.py) which substitutes the address we read from to (0x151 + offset) and uses one of the tricks on it if necessary. The Uxn binaries needed to run the script can be downloaded from [here](https://git.sr.ht/~rabbits/uxn).
7680

7781
## Flag
78-
CTF{Sorry__n0_Music_thi5_t1m3}
82+
83+
CTF{Sorry\_\_n0_Music_thi5_t1m3}
7984

8085
## Conclusion
86+
8187
A pretty interesting but relatively simple code golf challenge. Interestingly, the final program has only 3 or so bytes to spare, so we are quite close to the limit.

0 commit comments

Comments
 (0)