Skip to content

Commit c5eba95

Browse files
committed
knightctf 2026 writeups
1 parent b85b13c commit c5eba95

17 files changed

Lines changed: 983 additions & 0 deletions

.direnv/flake-profile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
flake-profile-1-link

.direnv/flake-profile-1-link

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/nix/store/6jdvv1df7v9vmapy34hqlaryx565mf0h-nix-shell-env
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
+++
2+
title = 'Fuzzel as a menu'
3+
date = 2025-11-20 02:23:16+01:00
4+
slug = "fuzzel-as-a-menu"
5+
[taxonomies]
6+
tags = ["misc"]
7+
+++
8+
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
+++
2+
date = 2026-01-21
3+
description ="KnightCTF 2026 - Network 100 - Database Theft"
4+
title = "KnightCTF 2026 - Network 100 - Database Theft"
5+
[taxonomies]
6+
tags = ["ctf", "networking", "wireshark", "tshark"]
7+
+++
8+
## Task
9+
10+
```
11+
## Database Credentials Theft
12+
13+
### 100 Points
14+
15+
Author
16+
17+
The attacker's ultimate goal was to access our database. During the post-exploitation phase, they managed to extract database credentials from the compromised system. Find the database username and password that were exposed.
18+
19+
> Use pcap3.pcapng file to solve this challenge.
20+
21+
**Flag Format: KCTF{username_password}**
22+
23+
_**Author: TareqAhamed (0xt4req)**_
24+
```
25+
26+
## Tshark Dump
27+
28+
This was the easiest one so far.
29+
Since we know from previous task that reverse shell was running on 9576, lets only dump tcp stream from it, and convert it from hex to bin/ascii.
30+
That way we can basically see what the attacker was running in reverse shell:
31+
```bash
32+
tshark -r pcap3.pcapng -Y "tcp.port==9576" -T fields -e tcp.payload | xxd -r -p
33+
34+
```
35+
36+
Output:
37+
```bash
38+
www-data@ubuntu-server-2:/var/www/html/wordpress/wp-admin$ cd ..
39+
cd ..
40+
www-data@ubuntu-server-2:/var/www/html/wordpress$ ls
41+
ls
42+
index.php
43+
license.txt
44+
readme.html
45+
wp-activate.php
46+
wp-admin
47+
wp-blog-header.php
48+
wp-comments-post.php
49+
wp-config-sample.php
50+
wp-config.php
51+
wp-content
52+
wp-cron.php
53+
wp-includes
54+
wp-links-opml.php
55+
wp-load.php
56+
wp-login.php
57+
wp-mail.php
58+
wp-settings.php
59+
wp-signup.php
60+
wp-trackback.php
61+
xmlrpc.php
62+
.............
63+
www-data@ubuntu-server-2:/var/www/html/wordpress$ cat wp-config.php
64+
cat wp-config.php
65+
<?php
66+
/**
67+
* The base configuration for WordPress
68+
*
69+
* The wp-config.php creation script uses this file during the installation.
70+
* You don't have to use the website, you can copy this file to "wp-config.php"
71+
* and fill in the values.
72+
*
73+
* This file contains the following configurations:
74+
*
75+
* * Database settings
76+
* * Secret keys
77+
* * Database table prefix
78+
* * ABSPATH
79+
*
80+
* @link https://developer.wordpress.org/advanced-administration/wordpress/wp-config/
81+
*
82+
* @package WordPress
83+
*/
84+
85+
// ** Database settings - You can get this info from your web host ** //
86+
/** The name of the database for WordPress */
87+
define( 'DB_NAME', 'wordpress_db' );
88+
89+
/** Database username */
90+
define( 'DB_USER', 'wpuser' );
91+
92+
/** Database password */
93+
define( 'DB_PASSWORD', 'wp@user123' );
94+
95+
/** Database hostname */
96+
define( 'DB_HOST', 'localhost' );
97+
98+
/** Database charset to use in creating database tables. */
99+
define( 'DB_CHARSET', 'utf8mb4' );
100+
101+
/** The database collate type. Don't change this if in doubt. */
102+
define( 'DB_COLLATE', '' );
103+
104+
....................
105+
```
106+
107+
And, well, yes thats a password and username right there.
108+
109+
## Flag
110+
111+
Flag is: **KCTF{wpuser_wp@user123}**
112+
113+
![](/images/7a483ecec97a116e2f38fc8f665e5570.png)
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
+++
2+
date = 2026-01-21
3+
description ="KnightCTF 2026 - Network 100 - Post Exploitation"
4+
title = "KnightCTF 2026 - Network 100 - Post Exploitation"
5+
[taxonomies]
6+
tags = ["ctf", "networking", "wireshark", "tshark"]
7+
+++
8+
## Task
9+
10+
```
11+
## Post-Exploitation
12+
13+
### 100 Points
14+
15+
Author
16+
17+
After exploiting the vulnerability, the attacker established a persistent connection back to their command and control server. Analyze the traffic to identify the HTTP port used for the initial payload delivery and the port used for the reverse shell connection.
18+
19+
Download: [pcap3.pcapng](https://drive.google.com/file/d/1Xr1onCDIvTvMviH1k16mIjH2P2tfQZuq/view?usp=sharing)
20+
21+
**Flag Format: KCTF{httpPort_revshellPort}**
22+
```
23+
24+
25+
https://drive.google.com/file/d/1Xr1onCDIvTvMviH1k16mIjH2P2tfQZuq/view?usp=sharing
26+
27+
28+
## WireShark dump
29+
30+
Since it's wordpress in question, i assumed that shell was uploaded from that Social Warfare plugin we already figured out previously, which means by http.
31+
So i started filtering out by POST, GET and looking around, and it couldn't be more obvious:
32+
![](/images/2a7ba68a114d37e816a2f96a8b85285b.png)
33+
34+
This already gives us http port for payload **8786**, which is half the flag. Now we need to find reverse shell port, and to narrow it down we want to:
35+
36+
- look after timestamp of a payload, since revese shell can only be invoked after uploading obviously, in screenshot you can see timestamp: **882**
37+
`( frame.time_relative > 882)`
38+
39+
- `!(tcp.port==80 || tcp.port==8767)` - exclude port 80 and payload port 8786
40+
- `ip.src==192.168.1.102` - Only traffic from the victim.
41+
- `ip.dst==192.168.1.104` - Only traffic going to the attacker.
42+
43+
We will also filter multiple mentions of the same port number with sort -u :
44+
45+
```bash
46+
~/Vault/isec/ctf/knight2k26/net100-exploitation ✓ $ tshark -r pcap3.pcapng -Y "ip.src==192.168.1.102 && ip.dst==192.168.1.104 && tcp && frame.time_relative>882 && !(tcp.port==80 || tcp.port==8767)" -T fields -e tcp.srcport -e tcp.dstport | sort -u
47+
48+
9576
49+
50+
```
51+
52+
And there it is, reverse shell port **9576**
53+
54+
Note:
55+
You can filter with `sort | uniq -c` if you want to display number of packets sent and ephemeral port.
56+
## Flag
57+
58+
Flag is: KCTF{8767_9576}
59+
60+
![](/images/7be91c4aef1cc1f6451c0cd389d0ef49.png)

0 commit comments

Comments
 (0)