Summary
Weblate's project backup import functionality allowed authenticated users with project creation permissions to load crafted JSON metadata that specified arbitrary repository URLs, including private network addresses and disallowed schemes.
Because model-level validation was bypassed, unvalidated repo URLs were persisted and later written directly into Git configuration, exposing the application to potential server-side request forgery (SSRF) and interaction with internal or non-HTTP resources.
Affected context
This issue occurs in Weblate's project backup import mechanism, specifically when restoring components from a ZIP archive that contains components/<name>.json files.
It affects deployments where:
- Authenticated users have the
project.addpermission (default on hosted Weblate SaaS for billing/trial users). - The import process persists component objects via
bulk_createwithout invoking model validators. - Git repositories are automatically configured using the URL stored in the component model, which is then written unchanged into
.git/config.
In such environments, a crafted backup file can introduce repository URLs pointing to internal services or using non-allow‑listed URL schemes.
Exploit preconditions
- Attack surface: Authenticated Weblate web interface, specifically the project backup import feature.
- Required access: Valid user account with
project.addpermission or equivalent capability to import projects. - User interaction: The attacker must upload and import a malicious project backup ZIP containing tampered
components/<name>.json. - Trigger point: During import, Weblate calls
Component.objects.bulk_create([component])[0], persisting the component without runningfull_clean(); later,configure_repo(pull=False)writes the unvalidated URL into.git/configand may interact with it. - Why exploitation is possible: Input validation logic (
validate_repo_url) is attached to the model but is bypassed by the use ofbulk_create, allowing arbitrary URLs to be stored and used by server-side Git operations.
Why this happens
The vulnerability stems from improper input validation (CWE-20) combined with trust in user-supplied configuration that ultimately drives server-side network operations (CWE-918).
Specifically, the model field for the repository URL relies on Django's validation (full_clean() and field validators such as validate_repo_url) to enforce allowed schemes and host patterns.
However, the import code path uses Component.objects.bulk_create([component])[0], which does not automatically invoke model validation methods.
As a result, attacker-controlled JSON from the imported backup can specify repo URLs pointing to internal IPs, loopback addresses, or using schemes like file:// or git://.
Since this URL is later consumed by Git configuration routines without additional checking, the application treats untrusted configuration as if it were already validated, enabling SSRF-style interactions with internal or otherwise restricted resources.
Potential impact
- Weblate may make outbound requests to attacker-chosen internal or private network addresses (SSRF), potentially exposing network topology or service behavior.
- Interaction with services bound to
127.0.0.1or other non-routable addresses that are not accessible from outside the host. - Misuse of non-HTTP or file-based schemes (e.g.,
file://,git://) that could lead to unauthorized local resource access or unexpected Git behavior. - Abuse of Weblate's network position to pivot deeper into an internal network or reach otherwise firewalled services.
- Potential leakage of metadata or errors that reveal internal service details or configurations.
General mitigation guidance
Mitigation typically focuses on enforcing consistent validation paths and hardening server-side network behavior:
- Ensure that all persistence paths for security-sensitive fields (such as repository URLs) invoke model or schema validation, even when using bulk operations.
- Centralize repository URL validation in a shared routine that is called explicitly before saving data from imports, APIs, or administrative tools.
- Apply strict allow-lists for URL schemes and host patterns used by backend systems, rejecting or normalizing anything outside this policy.
- Introduce a network-layer SSRF defense pattern (e.g., allow-listing outbound destinations or blocking access to loopback and private address ranges from application-level network calls).
- Limit what Git operations can access by running them under constrained accounts and with minimal filesystem and network privileges.
- Treat imported backups and migrations as untrusted input; apply the same or stricter validation as for interactive user input.
How teams detect issues like this
Detection revolves around both code-level analysis and runtime monitoring:
- Use static analysis or linters to flag calls to
bulk_create, direct ORMsave()calls, or custom import paths that bypassfull_clean()or equivalent validation layers, especially on fields that influence network or filesystem access. - During code review, pay particular attention to import, backup/restore, and admin utilities to confirm they reuse existing validation and normalization logic.
- Implement configuration or policy checks that prevent unsafe URL schemes or internal IP ranges from being used as repository endpoints.
- Monitor application logs for repository URLs referencing loopback addresses, private IP ranges, or unusual schemes; treat these as indicators of suspicious imports.
- Consider integrating application security testing tools that can model SSRF sinks (e.g., Git or HTTP clients) and trace back to user-controlled sources.

