Kestrel
대시보드로 돌아가기
CVE-2026-55164MEDIUM· 4.9GHSA대응게시일: 2026. 06. 25.수정일: 2026. 06. 25.

Lemur user-update path stores plaintext passwords

위협 신호 · CVSS · EPSS · KEV

정기 패치· 높은 악용 신호 없음
CVSS
4.9medium

이론적 심각도 점수

EPSS

예측 데이터 없음

KEV
미등재

실측 악용 기록 없음

권장 대응 기한60일 이내CISA SSVC 기준

계획된 패치 주기 내 조치(60일 이내)

외부 노출· KEV 미등재 · 자동화 어려움 · 부분 영향 · 외부 노출

CVSS 벡터 · 메트릭

악용 경로
공격 벡터네트워크
공격 복잡도낮음
필요 권한높음
사용자 상호작용불필요
범위불변
영향
기밀성 영향높음
무결성 영향없음
가용성 영향없음
버전별 점수
CVSS 3.14.9MODERATE
CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:N/A:N

상세 설명

Summary

lemur.users.service.update() writes a user's new password as plaintext to the users.password column. The User model wires bcrypt hashing to SQLAlchemy's before_insert event but registers no equivalent listener for before_update, and service.update() does not call user.hash_password() after assigning the new value. Every password change performed through the admin-gated PUT /api/1/users/<id> endpoint persists the user's password to the database in cleartext.

Root Cause

lemur/users/models.py:

python
1# line 38
2class User(BaseModel):
3 __tablename__ = "users"
4 id = Column(Integer, primary_key=True)
5 password = Column(String(128)) # plain column, no setter, no Vault descriptor
6
7# line 74
8 def hash_password(self):
9 if self.password:
10 self.password = bcrypt.generate_password_hash(self.password).decode("utf-8")
11
12# line 111
13listen(User, "before_insert", hash_password) # only before_insert is wired

lemur/users/service.py:

python
1# line 46
2def update(user_id, username, email, active, profile_picture, roles, password=None):
3 ...
4 user = get(user_id)
5 user.username = username
6 user.email = email
7 user.active = active
8 user.profile_picture = profile_picture
9 if password:
10 user.password = password # raw assignment
11 update_roles(user, roles)
12 return database.update(user) # commits, no hashing

No before_update listener exists. User.password is a plain Column(String(128)) with no property setter that hashes on assignment. The bcrypt code path is bypassed entirely on every UPDATE statement that touches this column.

Affected Endpoints

MethodPathSource
PUT/api/1/users/<id>lemur/users/views.py:274 (gated by @admin_permission.require)

lemur/auth/views.py:323 also calls user_service.update() during SSO/OAuth login, but passes only six positional arguments. password defaults to None on that path and the if password: guard short-circuits. The bug is triggered only through the admin-only PUT handler.

Impact

When an administrator changes a user's password via PUT /api/1/users/<id>, the cleartext password is persisted to users.password. Subsequent login attempts for that user will fail (check_password calls bcrypt.check_password_hash against an unhashed value), pushing operators toward workarounds.

The more serious consequence is a defense-in-depth bypass. Bcrypt is the protection that prevents a database compromise from yielding usable credentials. With plaintext rows present, an attacker who exfiltrates the users table, a backup, a read replica, or query logs obtains directly usable login credentials — no offline cracking required. Because users reuse passwords across services, the blast radius extends beyond Lemur.

The bug specifically affects admin-driven password resets, which are the normal post-incident workflow and exactly when plaintext storage is most harmful.

Steps to Reproduce

  1. Install Lemur with default config. Create an admin user and a target user 'alice' (created via the standard flow, password will be hashed correctly on insert).

  2. Verify the initial hash:
    psql lemur -c "SELECT password FROM users WHERE username='alice';"

    Output: $2b$12$N9Q... (bcrypt hash, as expected)

  3. As admin, change alice's password via the API:
    curl -X PUT https://lemur.local/api/1/users/<alice_id>
    -H "Authorization: Bearer <admin_jwt>"
    -H "Content-Type: application/json"
    -d '{
    "username": "alice",
    "email": "alice@example.com",
    "active": true,
    "profile_picture": null,
    "roles": [{"name": "operator"}],
    "password": "ProofOfConcept_2026"
    }'

  4. Read the column again:
    psql lemur -c "SELECT password FROM users WHERE username='alice';"

    Output: ProofOfConcept_2026 ← plaintext, not hashed

  5. Confirm the failure mode: 'alice' can no longer log in with 'ProofOfConcept_2026'
    because check_password runs bcrypt.check_password_hash() against the cleartext column.

Remediation

Register the listener for both events:

bash
1# lemur/users/models.py
2listen(User, "before_insert", hash_password)
3listen(User, "before_update", hash_password)

Alternative, equivalent fix in the service layer:

bash
1# lemur/users/service.py, in update()
2 if password:
3 user.password = password
4 user.hash_password()

The listener fix is preferred because it closes the gap for any future code path that mutates user.password.

A one-time migration is recommended to detect and re-hash any rows already stored in cleartext. Bcrypt hashes begin with $2b$, $2a$, or $2y$. Any cleartext credential should be treated as compromised — rotate it, do not just re-hash it — since it has been at rest in plaintext and may exist in backups, audit logs, and replicas.

AI 심층 분석

공격 시나리오 · 재현 가능한 PoC 페이로드 · 즉시 적용 가능한 차단 패치를 한 번에 받아 보세요. 보안 운영팀이 그대로 점검·티켓팅에 쓸 수 있는 형태로 정리해 드립니다.