CVE-2026-138223 CRITICAL 10.0 난이도Difficulty 중급Intermediate

Databasement 토스트 헬퍼의 서버 측 Blade 템플릿 인젝션Server-side Blade template injection in Databasement's toast helper

공식 참조Official references: NVDCVE.org

CVE-2026-138223는 Databasement의 Improper Neutralization of Special Elements Used in a Template Engine(CWE-1336) 취약점으로, CVSS 10(CRITICAL)입니다. 영향 버전: ≤ 1.7.12. 수정 버전: 1.7.13.CVE-2026-138223 is an Improper Neutralization of Special Elements Used in a Template Engine (CWE-1336) vulnerability in Databasement, rated CVSS 10 (CRITICAL). Affected: ≤ 1.7.12. Fixed in: 1.7.13.

제품Product Databasement
영향 버전Affected ≤ 1.7.12
수정 버전Fixed in 1.7.13
심각도Severity CVSS 10 CRITICAL
취약점 유형Weakness CWE-1336 Improper Neutralization of Special Elements Used in a Template Engine
공격 조건Attack conditions 원격 (네트워크) · 인증 불필요 · 사용자 상호작용 불필요Remote (network) · No authentication · No user interaction

1. TL;DR

Databasement는 셀프 호스팅 데이터베이스 백업 관리 도구다. 버전 1.7.12까지는 app/Traits/Toast.php의 헬퍼가 토스트의 icon 값을 사용해 Blade 템플릿 문자열을 만들었고, 서버는 그 문자열을 컴파일해 실행했다. 권고문에 따르면 이 헬퍼 메서드들은 public이어서 프레임워크가 이를 클라이언트가 호출할 수 있는 액션으로 노출했다. 따라서 신뢰할 수 없는 호출자가 템플릿 싱크에 도달할 수 있었다. 권고문은 그 결과가 애플리케이션 사용자 권한의 임의 PHP 실행이라고 밝힌다. 수정은 v1.7.13(PR #605)에 반영되었다. 이 수정은 헬퍼를 클라이언트 호출 가능 영역에서 제외하고, 아이콘을 템플릿 소스가 아니라 바인딩된 데이터로 전달한다. 호스팅 중인 인스턴스라면 먼저 업그레이드한 뒤 인스턴스에 저장된 시크릿을 교체해야 한다.

2. Flaw 분류

항목값
주요 CWECWE-1336, 템플릿 엔진에 사용되는 특수 요소의 부적절한 무력화. NVD는 CWE-791도 함께 기재한다. GitHub 권고문은 CWE-94와 CWE-862도 추가로 기재한다(REVIEW_NOTES 참조).
제품 / 구성 요소David-Crty Databasement, app/Traits/Toast.php, 함수 toast, 인자 icon (Toast Notification Helper)
영향 버전NVD와 VulDB 기준 1.7.12까지. 권고문 메타데이터도 일치하며, 본문에는 “before 1.7.14”라고 되어 있다.
공격 벡터네트워크. 웹 애플리케이션의 Livewire 컴포넌트 요청을 통해 도달한다.
선행 조건비인증 경로에는 없음. 권고문은 공개 페이지 하나가 인증 없이 싱크를 노출한다고 밝힌다. 다른 경로는 최저 권한을 포함해 로그인한 모든 역할로 동작한다.
영향애플리케이션 사용자 권한의 코드 실행. 데이터베이스 비밀번호, SSH 키, 오브젝트 스토어 시크릿 등 Databasement가 관리하는 자격 증명이 노출되며, 백업을 읽거나 변경할 수 있다.
CVSSNVD / 작업 데이터: 10.0 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H). GitHub 권고문: 9.8 (S:U).

3. 근본 원인

데이터가 템플릿 소스가 되었다

권고문에 따르면 호출자가 제어하는 값인 토스트 아이콘이 Blade 템플릿 문자열에 이어 붙여졌고, 서버는 그 문자열을 컴파일해 실행했다. 이 약점은 전형적인 서버 측 템플릿 인젝션(SSTI) 패턴이다. 동적 텍스트를 변수로 전달하지 않고 템플릿 자체를 만드는 데 사용한다. 권고문은 근본 원인을 런타임 입력을 데이터로 바인딩하지 않고 그 입력으로 Blade 템플릿을 구성한 것이라고 설명한다.

