mediumCVSS 5.4Vulnerability

GHSA-vqv8-j3mj-wjxj

### Summary The `trainer_login` view in wger redirects to `request.GET['next']` directly via `HttpResponseRedirect()` without calling `url_has_allowed_host_and_scheme()`. After the trainer successfully enters impersonation mode, their browser is redirected to any attacker-controlled URL supplied in the `?next=` parameter, enabling Referer exfiltration and phishing. ### Details **File**: `wger/core/views/user.py`, approximately line 203 ```python # VULNERABLE - wger/core/views/user.py if not own: request.session['trainer.identity'] = orig_user_pk if request.GET.get('next'): return HttpResponseRedirect(request.GET['next']) # no host/scheme validation ``` After the impersonation logic succeeds, the view performs no validation of the `next` parameter before issuing the redirect. An attacker who can deliver a crafted link (e.g. `/en/user/2/trainer-login?next=https://evil.example/steal`) to a trainer can redirect the trainer's browser to any external host immediately after the impersonation session is established. The `Location` header contains the raw attacker-controlled URL. **Affected endpoint**: - `GET /en/user/<user_pk>/trainer-login` -> `wger.core.views.user.trainer_login` (the `?next=` redirect branch) **Suggested patch**: ```diff --- a/wger/core/views/user.py +++ b/wger/core/views/user.py +from django.utils.http import url_has_allowed_host_and_scheme + if not own: request.session['trainer.identity'] = orig_user_pk - if request.GET.get('next'): - return HttpResponseRedirect(request.GET['next']) + next_url = request.GET.get('next') + if next_url and url_has_allowed_host_and_scheme( + next_url, allowed_hosts={request.get_host()}, require_https=request.is_secure() + ): + return HttpResponseRedirect(next_url) return HttpResponseRedirect(reverse('core:index')) ``` Adding `@require_POST` to `trainer_login` (see also VULN-030) moves the `next` parameter to the POST body where CSRF protection applies an

Properties

ghsa_id
GHSA-vqv8-j3mj-wjxj
severity
medium
summary
wger: trainer_login open redirect - ?next= parameter not validated against host
cvss_score
5.4
cve_id
GHSA-vqv8-j3mj-wjxj
cvss_vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:C/C:L/I:L/A:N
is_ghsa_only
true
ghsa_published
2026-05-06T19:50:52Z
source_url
https://github.com/advisories/GHSA-vqv8-j3mj-wjxj
ghsa_updated
2026-05-06T19:50:57Z

Related Entities (4)

HAS_WEAKNESS (1)

[Weakness]URL Redirection to Untrusted Site ('Open Redirect')

REPORTED_BY (1)

[Source]GitHub Advisory Database

VULNERABLE_TO (1)

[Software]pip/wger

AFFECTS (1)

[Software]pip/wger

Explore deeper with Ninja Signal's threat intelligence graph

GHSA-vqv8-j3mj-wjxj (CVSS 5.4) — Ninja Signal Threat Intelligence | Ninja Signal