wger is an open-source workout and gym-management application written in Django. Its multi-tenant authorization model scopes a gym manager's authority to the gym they manage, enforced by a line that shipped in nine handlers across two files: if request.user.userprofile.gym != user.userprofile.gym: return HttpResponseForbidden(). Public registration on a wger instance creates a user with gym=None. Orphaned gym managers, those whose gym record was deleted or whose group membership was set without a gym assignment, also have gym=None. In Python, None != None evaluates to False. The check does not deny. The reset_user_password handler generates a new password, calls user.set_password(password), and renders the plaintext into the HTTP response. CVE-2026-43948 was published April 28, 2026. The maintainer's first patch closed five callsites. The second patch, ten days later, closed four more, with a commit message containing the only honest word in the disclosure: "hopefully."
CVE-2026-43948: wger's Tenancy Check Treats No Gym As A Gym Everyone Shares
vendor
patterns
cve
proof of concept
None != None is False. That is the entire bug.
Before commit e1d329ff4, the password-reset handler at wger/gym/views/gym.py read like this:
def reset_user_password(request, user_pk):
"""
Resets the password of the selected user to random password
"""
user = get_object_or_404(User, pk=user_pk)
if not request.user.is_authenticated:
return HttpResponseForbidden()
if not request.user.has_perm('gym.manage_gyms') and not request.user.has_perm('gym.manage_gym'):
return HttpResponseForbidden()
if (
request.user.has_perm('gym.manage_gym')
and request.user.userprofile.gym != user.userprofile.gym
):
return HttpResponseForbidden()
password = password_generator()
user.set_password(password)
user.save()
context = {'mod_user': user, 'password': password}
return render(request, 'gym/reset_user_password.html', context)The third if is the tenancy gate. Read it as a prosecutor reads a defendant's prepared remarks. The check denies access "if the caller has manage_gym and the caller's gym is not the same as the target user's gym." When both sides are unset, the comparison evaluates None != None. Python's __ne__ on NoneType returns False. The gate does not fire. Control falls through to password_generator(), user.set_password(password), and the render call that hands the new credential back to the caller.
The patch replaced the comparison with a helper:
# wger/gym/helpers.py
def is_same_gym(user_a, user_b):
"""
Returns True only when both users are members of the same, non-null gym
"""
gym_a = user_a.userprofile.gym_id
gym_b = user_b.userprofile.gym_id
return gym_a is not None and gym_a == gym_bTwo changes. First, compare by gym_id, the integer foreign-key column, instead of by gym, the related model instance. Second, explicitly assert that the caller's gym_id is non-null before allowing any match. The first change is cosmetic for the bug we are describing; None != None is False on either form. The second clause is the fix. The original code intended to encode "two users are in the same gym," and the encoding it chose ("their gym fields are unequal") happens to be False for the case the check most wanted to exclude: two users who are in no gym at all.
The replacement helper has two lines, and the load-bearing one is the second. is_same_gym has to assert gym_a is not None because the developer cannot trust Python equality to mean tenancy. The bug was that the developer had been trusting it, in nine functions, for years.
The plaintext password is in the response by design
The handler does not generate a reset token. It does not mail a reset link. It does not write to a notification queue. It returns the new password as rendered template content:
context = {'mod_user': user, 'password': password}
return render(request, 'gym/reset_user_password.html', context)The template, added in 2015 in commit 0540bdaeb by a contributor named James Simas, is the entirety of the disclosure surface:
<tr>
<th>{% trans "User" %}</th>
<td>{{mod_user.get_full_name}} ({{mod_user}})</td>
</tr>
<tr>
<th>{% trans "Password" %}</th>
<td>{{password}}</td>
</tr>The sidebar copy that ships next to the table reads, in part: "Please notify the user of their new password." That is the design. The handler was written for the case where a trainer at a physical gym is helping a gym member who forgot their password, and reads the new password to them across a desk. The plaintext-in-response was a feature of the trainer-with-clipboard threat model. In that model, the requesting trainer is the trusted intermediary. The model does not survive a precondition where the requester is an orphaned gym manager invoking the endpoint over HTTP from somewhere outside the gym.
The 2015 commit message lists two known issues the author wanted to address before merge. "1. There is no confirmation dialogue for resetting the user's password, so if an admin clicks the link by accident, it will reset the password." "2. It's not translatable." Cross-tenant disclosure is not on the list. The author was thinking about UX and i18n; they were not thinking about what the response shape becomes when the calling trainer is not in the room.
The trainer-with-clipboard assumption lived in the template for eleven years before it was tested by someone who was not a trainer.
The first patch fixed five callsites. The second patch fixed four more.
The vulnerable comparison was not one handler. It was a copy-paste idiom across two Django apps. The replacement is also a copy-paste idiom, and it had to be applied nine times.
Roland Geider's first commit, e1d329ff4, landed on April 26, 2026, two days before the CVE was published. It replaced five comparisons with is_same_gym:
wger.gym.views.gym.reset_user_passwordwger.gym.views.gym.gym_permissions_user_editwger.core.views.user.trainer_loginwger.core.views.user.UserEditView.dispatchwger.core.views.user.UserDetailView.dispatch
The advisory the CVE was filed against names the first three. The other two are the maintainer's own audit-as-you-go work, the comparison grepped for and fixed where it was found. Each diff hunk is uniform: a.userprofile.gym != b.userprofile.gym becomes not is_same_gym(a, b).
Ten days later, on May 8, 2026, the maintainer pushed commit 635d1dc4 with the title "Properly (hopefully) check for all gym permission checks with helper function" and the body "This is necessary to correctly handle the gym=None case." That commit patched four more callsites that the first audit had missed:
wger.core.views.user.delete, the destructive account-delete handlerwger.core.views.user.UserDeactivateView.dispatchwger.core.views.user.UserActivateView.dispatchwger.core.views.user.UserDetailView.get_context_data, whereenable_login_buttonwas decided bysame_gym_id = request_user.userprofile.gym_id == page_user.userprofile.gym_id
Each of those four had the same bug. The delete handler's pre-patch condition was a four-line boolean chain in which the load-bearing line was or request.user.userprofile.gym_id != user.userprofile.gym_id. The same None != None collapse, on the same field, with the same outcome: an orphaned manager could delete the account of any publicly-registered user.
The CVE record covers only the handlers in the first patch. The other four were silent fixes shipped against the same root cause without a separate identifier. Defenders auditing against CVE-2026-43948 and version <= 2.5 will not see the second commit named in their tracker; they will see 2.6 as the patched version and trust the surface the CVE describes. The shape was the same. The fan-out was the codebase.
The maintainer wrote "(hopefully)" in the second commit's title because there is no static analyzer in the wger CI that says "this Python equality cannot return False when both sides are None." The audit was a grep run by a human, twice. The first run found five. The second run found four more. There is no procedure that will tell a defender there is not a tenth.
What "no gym" is
A wger instance with public registration creates new users with gym=None. That is the default state for the largest user population on every wger deployment that accepts sign-ups. An orphaned gym manager, whose gym record was deleted, or whose gym_manager group membership was set without a gym assignment, also has gym=None. The check the maintainer wrote, in nine places, declared None == None to be membership.
The exploit precondition is narrow on a properly-configured deployment, an attacker has to hold manage_gym permission AND have gym=None, and manage_gym is admin-granted, not public. The precondition is not narrow at all on the deployment shapes wger most commonly takes: single-instance self-hosted Django apps where a small admin team manages roles by hand, instances where a gym was created and later deleted, and instances run without any real gym infrastructure where the operator uses wger as a personal fitness tracker for friends. On each of those shapes, the population of users sharing the gym=None tenant is "almost everyone," and a single orphaned manager attacks the lot.
The response from the patched handler in the legitimate case is HTTP 200 with the plaintext password in the rendered HTML. The response from the pre-patch handler in the bypass case was also HTTP 200 with the plaintext password in the rendered HTML. There is no visible difference. The auth gate's only contribution to the response was deciding whether the body was that page or a 403. The body itself was unchanged.
The pattern
This is null-equals-null. A multi-tenant authorization check encoded as Python equality between two model fields that can both legitimately be None. The sentinel that means "no tenant" becomes the membership of a shared default tenant, and the check that was supposed to deny cross-tenant access waves through the population that lives in the sentinel.
The defender's playbook against this class is to never encode tenancy as raw equality. Either compare by a non-null assertion plus equality (the is_same_gym shape), or model the absent state as a distinct entity (a synthetic "no-tenant" sentinel row that participates in tenancy comparisons but denies every cross-call) so the equality check is between two real values rather than between two NoneTypes. The wger maintainer chose the first. The second commit's title says "(hopefully)" because the first option requires the helper to be invoked at every callsite, and the audit that confirms invocation everywhere is a human grep.
The deeper pattern is Design Debt Driver. The substrate is a Django model where userprofile.gym returns None for unassigned users, and the developer reaches for != without thinking about what that operator returns when both operands are None. The same copy-paste idiom shipped in nine functions across eleven years. Each instance was a CVE waiting for someone to test it with both gyms unset. The patch closes nine. The substrate ships unchanged.
PoC: GHSA-mhc8-p3jx-84mm
The CVE record names one handler. The fix had to be written nine times.