아이콘을 표시하는 두 가지 방식을 비교하면 다음과 같다.

  • 안전하지 않음: template = "<x-icon name='" + userValue + "' />"로 만든 뒤 template을 컴파일하고 렌더링한다. 사용자 값이 템플릿 문법으로 파싱된다.
  • 안전함: 템플릿은 고정해 두고 userValue를 속성으로 전달한다. 엔진은 이 값을 문자열로 취급하며 지시문으로 해석하지 않는다.

신뢰할 수 없는 호출자가 도달할 수 있었던 이유

싱크에 도달하려면 두 조건이 함께 필요했다. 권고문에 따르면 헬퍼가 public이어서 Livewire가 이를 클라이언트가 호출할 수 있는 컴포넌트 액션으로 취급했다. 또한 권고문은 Livewire 업데이트 요청 중 메서드 호출 부분이 컴포넌트 스냅샷 무결성 검사의 보호를 받지 않는다고 말한다. 메서드 호출에 관한 이 주장은 벤더 자신의 진술이다(REVIEW_NOTES 참조). 일반적으로 Livewire 컴포넌트의 public 메서드는 브라우저에서 호출되도록 설계되어 있다. 따라서 서버 측 코드에서만 호출되어야 했던 헬퍼가 클라이언트 측에서도 호출 가능했다.

PR #605도 같은 내용을 말한다. 토스트 헬퍼는 해당 트레이트를 사용하는 모든 컴포넌트에서 public이었지만, 실제로는 컴포넌트 자신의 액션에서만 호출되었다.

4. 익스플로잇 흐름(개념)

아래 순서는 개념 수준에 머문다. 벤더는 개념 증명(PoC)을 공개하지 않았으며, 이 문서도 구체적인 입력을 제시하지 않는다.

  1. 토스트 트레이트를 사용하는 컴포넌트를 찾는다. 해당 트레이트를 사용하는 모든 Livewire 컴포넌트는 헬퍼가 클라이언트 대면 메서드 영역에 포함된다.
  2. 서버에 헬퍼 호출을 요청한다. 공격자는 실행할 액션으로 헬퍼를 지정한 컴포넌트 업데이트 요청을 보낸다. 권고문에 따르면 이 요청의 메서드 호출 부분은 무결성 보호를 받지 않는다. 공격자는 icon 인자 값도 직접 지정한다.
  3. 헬퍼가 템플릿 문자열을 만든다. 공격자의 값이 Blade 소스에 이어 붙여지므로, 공격자의 텍스트가 템플릿의 일부가 된다.
  4. 서버가 이를 컴파일하고 렌더링한다. Blade는 템플릿 문법을 PHP로 변환해 실행한다. 그러면 공격자가 고른 로직이 애플리케이션의 PHP 프로세스에서 실행된다.
  5. 영향. 코드가 애플리케이션 사용자 권한으로 실행된다. 애플리케이션의 키와 암호문을 읽고 저장된 자격 증명을 복호화할 수 있다.
  1. 클라이언트에서 헬퍼 호출 — public Livewire 메서드
  2. icon이 Blade 소스에 결합됨
  3. 서버가 템플릿 컴파일
  4. 공격자가 영향을 준 PHP 실행
  5. 코드 실행 및 자격 증명 노출
개념 흐름도 — 실행 가능한 페이로드가 아닙니다

5. 트리거 조건

  • 버전: NVD와 VulDB 기준 Databasement 1.7.12까지. 권고문은 어떤 설정 변경으로도 영향받는 버전이 안전해지지 않는다고 말한다.
  • 네트워크 접근: 인스턴스의 웹 인터페이스에 접근할 수 있어야 한다. 권고문은 공개 페이지 하나를 통해 비인증 호출자가 싱크에 도달할 수 있고, 이후에는 로그인한 모든 역할이 도달할 수 있다고 밝힌다. 권고문은 그 공개 페이지가 무엇인지 명시하지 않는다(공개 출처에서 확인되지 않음).
  • 초대: 권고문은 수락되지 않은 채 남아 있는 초대가 영향받는 버전에서 실제 익스플로잇 벡터이며, 초대 토큰은 만료되지 않는다고 말한다. 정확한 메커니즘은 공개 출처에서 확인되지 않는다(REVIEW_NOTES 참조).
  • 사용자 상호작용은 필요 없으며, 선행 조건으로 언급된 특수 설정도 없다.

