Skip to content

Commit e26f42a

Browse files
committed
Adding dCTF 2021 and a writeup for web > Very secure website
1 parent 9a7338c commit e26f42a

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed

2021/dCTF/README.md

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# dCTF 2021
2+
3+
### Organizer Details
4+
5+
> The [DragonSec SI](https://dragonsec.si/si) [CTF](https://dctf.dragonsec.si) is a beginner to intermediate level CTF competition. With this CTF we want to introduce more people into the field of cybersecurity. It features web, crypto, rev, pwn, and misc challenges.
6+
7+
## HackThisSite Team
8+
9+
### Members
10+
11+
* [Kage](https://ctftime.org/user/71486)
12+
* yyy
13+
* [thirty2](https://ctftime.org/user/101731)
14+
15+
### Scoreboard Results
16+
17+
> 139th place out of 1287 teams, with a score of 2450 points
18+
19+
* [Scoreboard](https://dctf.dragonsec.si/scoreboard)
20+
* [HackThisSite Team](https://dctf.dragonsec.si/teams/203)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Very secure website
2+
3+
> Tags: web, php
4+
> Points: 200
5+
> Solves: 399
6+
7+
## Challenge Description
8+
9+
> Some students have built their most secure website ever. Can you spot their mistake?
10+
> http://dctf1-chall-very-secure-site.westeurope.azurecontainer.io/
11+
12+
## Analysis
13+
14+
We are given a link to a website (http://dctf1-chall-very-secure-site.westeurope.azurecontainer.io) which takes us to a simple login form that performs a GET call to `/login.php`. On that login form page, there's also this text:
15+
16+
> This is a very secure website, so we will also include the source code. Nobody will ever break it. It is the best.
17+
18+
The "source code" text links to a file (http://dctf1-chall-very-secure-site.westeurope.azurecontainer.io/source.php), which contains the following code:
19+
20+
```php
21+
<?php
22+
if (isset($_GET['username']) and isset($_GET['password'])) {
23+
if (hash("tiger128,4", $_GET['username']) != "51c3f5f5d8a8830bc5d8b7ebcb5717df") {
24+
echo "Invalid username";
25+
}
26+
else if (hash("tiger128,4", $_GET['password']) == "0e132798983807237937411964085731") {
27+
$flag = fopen("flag.txt", "r") or die("Cannot open file");
28+
echo fread($flag, filesize("flag.txt"));
29+
fclose($flag);
30+
}
31+
else {
32+
echo "Try harder";
33+
}
34+
}
35+
else {
36+
echo "Invalid parameters";
37+
}
38+
?>
39+
```
40+
41+
The first hash is easy enough to guess; it's `admin`. The second one, however, is a bit more difficult. But we don't need to run it through a password cracker like [John the Ripper](https://en.wikipedia.org/wiki/John_the_Ripper). Using a `==` comparitor operator in PHP has a long-known pitfall, known as "magic hashes." Thankfully, WhiteHat Security has [published a table](https://www.whitehatsec.com/blog/magic-hashes/) of magic hashes and a description about this `==` operator pitfall. Notably the only `tiger128,4` entry in this table has a magic hash number of `479763000`, and this works! Enter `admin` as the username and `479763000` as the password, and we get the flag: `dctf{It's_magic._I_ain't_gotta_explain_shit.}`

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
## CTFs We Participated In
66

7+
### 2021
8+
* [dCTF](https://dctf.dragonsec.si)
9+
710
### 2020
811
* [Hack-A-Sat Qualifier](https://www.hackasat.com)
912

0 commit comments

Comments
 (0)