Privilege escalation via unfiltered role restoration in project backup import
The project backup import restored teams from the uploaded file without checking whether the roles they referenced were allowed on a project-scoped team, so a low-privilege user could attach a role carrying site-wide permissions. Because the permission lookup ignored the team's project scope, the attacker gained global permissions such as creating projects and workspaces, and potentially user management.
- Triaged in 5 hours
- Fixed in 10 days
- Disclosed after 43 days
Summary
Weblate's project backup import restores access-control teams from the backup file without validating the roles those teams reference. The web UI and API deliberately forbid attaching a role that carries a global (site-wide) permission to a project-scoped team — Role.objects.assignable_to_project_team() filters such roles out via without_global_permissions(). The backup restore path does not apply this restriction. As a result, a low-privilege user who can import a project backup can attach a global-permission role to a project-scoped team and thereby gain site-wide permissions they were never granted.
The escalation is amplified by a second issue: User.global_permissions collects a user's site-wide permissions from their team memberships without filtering on Group.defining_project. So a role carrying a global permission takes effect site-wide even when the team it belongs to is scoped to a single project.
Root cause weblate/trans/backups.py, ProjectBackup.restore_team() (line ~1995): group.roles.set(self.get_items_from_cache(self.roles_cache, team["roles"])) assigns roles with no assignable_to_team filter. weblate/auth/models.py, User.global_permissions: selects GLOBAL_PERM_NAMES from the user's membership groups without excluding groups that have a defining_project. Steps to reproduce Obtain a low-privilege account that can import a project backup — e.g. a user placed only in a workspace's "project creators" team. Confirm the account does not hold project.add or workspace.add (nor user.edit/management.use). Create a normal project backup, or take any valid backup zip. Edit weblate-backup.json inside the zip. Add one entry to the teams array with the attacker as a member and a global-permission role referenced by name: json { "name": "escalation", "roles": ["Add new projects"], "components": [], "language_selection": 1, "languages": [], "admins": [], "enforced_2fa": false, "members": ["<attacker-username>"], "autogroups": [] }
(For the stronger tier, reference a custom role that carries user.edit/management.use instead, assuming such a role exists on the target.) 4. Log in as the attacker and import the backup through the web UI (create-project-import): upload the zip, then confirm the import into the workspace. 5. After the import completes, the attacker's account holds the global permissions carried by the referenced role, site-wide. The injected team is created with defining_project set to the imported project, yet user.has_perm("project.add") (and, in the stronger tier, user.has_perm("user.edit")) returns True.
Proof of concept / verification
Verified against WeblateOrg/weblate at commit 03362ed6e6fec6c0bd9191a576e0b1173751d28f (2026-10-02), on PostgreSQL 17 with weblate.settings_test. The escalation is confirmed by reproduction tests that assert the escalation must not happen; all fail, each failure showing a low-privilege user holding site-wide permissions after the import.
- End-to-end web import, built-in role — a workspace project-creator, asserted beforehand to lack project.add/workspace.add, imports a backup through the create-project-import endpoint:
test_workspace_project_creator_gains_global_permissions AssertionError: Lists differ: ['project.add', 'workspace.add'] != [] : backup import granted global permissions ['project.add', 'workspace.add']
- End-to-end web import, custom role (stronger tier) — same low-privilege actor and HTTP path, with a custom role carrying user.edit/management.use present on the instance:
test_workspace_creator_import_does_not_grant_global_permissions AssertionError: Lists differ: ['management.use', 'user.edit', 'project.add', 'workspace.add'] != [] : Project backup restore granted site-wide permissions through a project-scoped team
- Direct restore path, custom role — confirms the same result via ProjectBackup.restore(), and treats a ValidationError on import as an acceptable secure outcome (the restore did not take that branch; it succeeded and escalated):
test_restore_does_not_grant_global_permissions AssertionError: Lists differ: ['management.use', 'user.edit', 'project.add', 'workspace.add'] != []
- Independent reproduction — a separate test, starting from a freshly created user with zero permissions and injecting the built-in role by name, re-fetches the user from the database and clears the permission cache before checking:
test_backup_restore_does_not_grant_site_wide_permission AssertionError: 'project.add' unexpectedly found in {'project.add', 'workspace.add'} : project-scoped backup team granted site-wide project.add (global_permissions ignores defining_project)
Each test confirms the low-privilege precondition with explicit assertFalse(user.has_perm(...)) checks before the attack, so the result cannot be an artifact of an over-provisioned test account. Tests 1–3 drive the restore through the real import flow; test 4 is an independent cross-check written from different assumptions. The two amplifying conditions in the root cause — restore_team not filtering roles, and global_permissions ignoring defining_project — are both exercised.
Impact
Any instance: a user who can import a backup gains site-wide project.add and workspace.add (create projects and workspaces anywhere on the instance). Instances with a custom role carrying user.edit / management.use (a common configuration): the user additionally gains those site-wide. user.edit ("Manage users") permits self-elevation to full administrator.
The backup references roles by name against the target instance's existing Role table, so the attacker can only pull in a privileged role that already exists on that instance — they cannot invent new permissions. This bounds the stronger tier to instances that have such a role defined.
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 restore code assigned roles from the backup without the assignable-to-team filter, and the global permission lookup did not exclude teams tied to a single project.
Impact
A user who can import a backup gains site-wide project.add and workspace.add, and on instances with a suitable custom role could also gain user.edit, which permits self-elevation to full administrator; the attacker can only pull in roles that already exist on the instance.
What the attacker needed
A low-privilege account that can import backups; ability to edit the backup zip contents; target role already exists on the instance
How it was found
- Get a low-privilege account that can import a project backup, such as a workspace project creator, and confirm it lacks the target permissions.
- Take a valid project backup zip and edit the backup JSON inside it.
- Add a team entry to the teams array that names the attacker as a member and references a role carrying a global permission.
- Log in as the attacker and import the edited backup through the web UI, confirming the import into the workspace.
- After the import, check that the attacker's account now holds the global permissions site-wide.
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 backup file can contain teams, and each team lists roles that grant permissions. The import trusted those role names without checking that the role was meant for a single project, and the permission check then treated the team as if it applied to the whole site. So someone with only a small amount of access could smuggle in a powerful role and end up with rights they were never given.
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.