6. 패치 분석

실제 diff는 확보하지 못했다. 커밋 페이지가 속도 제한 오류를 반환했으므로 이 섹션은 개념 수준이다. PR #605 설명과 권고문의 해결 방법 텍스트를 바탕으로 하며, 이 출처들이 밝힌 내용 이상의 코드는 언급하지 않는다.

패치는 v1.7.13에 포함된 커밋 713f71f5336663493e8c4dc07e7f3e96a291775b이다. v1.7.13 릴리스 노트에는 PR #605, “fix(security): keep the toast helpers out of the component public API”가 나열되어 있다. 이 변경은 익스플로잇 흐름을 두 지점에서 끊는다.

  1. 클라이언트 호출 가능 영역 축소. PR #605에 따르면 토스트 헬퍼는 이제 protected이며, 각 컴포넌트의 클라이언트 대면 메서드를 노출하려는 의도에 해당하는 것으로만 제한한다. 이는 흐름의 2단계를 끊는다. 브라우저가 서버에 헬퍼를 직접 호출하도록 요청할 수 없다.
  2. 템플릿 결합 제거. PR #605에 따르면 아이콘은 이제 렌더링되는 Blade 문자열에 이어 붙여지지 않고, 바인딩된 값으로 Mary 아이콘 컴포넌트에 전달된다. 이는 3단계의 인젝션 싱크를 없애므로, 조작된 icon도 단순한 데이터로 남는다. 권고문은 아이콘이 엄격한 허용 목록에 대해 검증된다고 덧붙인다. PR의 릴리스 노트 요약에는 아이콘 값이 지원되지 않을 때 표준 정보 아이콘으로 대체한다는 내용도 있다.

첫 번째 변경만으로는 같은 패턴을 쓰는 헬퍼의 다른 호출부가 남고, 두 번째 변경만으로는 헬퍼가 여전히 도달 가능하다. 권고문은 이 수정이 두 조건을 모두 다룬다고 설명한다.

헬퍼를 protected로 바꾼 데 따른 부수 효과도 있다. Alpine 클립보드 토스트 6개가 $wire.success()를 직접 호출했는데, 이제는 app.js의 작은 successToast() 헬퍼를 사용한다. 이 헬퍼는 서버 왕복 없이 토스트를 렌더링한다.

7. 탐지·완화

즉시 조치

  • v1.7.13 이상으로 업그레이드한다. 권고문 텍스트에는 “v1.7.14 or later”라고 되어 있으므로 가장 최신 릴리스를 사용한다(REVIEW_NOTES 참조).
  • 아직 업그레이드할 수 없는 경우: 권고문은 수락되지 않은 초대를 모두 취소하고, 네트워크 접근을 신뢰할 수 있는 운영자로 제한하라고 권고한다.
  • 인스턴스가 노출되었다면 침해된 것으로 간주한다. 권고문은 침해된 인스턴스가 복호화할 수 있었던 모든 시크릿을 노출된 것으로 보고 교체하라고 말한다. 여기에는 관리 대상 데이터베이스 자격 증명, SSH 키, 오브젝트 스토어 시크릿이 포함된다.

탐지

  • 설치된 버전이 1.7.12 이하인지 확인하거나, app/Traits/Toast.php에 public 헬퍼 메서드가 남아 있고 인자로 Blade 소스를 만드는지 확인한다.
  • 공개 페이지나 저권한 페이지에서 토스트 관련 메서드를 호출하는 비정상적인 Livewire 업데이트 요청이 있는지 웹 서버 및 애플리케이션 로그를 검토한다. 권고문은 침해 지표(IoC)를 공개하지 않았다(공개 출처에서 확인되지 않음).
  • 애플리케이션 사용자 권한으로 실행되는 예상치 못한 프로세스, 새 파일, 외부로 나가는 연결이 있는지 찾고, 저장된 자격 증명이 설명할 수 없는 방식으로 사용되었거나 백업 스토리지가 변경되었는지 확인한다.
  • 개발자용: 요청에서 유래한 값으로 조립한 Blade 또는 기타 템플릿 문자열(문자열 결합으로 값을 넣는 Blade::render 유형의 호출)이 자체 코드에 있는지 검색한다. 또한 Livewire 컴포넌트의 어떤 public 메서드가 클라이언트에서 호출될 수 있는지도 점검한다.

