Project-scoped language_aliases reaches LanguageManager.auto_create() unvalidated, creating site-wide Language rows without language.add
A project-scoped setting, language_aliases, reaches LanguageManager.auto_create() without applying the LANGUAGE_CODE_RE validator, allowing a user with only project.edit to create a site-wide Language row with an invalid code. This causes the /languages/ and /api/languages/ pages to return HTTP 500 for all users.
- Fixed in 6 days
- Disclosed after 36 days
Summary
LanguageManager.auto_create() persists a Language through
QuerySet.get_or_create(), which never calls full_clean():
# weblate/lang/models.py:508
def auto_create(self, code: str, create: bool = True) -> Language:
name = f"{code} {GENERATED_SUFFIX}"
if create:
lang = self.get_or_create(code=code, defaults={"name": name})[0]
The LANGUAGE_CODE_RE validator on Language.code (lang/models.py:72) is
therefore not applied on that path.
A project's language_aliases reaches this sink. Its validator only counts
colons:
# weblate/utils/validators.py:432
for part in value.split(","):
if part.count(":") != 1:
raise ValidationError(gettext("Syntax error in language aliases."))
During sync, Component.get_language_alias() (component.py:7185) substitutes
the alias value and auto_get_or_create() persists it (component.py:5110).
sanitize_code() (lang/models.py:236) strips spaces, parentheses and
leading/trailing dots — not /, not interior ...
Affected versions
Confirmed on weblate/weblate:2026.10 (weblate --version = 6.0.9),
digest sha256:b0f200f38d70ed0db026ee969898b96dbeee5e9961b8c40ed05433e94354b4a8.
Both auto_create() and language_aliases are long-standing, so earlier
releases are likely affected, but I tested only this version and do not
assert a range.
Preconditions
A user with project.edit on one project who can:
- PATCH that project's
language_aliases - create a component in that project
The user is not a superuser and does not hold language.add.
Steps to reproduce
Place poc.sh and poc_compose.yml in the same directory, then:
docker compose -f poc_compose.yml up -d
# wait until GET http://localhost:8080/ returns 200 (~2 min)
chmod +x poc.sh
./poc.sh 2>&1 | tee poc_output.txt
The script prints the image digest and version first, creates its actors via
weblate shell, and performs every attack step over the public REST API.
My run is attached as poc_output.txt; the server-side error is in
server_log_excerpt.txt.
Authorization boundary demonstrated
attacker is_superuser = False
attacker has language.add = False
attacker has project.edit(own) = True
attacker has project.edit(vic) = False
POST /api/languages/ path-shaped code -> HTTP 403
POST /api/languages/ valid code "zz" -> HTTP 403
403 on both: the denial is the permission, not the value.
Vulnerable result
PATCH /api/projects/attproj/
{"language_aliases":"zzq9:../../../../tmp/pwn"} -> HTTP 200
POST /api/projects/attproj/components/ (ZIP: en.po, zzq9.po) -> HTTP 201
INVALID LANGUAGE ROWS: [(800, '/../../../tmp/pwn')]
translations: [('en',''), ('en',''), ('/../../../tmp/pwn','zzq9.po')]
/ HTTP 200
/projects/ HTTP 200
/languages/ HTTP 500
/api/languages/ HTTP 500
Server log:
NoReverseMatch: Reverse for 'show_language' with keyword arguments
{'lang': '/../../../tmp/pwn'} not found.
1 pattern(s) tried: ['languages/(?P<lang>[^/]+)/\Z']
Controls
Baseline before the attack: invalid rows: [], both endpoints HTTP 200.
Causality: deleting the row restores /languages/ and /api/languages/ to
200. The delete reports 8 objects — the row plus cascaded translation and
statistics records, not eight languages.
Negative test: the same alias technique against an existing language (ber)
changes nothing — name='Berber' population=17000000 before and after —
because fuzzy_get() matches the existing row before auto_create() is
reached. Only codes with no existing match can be created.
Patched control:
Language(code='../../../../tmp/pwn', name='x').full_clean()
-> rejected: ['Enter a valid language code.']
Expected behavior
Every path that creates a Language should apply LANGUAGE_CODE_RE. A
project-scoped setting should not write rows into the site-wide language
table that the documented, permission-gated route would reject.
Observed behavior
language_aliases passes its own validator, survives sanitize_code(), and
reaches get_or_create(), which writes the row without validation.
Recommended remediation
# weblate/lang/models.py
def auto_create(self, code: str, create: bool = True) -> Language:
validate_language_code(code) # raises ValidationError
name = f"{code} {GENERATED_SUFFIX}"
...
Validating both sides of each mapping in validate_language_aliases() would
close this entry point too, but the sink-level fix covers other callers of
auto_get_or_create().
Not a denial-of-service report
The program excludes DoS and I am not reporting one. The finding is the missing validation and the crossed permission boundary. The HTTP 500 is included only to show the write is not inert.
This matches a property in Weblate's own threat model: "Web authorization separates site, project, component, language, glossary ... permissions", violation symptom "User or token can read or mutate data outside assigned scope." I am not reporting that a project manager may edit project settings; I am reporting that doing so mutates global state outside their scope.
Prior issues and duplicate review
I found no GitHub security advisory or public report covering
language_aliases or LanguageManager.auto_create(). This is distinct from
CVE-2025-68398 (Git config overwrite) and CVE-2026-86035 (Mercurial argument
injection in HgRepository.get_file()).
Safety statement
Testing used only the official published container, an ephemeral tmpfs
PostgreSQL, and synthetic data I wrote, on a local stack I created and have
since removed with docker compose down -v. No Hosted Weblate instance,
third-party data, or credentials were involved. ../../../../tmp/pwn is a
string in a database column — no file was created, read, or written. I
reached no filesystem effect and claim none. The API tokens in
poc_output.txt belong to the destroyed container and are left unredacted so
the output is verifiable as produced.
Impact
A user holding only project.edit on one project writes a row into the
site-wide Language table — something the documented route denies them with
403 regardless of the value, and something the model's own validator rejects.
The demonstrated consequence is that /languages/ and /api/languages/
return 500 for every user of the instance, including unauthenticated ones.
Recovery requires removing the row; the language management UI is itself one
of the broken pages, so in practice an operator with shell or admin access is
needed.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the auto_create() method uses get_or_create() which bypasses model validation, and the language_aliases validator only checks for colons, not the language code format.
Impact
A user with only project.edit can create a site-wide Language row that causes /languages/ and /api/languages/ to return HTTP 500 for all users, including unauthenticated ones, and recovery requires shell or admin access.
What the attacker needed
A user with project.edit on one project; no language.add permission; ability to PATCH project settings; ability to create a component
The fix
The auto_create() method should call validate_language_code() before creating the Language row.
How it was found
- Start the Weblate container and wait for it to be ready.
- Create an attacker user with project.edit on one project but no language.add permission.
- PATCH the project's language_aliases with a path-shaped code.
- Create a component in the project with translation files.
- Observe that an invalid Language row is created and /languages/ returns HTTP 500.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A user who can edit one project's settings can change a language alias to a strange value. That value is saved as a new language for the whole site without being checked. The site's language pages then break and show errors for everyone.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.