/

CVE-2026-104059

Severity:

HIGH RISK

(8.1)

Cross-Site Request Forgery (CWE-352) in Lektor Admin API

CVE-2026-104059

Deferred

Vulnerability type

Category:

Cross-Site Request Forgery

CWE:

CWE-352

Impact:

Unauthorized State Changes and Potential Data Disclosure

Severity:

HIGH RISK

(8.1)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Lektor's admin API does not adequately verify that state-changing requests originate from an authorized site, allowing malicious web pages to submit cross-origin requests without CSRF tokens or reliable origin checks. An unauthenticated attacker may cause a victim's browser to write or delete content, remove build output, trigger publication, and potentially expose data under additional network conditions.

Affected context

The vulnerability occurs in Lektor deployments that expose the admin API blueprint to browser-accessible clients without effective CSRF protection, origin validation, CORS restrictions, or host allowlisting. Risk is higher when an administrator is authenticated in the same browser and the API accepts state-changing requests using ambient session credentials.

Exploit preconditions

  • Attack surface: Browser-accessible Lektor admin API endpoints
  • Required access: No direct authentication may be required by the attacker, but a victim may need to have an active administrative session
  • Trigger point: Cross-origin requests sent to state-changing endpoints such as attachment creation, record deletion, build, clean, or publish
  • Why exploitation is possible: The API may accept requests without verifying CSRF tokens, trusted origins, referrers, CORS policy, or allowed hosts
  • Additional condition: DNS rebinding or comparable network behavior may be needed to reach certain read endpoints and disclose data

Why this happens

The underlying bug is insufficient request-origin validation for an administrative web API. State-changing operations rely on browser-supplied authentication context without requiring a server-generated CSRF token or enforcing a dependable origin and host policy. This maps to CWE-352: Cross-Site Request Forgery, where an application accepts unintended requests made on behalf of an authenticated user.

Potential impact

  • An attacker may create or overwrite arbitrary files through attachment-related functionality
  • An attacker could delete pages or other managed records
  • Build output may be removed or regeneration may be triggered
  • Publication or deployment actions may be initiated without the administrator's intent
  • Sensitive data may be disclosed if network exposure and rebinding conditions are satisfied
  • Content integrity, availability, and deployment trust may be affected

General mitigation guidance

Mitigation generally focuses on ensuring that administrative state changes cannot be initiated solely from ambient browser credentials.

Common defensive patterns include:

  • Requiring unpredictable, server-validated CSRF tokens for state-changing requests
  • Enforcing strict Origin and, where appropriate, Referer validation
  • Applying restrictive CORS policies and avoiding credentialed cross-origin access by default
  • Configuring explicit host allowlists and rejecting unexpected Host headers
  • Separating read and write capabilities and requiring explicit authorization for administrative actions
  • Using secure cookie attributes and least-privilege administrative sessions
  • Limiting administrative API exposure to trusted networks or management interfaces

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying state-changing routes without CSRF middleware or origin checks
  • Code review checks for administrative endpoints that accept browser credentials implicitly
  • Tests that submit cross-origin requests and verify rejection without valid CSRF and origin controls
  • API gateway or reverse-proxy policies restricting methods, origins, hosts, and credentialed cross-origin traffic
  • Log monitoring for unexpected attachment, deletion, build, clean, and publish actions
  • Automated security review tools that model authenticated browser request flows and CSRF protections

Sources

SourceLink
gist.github.comgist.github.com/mansurmavlankulov/c7683e3204e84892e442b0196585d5bb
vulncheck.comvulncheck.com/advisories/lektor-csrf-via-admin-api-endpoints

Frequently asked

questions

The attacker may not need an account on the Lektor instance. However, exploitation of administrative actions commonly depends on a victim having an active authenticated session that the browser will send with the cross-origin request.

The attacker generally needs only to host or control a malicious web page that the victim visits. The Lektor admin API must also be reachable by the victim's browser, and the victim must have sufficient privileges for the targeted action.

Protect every state-changing administrative endpoint with server-validated CSRF tokens and strict origin or host validation. Restrictive CORS behavior and secure cookie settings should provide additional defense rather than replace CSRF protection.

Apply a consistent security middleware policy to all administrative routes, test cross-origin behavior in automated integration tests, restrict management interfaces to trusted networks, and monitor sensitive actions for unexpected browser-originated requests.

Find out what's already
exploitable in your codebase.