격리된 실습(로컬 Docker 랩)

재현은 인터넷과 격리된 로컬 Docker 랩에서만 해야 한다. 직접 소유하지 않았거나 테스트 권한이 없는 시스템에는 절대 테스트하지 않는다.

  • 영향받는 릴리스(≤ 1.7.12)를 외부로 나가는 경로가 없는 내부 전용 네트워크의 컨테이너에서 실행하며, 실제 자격 증명은 넣지 않는다.
  • 랩은 개념을 익히는 용도로 사용한다. 어떤 컴포넌트 메서드가 클라이언트에서 호출 가능한지 살펴보고, 변수로 만든 템플릿 소스와 바인딩된 속성을 쓰는 고정 템플릿이 어떻게 다른지 비교한다.
  • v1.7.13을 나란히 실행해 두 버전의 동작과 코드를 비교한다. 끝나면 랩을 삭제한다.

8. References

1. TL;DR

Databasement is a self-hosted database backup manager. Up to version 1.7.12, a helper in app/Traits/Toast.php built a Blade template string using the toast’s icon value, and the server then compiled and ran that string. Per the advisory, the helper methods were public, so the framework exposed them as client-invokable actions. Untrusted callers could therefore reach the template sink. The advisory states that the result is arbitrary PHP execution as the application user. The fix landed in v1.7.13 (PR #605). It moves the helpers off the client-callable surface and passes the icon as bound data instead of template source. For a hosted instance, upgrade first and then rotate the secrets it stores.

2. Flaw classification

ItemValue
Primary CWECWE-1336, Improper Neutralization of Special Elements Used in a Template Engine. NVD also lists CWE-791. The GitHub advisory additionally lists CWE-94 and CWE-862 (see REVIEW_NOTES).
Product / componentDavid-Crty Databasement, app/Traits/Toast.php, function toast, argument icon (Toast Notification Helper)
Affected versionsUp to 1.7.12 per NVD and VulDB. The advisory metadata agrees; its body text says “before 1.7.14”.
Attack vectorNetwork, reached through the web application’s Livewire component requests
PrerequisitesNone for the unauthenticated path. The advisory says one public page exposes the sink without authentication. Other paths work for any logged-in role, including the lowest-privilege one.
ImpactCode execution as the application user. This exposes the credentials Databasement manages, such as database passwords, SSH keys and object-store secrets, and allows reading or altering backups.
CVSSNVD / task data: 10.0 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H). GitHub advisory: 9.8 (S:U).

3. Root cause

Data became template source

The advisory says a caller-controlled value, the toast icon, was concatenated into a Blade template string that the server then compiled and executed. The weakness is the standard server-side template injection (SSTI) pattern. Dynamic text is used to build the template itself, not passed in as a variable. The advisory describes the root cause as constructing a Blade template from runtime input instead of binding that input as data.

Compare two ways to show an icon:

  • Unsafe: template = "<x-icon name='" + userValue + "' />", then compile and render template. The user value is parsed as template syntax.
  • Safe: keep the template fixed and pass userValue as an attribute. The engine treats it as a string, never as a directive.

Why untrusted callers could reach it

Reaching the sink took two conditions together. The advisory says the helpers were public, so Livewire treated them as client-invokable component actions. It also says the method-call portion of the Livewire update request is not covered by the component’s snapshot integrity check. The method-call claim is the vendor’s own statement (see REVIEW_NOTES). Broadly, a Livewire component’s public methods are meant to be called from the browser. Helpers that were only supposed to be called from server-side code were therefore also callable from the client side.

PR #605 says the same thing: the toast helpers were public on every component using the trait, although they were only called from the components’ own actions.

4. Exploit flow (conceptual)

