Skip to content

Commit 9b170f0

Browse files
committed
fix: update link in Cyberspace
1 parent c891fde commit 9b170f0

1 file changed

Lines changed: 19 additions & 19 deletions

File tree

_posts/2024-09-02-Cyberspace-2024.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ img_path: /assets/img/CyberSpace-2024
88
image: banner.png
99
---
1010

11-
I played [CyberSpace 2024](https://ctftime.org/event/2428) this year with the team [epic merger](https://ctftime.org/team/349896) and got 5th place. We cleared the web category (including the sponsor challenge). Here's the writeups for the challenges that I've solve and my note on my teammate's solution for the challenges that I wasn't able to solve.
11+
I played [CyberSpace 2024](https://ctftime.org/event/2428){:target="_blank"} this year with the team [epic merger](https://ctftime.org/team/349896){:target="_blank"} and got 5th place. We cleared the web category (including the sponsor challenge). Here's the writeups for the challenges that I've solve and my note on my teammate's solution for the challenges that I wasn't able to solve.
1212

1313
## ZipZone
1414
**Solvers:** 173 <br>
1515
**Author:** rex
1616

17-
This was a beginner web challenge, the idea was to use the fact that we can zip a [symlink](https://en.wikipedia.org/wiki/Symbolic_link) and when upzipped, we can read that symlink which can point to any files on the system
17+
This was a beginner web challenge, the idea was to use the fact that we can zip a [symlink](https://en.wikipedia.org/wiki/Symbolic_link){:target="_blank"} and when upzipped, we can read that symlink which can point to any files on the system
1818

1919
Let's look at the code:
2020
```python
@@ -217,7 +217,7 @@ I will modify it to send a date that is 10 days into the future.
217217

218218
After that use ngrok to expose the port, and provide the address to `/release?debug=true` then it will give us the `access_granted` token.
219219

220-
Finally, it's just some basic [command injection](https://book.hacktricks.xyz/pentesting-web/command-injection) at `/feature`.
220+
Finally, it's just some basic [command injection](https://book.hacktricks.xyz/pentesting-web/command-injection){:target="_blank"} at `/feature`.
221221

222222
**Solve script**
223223
```python
@@ -286,7 +286,7 @@ func DisplayFlag(ctx *gin.Context) {
286286
```
287287
{: file="handlers/service/Posts.go" }
288288

289-
Yep, definitely a [TOCTOU](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use) problem.
289+
Yep, definitely a [TOCTOU](https://en.wikipedia.org/wiki/Time-of-check_to_time-of-use){:target="_blank"} problem.
290290

291291
We can see that the `CreatePost` function will call `CheckNoOfPosts` first then after a `while`, it will call `InsertPost`. In that time frame, we can send a bunch of request to create post at the same time and it will go past the 10 notes limit.
292292

@@ -372,7 +372,7 @@ Apparently the application use htmx for the front-end, so let's hit the document
372372
After reading the document for those attribute, we can find a very suspicious attribute `hx-vals`
373373

374374
![hx-val document](hx-vals.png)
375-
*[https://htmx.org/attributes/hx-vals/](https://htmx.org/attributes/hx-vals/)*
375+
*[https://htmx.org/attributes/hx-vals/](https://htmx.org/attributes/hx-vals/){:target="_blank"}*
376376

377377
That's litterally a free XSS, so we can do something like this and it will pop an alert.
378378
```html
@@ -455,7 +455,7 @@ server {
455455
}
456456
```
457457
{: file="nginx.conf" }
458-
Yep it was there all along, we can do path traversal to get the challenge binary with `/static../chall` and the admin's jwt with `/static../jwt.secret`. More on nginx alias misconfiguration [here](https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/nginx#alias-lfi-misconfiguration)
458+
Yep it was there all along, we can do path traversal to get the challenge binary with `/static../chall` and the admin's jwt with `/static../jwt.secret`. More on nginx alias misconfiguration [here](https://book.hacktricks.xyz/network-services-pentesting/pentesting-web/nginx#alias-lfi-misconfiguration){:target="_blank"}
459459

460460
To solve the first challenge, we just need to craft a admin session token with the `jwt.secret` and go to `/admin/dashboard` to get the secret post id and get the flag.
461461

@@ -511,7 +511,7 @@ on "download" do
511511
```
512512
{: file="app/server.rb" }
513513

514-
After reading the [rack](https://github.com/rack/rack/blob/main/lib/rack/request.rb#L414) source code, we can see that we can easily spoof our ip with `X-Forwarded-For` header since the line 418-420 is removed when building the docker image.
514+
After reading the [rack](https://github.com/rack/rack/blob/main/lib/rack/request.rb#L414){:target="_blank"} source code, we can see that we can easily spoof our ip with `X-Forwarded-For` header since the line 418-420 is removed when building the docker image.
515515

516516
`RUN patch /usr/local/bundle/gems/rack-3.1.7/lib/rack/request.rb < patch.txt`
517517
```plaintext
@@ -528,11 +528,11 @@ After reading the [rack](https://github.com/rack/rack/blob/main/lib/rack/request
528528
When try on local, using the `X-Forwarded-For` will indeed spoof our ip as 127.0.0.1, but the remote is different from local because it's deployed behind a load balancer, and that load balance will modify our `X-Forwarded-For` header before sending it to the real app.
529529

530530
![load balancer doc](gcp-load-balancer.png)
531-
*[Reference](https://cloud.google.com/load-balancing/docs/https#x-forwarded-for_header)*
531+
*[Reference](https://cloud.google.com/load-balancing/docs/https#x-forwarded-for_header){:target="_blank"}*
532532

533-
After hours of playing around with the `X-Forwarded-For` and other header without any result. One of my teammates - [Masamune](https://discord.com/users/538608747153588224). Found that this header will work: `Forwarded: for=127.0.0.1;`
533+
After hours of playing around with the `X-Forwarded-For` and other header without any result. One of my teammates - [Masamune](https://discord.com/users/538608747153588224){:target="_blank"}. Found that this header will work: `Forwarded: for=127.0.0.1;`
534534

535-
Based on the document: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded), `The alternative and de-facto standard versions of this header are the X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto headers.`
535+
Based on the document: [https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded){:target="_blank"}, `The alternative and de-facto standard versions of this header are the X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto headers.`
536536

537537
So that means that `X-Forwarded-For` is just another version of `Forwarded: for=<ip>`. That's a new knowledge for me.
538538

@@ -655,7 +655,7 @@ After the competition ended, the author revealed that the intended solution is t
655655

656656
`http://localhost:3000/?name=%0aalert()//%3C/script%3E&snippet=%3Cp%20id=%22%3C!--%3Cscript%3E%22%3E`
657657

658-
Reference: [https://creds.nl/2024-07-27-overlooked-xss-vector](https://creds.nl/2024-07-27-overlooked-xss-vector)
658+
Reference: [https://creds.nl/2024-07-27-overlooked-xss-vector](https://creds.nl/2024-07-27-overlooked-xss-vector){:target="_blank"}
659659

660660
That was a relatively new article, I'm still confused on why the browser will parse the script tag inside string. But I'll take note of this for future uses.
661661

@@ -743,7 +743,7 @@ Then pop goes the alert.
743743
**Solvers:** 9 <br>
744744
**Author:** GabeG888
745745

746-
This challenge was solved by [Masamune](https://discord.com/users/538608747153588224) after one of our teammmates gave an idea
746+
This challenge was solved by [Masamune](https://discord.com/users/538608747153588224){:target="_blank"} after one of our teammmates gave an idea
747747

748748
![quiz-idea](quiz-idea.png)
749749

@@ -845,7 +845,7 @@ while True:
845845
**Solvers:** 7 <br>
846846
**Author:** 0xM4hm0ud
847847

848-
This challenge was solved by [jeser](https://discord.com/users/293440719857909760) while I was sleeping, when I woke up and saw his payload, I was overwhelmed lol. But here's my analysis of the challenge.
848+
This challenge was solved by [jeser](https://discord.com/users/293440719857909760){:target="_blank"} while I was sleeping, when I woke up and saw his payload, I was overwhelmed lol. But here's my analysis of the challenge.
849849

850850
Here's his final payload for the challenge:
851851
```
@@ -871,7 +871,7 @@ And the flag file name is randomly generated so we have to find out the flag fil
871871
So we need to do `system('ls /')` first, but how?
872872
The character `/` is in the blacklist and the space character will need quotes, but it's also in the blacklist.
873873

874-
One way we can get those character is via [`dump()`](https://twig.symfony.com/doc/3.x/functions/dump.html) function and [`nl2br()`](https://twig.symfony.com/doc/3.x/filters/nl2br.html) filter, which return alot of character we can use.
874+
One way we can get those character is via [`dump()`](https://twig.symfony.com/doc/3.x/functions/dump.html){:target="_blank"} function and [`nl2br()`](https://twig.symfony.com/doc/3.x/filters/nl2br.html){:target="_blank"} filter, which return alot of character we can use.
875875

876876
If we send the payload like: `{% raw %}{{dump()|nl2br()}}{% endraw %}` we'll get the following output
877877
```
@@ -894,7 +894,7 @@ For the character `m` we can do this `{m:1}|keys|join()`.
894894
In order to join them together, Twig has a very convenient operator which is `~` that is not in the blacklist.
895895

896896
![twig tilde doc](twig-tilde.png)
897-
*Reference: [https://www.branchcms.com/learn/docs/developer/twig/operators](https://www.branchcms.com/learn/docs/developer/twig/operators)*
897+
*Reference: [https://www.branchcms.com/learn/docs/developer/twig/operators](https://www.branchcms.com/learn/docs/developer/twig/operators){:target="_blank"}*
898898

899899
Let's set those two as a variable first.
900900
```
@@ -934,7 +934,7 @@ Now we know that the flag file name is `flag-edbfcbcaef`. So we'll use the same
934934

935935
But there's a new character which we can't use the above technique for, it's the dash character `-`.
936936

937-
So we'll need to find another way to get it. Another way to get a lot of characters is via the global [`_charset`](https://twig.symfony.com/doc/3.x/templates.html#global-variables) variable.
937+
So we'll need to find another way to get it. Another way to get a lot of characters is via the global [`_charset`](https://twig.symfony.com/doc/3.x/templates.html#global-variables){:target="_blank"} variable.
938938

939939
If we send this `{% raw %}{{_charset}}{% endraw %}` to the server it will return `UTF-8`. There's the dash character that we need. So just extract it with `slice()` and `join()` like the others.
940940
```
@@ -970,7 +970,7 @@ All that's left is to chain them together to get the final payload, send them to
970970
**Solvers:** 6 <br>
971971
**Author:** Cybersharing
972972

973-
This challenge was solved by [LyC0nTriX](https://discord.com/users/1116855799659102309) in the last 5 minutes of the competition. This was more of a misc-guessing challenge more than a web challenge but it has a web tag so I'll include it here as well.
973+
This challenge was solved by [LyC0nTriX](https://discord.com/users/1116855799659102309){:target="_blank"} in the last 5 minutes of the competition. This was more of a misc-guessing challenge more than a web challenge but it has a web tag so I'll include it here as well.
974974

975975
The challenge gave us a picture with the following hints
976976
![Challenge picture](share-the-flag.png)
@@ -990,7 +990,7 @@ So I'll spin up a quick http server that can log headers information and send th
990990
As you can see, discord will send a request to that address with the user-agent: `Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)`.
991991

992992
So let's try to request `cybersharing.net` ourselves with that header and see what will be returned.
993-
We'll send a curl request with the header `User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)` to [https://cybersharing.net/history](https://cybersharing.net/history) since the first hint pointed to that.
993+
We'll send a curl request with the header `User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)` to [https://cybersharing.net/history](https://cybersharing.net/history){:target="_blank"} since the first hint pointed to that.
994994

995995
```console
996996
curl -H 'User-Agent: Mozilla/5.0 (compatible; Discordbot/2.0; +https://discordapp.com)' https://cybersharing.net/history
@@ -999,7 +999,7 @@ It'll return a bunch of html code, but if we look closely or use `grep` we can s
999999

10001000
![flag link](share-the-flag-flag.png)
10011001

1002-
Here's the link: [https://cybersharing.net/s/13f17b167f2229809a95fb9d8c725449](https://cybersharing.net/s/13f17b167f2229809a95fb9d8c725449)
1002+
Here's the link: [https://cybersharing.net/s/13f17b167f2229809a95fb9d8c725449](https://cybersharing.net/s/13f17b167f2229809a95fb9d8c725449){:target="_blank"}
10031003

10041004
Download it and get the flag.
10051005

0 commit comments

Comments
 (0)