Skip to content

Commit 4157f3f

Browse files
committed
add posts for picoCTF!
1 parent 1dc3cdb commit 4157f3f

7 files changed

+346
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
---
2+
title: Obedient Cat
3+
date: 2025-07-08
4+
categories: [Capture The Flags, picoCTF]
5+
tags: [ctf, picoctf, misc, writeups]
6+
description: picoCTF Obedient Cat Challenge
7+
---
8+
9+
10+
> Challenge description:
11+
>
12+
>This file has a flag in plain sight (aka "in-the-clear").
13+
{: .prompt-info }
14+
15+
For this challenge, all you have to do is download the file and look inside it for the flag.
16+
17+
```terminal
18+
~/training/picoCTF/obedient-cat
19+
❯ wget https://mercury.picoctf.net/static/fb851c1858cc762bd4eed569013d7f00/flag
20+
--2025-07-08 17:38:50-- https://mercury.picoctf.net/static/fb851c1858cc762bd4eed569013d7f00/flag
21+
Loaded CA certificate '/etc/ssl/certs/ca-certificates.crt'
22+
Resolving mercury.picoctf.net (mercury.picoctf.net)... 18.189.209.142
23+
Connecting to mercury.picoctf.net (mercury.picoctf.net)|18.189.209.142|:443... connected.
24+
HTTP request sent, awaiting response... 200 OK
25+
Length: 34 [application/octet-stream]
26+
Saving to: ‘flag’
27+
28+
flag 100%[====================================>] 34 --.-KB/s in 0s
29+
30+
2025-07-08 17:38:50 (98.9 MB/s) - ‘flag’ saved [34/34]
31+
32+
33+
~/training/picoCTF/obedient-cat
34+
❯ ls
35+
 flag
36+
37+
~/training/picoCTF/obedient-cat
38+
❯ cat flag
39+
picoCTF{s4n1ty_v3r1f13d_28e8376d}
40+
```
41+
42+
FLAG: `picoCTF{s4n1ty_v3r1f13d_28e8376d}`
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
---
2+
title: Wave a flag
3+
date: 2025-07-08
4+
categories: [Capture The Flags, picoCTF]
5+
tags: [ctf, picoctf, misc, writeups]
6+
description: picoCTF Wave a flag Challenge
7+
---
8+
9+
10+
> Challenge description:
11+
>
12+
>Can you invoke help flags for a tool or binary? [This program](https://mercury.picoctf.net/static/a14be2648c73e3cda5fc8490a2f476af/warm) has extraordinarily helpful information...
13+
{: .prompt-info }
14+
15+
For this challenge we were given a 64-bit binary, so we'll pop it into `Ghidra` to see whats in the `main()` function.
16+
17+
```c
18+
void main(int argc,char **argv)
19+
20+
{
21+
int iVar1;
22+
char **argv-local;
23+
int argc-local;
24+
25+
if (argc == 1) {
26+
puts("Hello user! Pass me a -h to learn what I can do!");
27+
}
28+
else {
29+
iVar1 = strcmp(argv[1],"-h");
30+
if (iVar1 == 0) {
31+
puts(
32+
"Oh, help? I actually don\'t do much, but I do have this flag here: picoCTF{b1scu1ts_4nd_g r4vy_755f3544}"
33+
);
34+
}
35+
else {
36+
printf("I don\'t know what \'%s\' means! I do know what -h means though!\n",argv[1]);
37+
}
38+
}
39+
return;
40+
}
41+
```
42+
43+
And the flag's right there!
44+
45+
FLAG: `picoCTF{b1scu1ts_4nd_gr4vy_755f3544}`

_posts/2025-07-12-picoctf-bases.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
---
2+
title: Bases
3+
date: 2025-07-12
4+
categories: [Capture The Flags, picoCTF]
5+
tags: [ctf, picoctf, misc, writeups]
6+
description: picoCTF Bases Challenge
7+
---
8+
9+
10+
> Challenge description:
11+
>
12+
>What does this `bDNhcm5fdGgzX3IwcDM1` mean? I think it has something to do with bases.
13+
{: .prompt-info }
14+
15+
Alrighty, so we've been given a `base64` encoded string, and have to find out what it is. For this, we'll use both `echo` and `base64`.
16+
17+
`base64` has a decode flag, which is `-d`. It decoded and text passed through to it In order to do that we'll need to use `echo` to pipe the text through. We need to be careful, since `echo` adds a newline to the end of the string, so we'll use the `-n` flag to disable that.
18+
19+
Our final command looks like this:
20+
21+
```terminal
22+
❯ echo "bDNhcm5fdGgzX3IwcDM1" | base64 -d
23+
l3arn_th3_r0p35
24+
```
25+
26+
Add on the flag formatters, and we're all good to go!
27+
28+
FLAG: `picoCTF{l3arn_th3_r0p35}`
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: first grep
3+
date: 2025-07-12
4+
categories: [Capture The Flags, picoCTF]
5+
tags: [ctf, picoctf, misc, writeups]
6+
description: picoCTF first grep Challenge
7+
---
8+
9+
10+
> Challenge description:
11+
>
12+
>Can you find the flag in [file](https://jupiter.challenges.picoctf.org/static/495d43ee4a2b9f345a4307d053b4d88d/file)? This would be really tedious to look through manually, something tells me there is a better way.
13+
>
14+
{: .prompt-info }
15+
16+
Okay, so here we've been given a pretty big file, and we need to pull out the flag. Now, we know that the flag starts with `picoCTF`, but how can we find it quickly in a large file? Well, we use `grep`!
17+
18+
Now, you can use `grep` in one of two ways. We'll cover both here
19+
20+
## Way #1
21+
The first way is to only use `grep` by itself. The syntax is `grep [string to search for] [file]`.
22+
23+
```terminal
24+
❯ grep pico file
25+
picoCTF{grep_is_good_to_find_things_dba08a45}
26+
```
27+
## Way #2
28+
Now let's say you don't have a file, or you didn't like the first way for some reason. You can also use `cat` to send the file's contents to `stdout`, and pipe it into `grep`. Piping output to `grep` is useful is you're working with data not in a file, or trying to chain together a command.
29+
30+
31+
```terminal
32+
❯ cat file | grep pico
33+
picoCTF{grep_is_good_to_find_things_dba08a45}
34+
```
35+
36+
Either way, you get the flag!
37+
38+
FLAG: `picoCTF{grep_is_good_to_find_things_dba08a45}`
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
title: Magikarp Ground Mission
3+
date: 2025-07-12
4+
categories: [Capture The Flags, picoCTF]
5+
tags: [ctf, picoctf, misc, writeups]
6+
description: picoCTF Magikarp Ground Mission Challenge
7+
---
8+
9+
10+
> Challenge description:
11+
>
12+
>Do you know how to move between directories and read files in the shell? Start the container, `ssh` to it, and then `ls` once connected to begin. Login via `ssh` as `ctf-player` with the password, `abcba9f7`
13+
{: .prompt-info }
14+
15+
16+
For this challenge, it's pretty darn simple. Once you're in, use `cat` to read the part of the flag, and then use `cat` again to read the instructions for the next part of the flag. After you've done that, `cd` to where the instructions pointed you, and continue from there.
17+
18+
The process should look something like this:
19+
```terminal
20+
ctf-player@pico-chall$ ls
21+
1of3.flag.txt instructions-to-2of3.txt
22+
ctf-player@pico-chall$ cat 1of3.flag.txt
23+
picoCTF{xxsh_
24+
ctf-player@pico-chall$ cat instructions-to-2of3.txt
25+
Next, go to the root of all things, more succinctly `/`
26+
ctf-player@pico-chall$ cd /
27+
ctf-player@pico-chall$ ls
28+
2of3.flag.txt boot etc instructions-to-3of3.txt lib64 mnt proc run srv tmp var
29+
bin dev home lib media opt root sbin sys usr
30+
ctf-player@pico-chall$ cat 2of3.flag.txt
31+
0ut_0f_\/\/4t3r_
32+
ctf-player@pico-chall$ cat instructions-to-3of3.txt
33+
Lastly, ctf-player, go home... more succinctly `~`
34+
ctf-player@pico-chall$ cd ~
35+
ctf-player@pico-chall$ ls
36+
3of3.flag.txt drop-in
37+
ctf-player@pico-chall$ cat 3of3.flag.txt
38+
21cac893}
39+
```
40+
41+
FLAG: `picoCTF{xxsh_0ut_0f_\/\/4t3r_21cac893}`
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
---
2+
title: Python Wrangling
3+
date: 2025-07-12
4+
categories:
5+
- Capture The Flags
6+
- picoCTF
7+
tags:
8+
- ctf
9+
- picoctf
10+
- misc
11+
- writeups
12+
description: picoCTF Python Wrangling Challenge
13+
---
14+
15+
16+
> Challenge description:
17+
>
18+
>Python scripts are invoked kind of like programs in the Terminal... Can you run [this Python script](https://mercury.picoctf.net/static/2ac2139344d2e734d5d638ac928f1a8d/ende.py) using [this password](https://mercury.picoctf.net/static/2ac2139344d2e734d5d638ac928f1a8d/pw.txt) to get [the flag](https://mercury.picoctf.net/static/2ac2139344d2e734d5d638ac928f1a8d/flag.txt.en)?
19+
>
20+
{: .prompt-info }
21+
22+
For this challenge, we are given `ende.py`, `flag.txt.en`, and `pw.txt`
23+
24+
Let's look at each file we're given.
25+
26+
```python
27+
import sys
28+
import base64
29+
from cryptography.fernet import Fernet
30+
31+
32+
33+
usage_msg = "Usage: "+ sys.argv[0] +" (-e/-d) [file]"
34+
help_msg = usage_msg + "\n" +\
35+
"Examples:\n" +\
36+
" To decrypt a file named 'pole.txt', do: " +\
37+
"'$ python "+ sys.argv[0] +" -d pole.txt'\n"
38+
39+
40+
41+
if len(sys.argv) < 2 or len(sys.argv) > 4:
42+
print(usage_msg)
43+
sys.exit(1)
44+
45+
46+
47+
if sys.argv[1] == "-e":
48+
if len(sys.argv) < 4:
49+
sim_sala_bim = input("Please enter the password:")
50+
else:
51+
sim_sala_bim = sys.argv[3]
52+
53+
ssb_b64 = base64.b64encode(sim_sala_bim.encode())
54+
c = Fernet(ssb_b64)
55+
56+
with open(sys.argv[2], "rb") as f:
57+
data = f.read()
58+
data_c = c.encrypt(data)
59+
sys.stdout.write(data_c.decode())
60+
61+
62+
elif sys.argv[1] == "-d":
63+
if len(sys.argv) < 4:
64+
sim_sala_bim = input("Please enter the password:")
65+
else:
66+
sim_sala_bim = sys.argv[3]
67+
68+
ssb_b64 = base64.b64encode(sim_sala_bim.encode())
69+
c = Fernet(ssb_b64)
70+
71+
with open(sys.argv[2], "r") as f:
72+
data = f.read()
73+
data_c = c.decrypt(data.encode())
74+
sys.stdout.buffer.write(data_c)
75+
76+
77+
elif sys.argv[1] == "-h" or sys.argv[1] == "--help":
78+
print(help_msg)
79+
sys.exit(1)
80+
81+
82+
else:
83+
print("Unrecognized first argument: "+ sys.argv[1])
84+
print("Please use '-e', '-d', or '-h'.")
85+
86+
```
87+
{: file="ende.py" }
88+
89+
```plaintext
90+
gAAAAABgUAIV8D5MJdzgLLTkkMlbU84ARVwfX4brMt2rJQCjkpLItytfWVZe1L2dp4K8VrKgRU3axStKJEAqcM0iDaxiYE54Boh8UfAAo1RNifKnlDrFz0gLaznVSFVj2xAUa4V35180
91+
```
92+
{: file="flag.txt.en" }
93+
94+
```plaintext
95+
68f88f9368f88f9368f88f9368f88f93
96+
```
97+
{: file="pw.txt" }
98+
99+
Hm, looks like a python script, an encoded flag, and the password to decrypt said flag. Let's run the python script and see what the usage looks like.
100+
101+
```terminal
102+
❯ python ende.py
103+
Usage: ende.py (-e/-d) [file]
104+
```
105+
106+
Okay, so since we want to decrypt, lets use the `-d` flag, along with the `flag.txt.en` file.
107+
108+
```terminal
109+
❯ python ende.py -d flag.txt.en
110+
Please enter the password:
111+
```
112+
113+
Alrighty, and let's throw the password in that we got from the `pw.txt` file.
114+
115+
```terminal
116+
❯ python ende.py -d flag.txt.en
117+
Please enter the password:68f88f9368f88f9368f88f9368f88f93
118+
picoCTF{4p0110_1n_7h3_h0us3_68f88f93}
119+
```
120+
121+
FLAG: `picoCTF{4p0110_1n_7h3_h0us3_68f88f93}`
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
title: what's a net cat?
3+
date: 2025-07-12
4+
categories: [Capture The Flags, picoCTF]
5+
tags: [ctf, picoctf, misc, writeups]
6+
description: picoCTF what's a net cat? Challenge
7+
---
8+
9+
10+
> Challenge description:
11+
>
12+
>Using netcat (nc) is going to be pretty important. Can you connect to `jupiter.challenges.picoctf.org` at port `25103` to get the flag?
13+
{: .prompt-info }
14+
15+
`Netcat` is a nifty tool that lets you read/write data via network connections. It's definitely something important to learn on your cybersecurity journey.
16+
17+
In order to use it in its most basic sense, your command will look something like this:
18+
19+
```terminal
20+
nc [domain/IP address] [port]
21+
```
22+
23+
So, if we need to connect to `jupiter.challenges.pictoctf.org` on port `25103`, It should look as such:
24+
25+
```terminal
26+
❯ nc jupiter.challenges.picoctf.org 25103
27+
You're on your way to becoming the net cat master
28+
picoCTF{nEtCat_Mast3ry_d0c64587}
29+
```
30+
31+
FLAG: `picoCTF{nEtCat_Mast3ry_d0c64587}`

0 commit comments

Comments
 (0)