The sequence below stays at the concept level. The vendor withheld its proof of concept, and this article gives no concrete input.

  1. Find a component that uses the toast trait. Any Livewire component that uses the trait has the helper on its client-facing method surface.
  2. Ask the server to call the helper. The attacker sends a component update request that names the helper as the action to run. Per the advisory, the method-call part of that request is not integrity-protected. The attacker also supplies their own value for the icon argument.
  3. The helper builds a template string. The attacker’s value is concatenated into Blade source, so the attacker’s text becomes part of the template.
  4. The server compiles and renders it. Blade turns template syntax into PHP and runs it. Attacker-chosen logic then runs in the application’s PHP process.
  5. Impact. Code runs as the application user. It can read the application’s keys and ciphertext and decrypt the stored credentials.
  1. call helper from client — public Livewire method
  2. icon joined into Blade source
  3. server compiles template
  4. attacker-influenced PHP runs
  5. code execution and credential exposure
Conceptual flow — not an executable payload

5. Trigger conditions

  • Version: Databasement up to 1.7.12, per NVD and VulDB. The advisory says no configuration change makes affected versions safe.
  • Network access: The instance’s web interface must be reachable. The advisory says one public page lets an unauthenticated caller reach the sink, and any logged-in role can reach it afterwards. The advisory does not name the public page (not confirmed in public sources).
  • Invitations: The advisory says outstanding, unaccepted invitations are a live exploit vector on affected versions, and invitation tokens do not expire. The exact mechanism is not confirmed in public sources (see REVIEW_NOTES).
  • No user interaction is needed, and no special configuration is mentioned as a precondition.

6. Patch analysis

The real diff was not retrieved. The commit page returned a rate-limit error, so this section is conceptual. It is based on the PR #605 description and the advisory’s remediation text, and it names no code beyond what those sources state.

The patch is commit 713f71f5336663493e8c4dc07e7f3e96a291775b, released in v1.7.13. The v1.7.13 release notes list PR #605, “fix(security): keep the toast helpers out of the component public API”. The changes break the exploit flow in two places:

  1. Smaller client-callable surface. PR #605 says the toast helpers are now protected, which keeps each component’s client-facing methods to what it means to expose. This cuts step 2 of the flow. A browser can no longer ask the server to call the helper directly.
  2. No template concatenation. PR #605 says the icon now reaches the Mary icon component as a bound value instead of being concatenated into the rendered Blade string. This removes the injection sink at step 3, so a crafted icon stays as plain data. The advisory adds that the icon is validated against a strict allow-list. The PR’s release-note summary also mentions a fallback to a standard info icon when the icon value is unsupported.

The first change alone left the other callers of the helper on the same pattern, and the second alone left the helper reachable. The advisory describes the fix as addressing both conditions.

A side effect of making the helpers protected: six Alpine clipboard toasts called $wire.success() directly. They now use a small successToast() helper in app.js, which renders the toast without a server round trip.

7. Detection & mitigation

Immediate actions

  • Upgrade to v1.7.13 or later. The advisory text says “v1.7.14 or later”, so use the newest release (see REVIEW_NOTES).
  • If you cannot upgrade yet: the advisory recommends revoking outstanding, unaccepted invitations and restricting network access to trusted operators.
  • Assume compromise if the instance was exposed. The advisory says to treat any secret a compromised instance could have decrypted as exposed and rotate it. That covers managed database credentials, SSH keys and object-store secrets.

Detection

  • Check the installed version against 1.7.12 and earlier, or check whether app/Traits/Toast.php still has public helper methods and builds Blade source from an argument.
  • Review web-server and application logs for unusual Livewire update requests that call toast-related methods on public or low-privilege pages. The advisory does not publish indicators of compromise (not confirmed in public sources).
  • Look for unexpected processes, new files or outbound connections from the application user, and for unexplained use of stored credentials or changes to backup storage.
  • For developers: search your own code for Blade or other template strings assembled from request-derived values (Blade::render-style calls fed by concatenation). Also check which public methods on Livewire components can be called from the client.

Isolated practice (local Docker lab)

Reproduction must happen only in a local Docker lab isolated from the internet. Never test against a system you do not own or lack permission to test.

  • Run an affected release (≤ 1.7.12) in a container on an internal-only network with no outbound route and no real credentials.
  • Use the lab to learn the concepts. Look at which component methods are client-callable, and compare how template source built from a variable differs from a fixed template with a bound attribute.
  • Run v1.7.13 alongside it and compare the two versions’ behavior and code. Delete the lab afterwards.

8. References