Docker-based CTF challenge reproducing Gitea 1.26.2 reverse proxy authentication trust misconfiguration, with automated flag setup and writeup for local practice.
This is a Docker-based CTF challenge for practicing the reverse proxy authentication trust configuration of Gitea 1.26.2.
Participants compare HTTP responses and craft request headers directly with curl to obtain the FLAG in a private repository.
Caution: This project is a practice environment intentionally configured to be vulnerable for educational purposes. Do not expose it directly to the internet; run it only in an isolated practice environment.
| Item | Details |
|---|---|
| Target | Gitea 1.26.2 |
| Topic | CVE-2026-20896 / Reverse Proxy Authentication |
| Challenge Type | Web / Docker-based CTF |
| Internal Service Port | 3000 |
| Local Access Port | 10017 |
| Supported Architectures | AMD64, ARM64 |
| Challenge Goal | View flag.txt in a private repository |
| Solution Method | HTTP request analysis via curl |
| Local Test FLAG | WINS{local_test} |
| GZCTF FLAG Format | WINS{[GUID]} |
This practice covers the trust boundary issue in the following configuration.
ENABLE_REVERSE_PROXY_AUTHENTICATION = true
REVERSE_PROXY_TRUSTED_PROXIES = *
In this configuration, the range of trusted proxies becomes excessively broad, so user identification headers can affect authentication.
CVE-2026-20896-Gitea-CTF/
├── challenge/
│ ├── Dockerfile
│ ├── entrypoint.sh
│ └── init-ctf.sh
├── docker-compose.yml
├── .env.example
├── .gitignore
├── README.md
└── WRITEUP.md
The role of each file is as follows:
Dockerfile: Builds the CTF image based on Gitea 1.26.2entrypoint.sh: Handles the FLAG environment variable and runs the initialization scriptinit-ctf.sh: Automatically creates accounts, private repositories, and FLAG filesdocker-compose.yml: Configures the local practice environment.env.example: Example environment variable configurationWRITEUP.md: Problem-solving process and walkthroughThe following programs must be installed in the Ubuntu environment.
You can check whether they are installed with the following command.
docker --version
docker compose version
git --version
curl --version
If a permission error occurs when running Docker commands, use sudo.
Run the following command in the terminal.
git clone https://github.com/Raincombat/CVE-2026-20896-Gitea-CTF.git
cd CVE-2026-20896-Gitea-CTF
Copy the example environment variable file.
cp .env.example .env
Edit the file.
nano .env
Set a local practice password in CTF_USER_PASSWORD.
CTF_USER_PASSWORD=YourLocalTestPassword123!
The values above are examples, so use different passwords in actual practice.
Do not upload the .env file to GitHub.
Validate the configuration file.
sudo docker compose config --quiet
Build the Docker image and run the container.
sudo docker compose up -d --build
Check the running status.
sudo docker compose ps
Gitea initialization may take some time.
Webpage access address:
The current Docker Compose configuration is as follows.
ports:
- "127.0.0.1:10017:3000"
Therefore, it can only be accessed directly from within Ubuntu.
If you are using an Ubuntu VM on a Windows host, you need to access it from a browser inside the Ubuntu VM or set up separate secure port forwarding.
When the container starts, the following process proceeds automatically.
FLAG or GZCTF_FLAG environment variable.ctfuser account.ctfuser/secret-project.flag.txt file in the private repository.Initialization completion marker path:
/data/gitea/.ctf-init-complete
Check the Gitea API response.
curl -i http://127.0.0.1:10017/api/v1/version
Check the initialization log.
sudo docker logs --tail 50 chal-2026-20896
Check the reverse proxy trust settings.