Security

This page describes the security model of WebBlocks CMS and the steps an operator or agency should take to run it safely for client sites. For how to report a vulnerability, see SECURITY.md — please do not open public issues for security reports.

Two-factor authentication

CMS 1.106.3 replaces authenticator-app codes with email verification through the existing CMS outgoing-mail settings. No additional Composer package or authenticator app is required. Configure a working delivery transport under System → Settings → Email before enabling verification; log and array transports, including failover destinations, are refused.

Open Profile → Manage two-factor authentication. Normal account management remains inside the CMS panel. Confirm your current password to send a code to your profile email, then enter the six-digit code to enable verification. Codes expire after five minutes and work once; setup expires after ten minutes. Send email code requests a code or a replacement after a one-minute cooldown. Check your spam folder if a message does not arrive. A send failure leaves verification incomplete.

From CMS 1.110.2, sign-in and account security forms use one Verification code field for either the six-digit email code or a saved recovery code. Only one code is needed. CMS password sign-in automatically sends an email code; verification reached from an existing host or remembered session asks you to select Send email code first. The screen indicates whether a usable email code has been sent for the current session. Recovery codes work without requesting an email.

Save the ten recovery codes before leaving the confirmation page. They are shown only when generated, each works once, and generating replacements invalidates every previous code. Store them separately from your mailbox. Renewal and disabling require the current password plus a fresh email code or recovery code.

Verification stays bound to the address confirmed during setup. Updating your profile email does not automatically reroute security codes. To change the verification address, update your profile email first, then use Change verification email. Confirm your password and a code sent to the existing verification address or a recovery code, then verify the new profile address. The existing address stays active until confirmation; completion replaces recovery codes and requires other sessions to verify again.

An active Super admin can require verification for Super admins and selected built-in or custom site roles under System → Settings → Security. A matching role on any site is sufficient. Enforcement is initially off; once required, users complete setup before accessing the panel and cannot disable verification while the policy applies. An enrolled administrator confirms policy changes with the current password and a fresh email or recovery code. Super admin verification is configurable, not permanently mandatory: clear Require for Super admins and save the policy, then return to your account’s two-factor settings and use Disable two-factor authentication. Removing the policy requirement does not itself disable protection on enrolled accounts. A separate account-recovery requirement still needs fresh setup after a reset.

From CMS 1.110.7, the mandatory two-factor policy card keeps role selection, current-password confirmation and the verification field together. Use Send email code beside that field to request a code without reloading the page. Delivery feedback and the resend countdown appear in the same section; your selected roles, entered password and verification code remain in the form on success or failure. The send request submits only its purpose, return context and CSRF token. After entering an email code or a saved recovery code, select Save two-factor policy to apply the changes.

From CMS 1.110.8, the Security tab places the two-factor policy card on the left and request limits on the right using the bundled UI’s 5/7 columns at viewport widths of 1200 px or more. On narrower screens the cards stack, policy first. Each card retains its own save actions and content height; request limits use the full row when policy controls are unavailable.

The gate also applies to host-application logins, remembered sessions, session-based previews and plugin recovery. Password-only CMS sign-in does not create a signed-in session for an enrolled account. Pending sign-in expires after five minutes, even after a resend. Sign-in verification, required setup and plugin recovery use a restricted screen until verification succeeds. Bearer-token APIs retain their separate authentication and capability rules.

Verification and management submissions share a five-request-per-minute account limit and a thirty-request-per-minute IP backstop. Each email challenge permits five failed attempts. Resends are limited to once per minute per account and purpose, with an account ceiling of three sends per minute. Codes are stored only as keyed hashes in relational records and are bound to their account, purpose and initiating session. Mail delivery is synchronous and needs no queue worker. Delivery errors do not reveal codes or raw mail exception messages in application logs. Recovery codes remain usable during an outage.

Email verification depends on mailbox security and delivery availability. Password resets do not remove verification. Keep the application key and database backups secure and reconcile verification state after a restore. Upgrading replaces existing TOTP credentials with the account's current email address, removes old secrets and unfinished setup, and preserves enabled protection, recovery codes and role policies. Restoring TOTP-only binaries requires restoring the matching backup.

Verification email text (1.110.4)

Active Super admins can customize the message under System → Settings → Email → Verification email. Choose a panel language and load it before editing the subject, greeting, introduction, expiry/security message and closing. Each of the six panel languages has independent settings; messages use the verification request’s language, with English for unsupported languages. Use plain text and the placeholders {code}, {minutes} and {app_name}. Subject, greeting and closing must each fit on one line (255 characters); introduction and security copy allow up to 2,000 characters each. HTML and Markdown are displayed as text.

The default subject begins with the code so it is visible in the inbox; it may also appear in notification previews. The message body always shows the code separately in large, bold text, and a plain-text alternative includes the code. Preview in new tab shows unsaved text with sample code 123456, without saving or sending mail. Restore defaults restores only the selected language after confirmation. These controls change message copy; code validity remains five minutes and delivery still uses the existing CMS mail configuration.

Recovering a locked-out account

From CMS 1.106.4, an enrolled active Super admin can open Users, edit another CMS account, and use Reset two-factor authentication. Verify the owner's identity first. Enter a recovery reason without passwords or codes; optionally enter a new profile email when the existing mailbox is inaccessible. Authorize the reset with your own current password and a fresh email code or recovery code. The panel respects existing system/user-management permissions and does not allow self-reset.

The reset removes the target's old verification and recovery codes, revokes existing browser sessions and remembered sign-ins, and requires fresh setup before CMS access even if its role normally makes verification optional. Existing sessions are rejected on their next web request, including host web routes; an already rendered page is not erased. Session revocation works across session storage backends. The owner signs in with the profile email and unchanged password, then proves mailbox access during setup and saves new recovery codes. Global role policies, account activity and bearer-token authentication remain unchanged.

When no other Super admin can sign in, including an installation with only one Super admin, a server operator can run the recovery command from the host Laravel application directory:

php artisan webblocks:two-factor:reset USER_ID --reason="Owner identity confirmed" --dry-run
php artisan webblocks:two-factor:reset USER_ID --reason="Owner identity confirmed" --email=recovery@example.test --force

Replace USER_ID with the account ID or current profile email. Omit --email to keep the profile address. Dry-run validates without changing the account or adding a reset event. Without --force, execution asks for confirmation; non-interactive execution requires --force. The command uses server access as its authority and does not require a working CMS login or factor. If an installed plugin prevents console startup, the existing WEBBLOCKS_PLUGIN_SAFE_MODE=1 environment switch can suppress plugin startup.

Panel and console recovery appear in Users & access → Roles and permissions → Access history and can be filtered by recovery action or affected user. Records contain actor/target IDs, source, reason, time and enrollment state. Console records explicitly identify server-command authority without claiming a CMS actor. Reset and audit writes are atomic: if the audit cannot be saved, the reset is rolled back. Keep server access restricted and audit reasons free of secrets. Recovery state and audit evidence are retained by migration rollback; older binaries do not enforce session revocation, so restore the matching backup and reconcile sessions before downgrading.

Deployment hardening

These are the most important controls for a production install:

  • Serve only public/ as the web root. The application root contains .env, .git, .github, storage/, vendor/, and source code that must never be web-reachable. Point your Nginx/Apache document root at public/ and confirm that https://your-site/.git/config and https://your-site/.env both return 404. An exposed .git directory leaks your entire source and any committed secrets.
  • Prefer a release artifact over a raw git clone in production. Release packages exclude .git, .github, project/, and other non-runtime files (see .gitattributes export-ignore rules). If you do deploy a clone, disable push on the install (git remote set-url --push origin DISABLED).
  • Set APP_DEBUG=false and a strong APP_KEY in production. Debug mode leaks stack traces, environment values, and internal paths.
  • Use HTTPS and set SESSION_SECURE_COOKIE=true when serving over TLS.
  • File permissions: the web/PHP user needs read/write on storage/ and the backups disk root (default storage/app/backups). Do not use 777; grant ownership or group access instead.
  • Keep secrets in .env. .env, .env.* (except .env.example), and auth.json are git-ignored. CMS API tokens and mail passwords are never written to the repository.

Authentication and authorization

  • CMS auth is Laravel-native (no Breeze/Jetstream/Fortify requirement). Admins sign in at /webadmin/login; passwords are bcrypt-hashed.
  • Three install roles gate access: super_admin (install-wide), site_admin (assigned sites), and editor (draft content within assigned sites). Cross-site actions (move/duplicate, Shared Slots) enforce access to both source and target sites. See Users & Permissions.
  • The /webadmin admin tree is protected by the CMS web + auth + admin-access middleware stack. Public routes never render draft content; draft/preview access requires an authenticated admin or a trusted token with content.read.
  • Sign-in and password-reset requests are rate-limited. Failed logins are throttled per email+IP (default 5 attempts, then a short lockout that a successful sign-in clears; tune with WEBBLOCKS_CMS_MAX_LOGIN_ATTEMPTS and WEBBLOCKS_CMS_LOGIN_DECAY_SECONDS). A per-IP backstop additionally caps the login, forgot-password, and reset-password endpoints against floods and email-rotation attempts.

Public requests and resource limits

An active Super admin can manage these limits under System → Settings → Security. The panel includes page and search requests per minute/hour, API requests per token-and-IP and per IP per minute, and search query characters and words. Values apply to the entire CMS installation, including all its sites. Site admins, editors and inactive users cannot save or restore them.

Public CMS pages and legacy page redirects share an IP-based budget across paths and locales. The defaults are 120 requests per minute and 1800 per hour, with installation configuration supplied by CMS_PUBLIC_PAGES_PER_MINUTE and CMS_PUBLIC_PAGES_PER_HOUR. This also covers CMS pages served before a redirect plugin catch-all.

HTML and JSON search share a separate IP budget, defaulting to 30 requests per minute and 300 per hour. Installation configuration uses CMS_PUBLIC_SEARCH_PER_MINUTE and CMS_PUBLIC_SEARCH_PER_HOUR. Search accepts an optional text q, defaulting to at most 200 characters and 20 normalized words. The Security panel can change both bounds. Invalid queries return localized validation JSON with status 422, including on the HTML search endpoint, instead of redirecting back to an invalid GET URL. Empty queries remain valid. Malformed UTM arrays are ignored, and valid UTM values retain the existing 255-character cap without preventing the page from rendering.

Exceeding either minute or hour budget returns 429 with Retry-After. Panel request budgets accept positive integers up to 1,000,000; query limits accept 1–2,000 characters and 1–100 words. Saved panel values take precedence over installation configuration and apply on new requests. Existing request counters remain in place, so lowering a budget below current usage can produce 429 responses until its active window ends. Use installation defaults removes only the security overrides and restores the installation's configured budgets and the original 200-character/20-word query limits. Saving and restoring use the CMS database; they do not edit .env or server configuration and do not require a configuration cache refresh.

Nonpositive installation settings fall back to the original defaults; invalid saved values also fall back without disabling protection. Host-owned routes, assets, robots and sitemaps are excluded. There is no User-Agent exemption: a client can forge a browser or crawler identity. Shared-IP clients share the budget; tune positive limits to the installation's traffic and trust only the actual reverse proxies when resolving client IPs. These application limits supplement hosting controls; they do not replace protection before PHP is invoked.

Internal Content API tokens

The Internal Content API (/webadmin/api) is for trusted operator/AI tooling.

  • Personal tokens are created by any active CMS user from Profile → Personal API Tokens; installation-level System tokens are created by a super_admin from System → API Tokens. Both are stored as hashes and shown in plain text only once.
  • Each token carries explicit capabilities (read, publish, media, plugin lifecycle, commerce, …). Advanced/destructive capabilities are separate opt-ins; normal page-building capabilities are the default.
  • Tokens can be revoked (keeping the audit row) or deleted. A per-token activity log records time, method/path, route, capability result, IP, and a user-agent summary — but never request bodies, query strings, responses, or token values.
  • Treat API tokens as secrets. Scope them to the minimum capabilities a tool needs, and rotate them if exposed.
  • Personal API tokens continuously intersect selected capabilities and sites with their owner's live role, active state, site assignments, and page workflow authority. Installation-level operations remain System-token only.
  • Personal API tokens can be restricted to exact IPv4/IPv6 addresses or CIDR networks and carry a token-specific per-minute request ceiling. These checks are enforced in addition to live user, site, workflow, and capability access.
  • Both the canonical /webadmin/api routes and the legacy /admin-api compatibility routes share the Internal Content API rate limiter.

When a reverse proxy or CDN is present, configure Laravel to trust only the actual proxy addresses and verify the resolved client IP before enabling an allowlist. Never accept spoofable forwarded headers directly from the internet.

See Personal API Tokens and Internal Content API.

Update security

In-app System Updates replace the CMS package code at vendor/fklavyenet/webblocks-cms on the live site. Because an update executes new code, the integrity of the downloaded package is a remote-code-execution boundary. WebBlocks CMS mitigates this as follows:

  • Mandatory SHA-256 checksum. The updater downloads the release ZIP, then verifies hash_file('sha256', …) against the checksum_sha256 provided by the release metadata using a timing-safe hash_equals. If the checksum is missing or does not match, the update is refused — it does not fall back to applying an unverified package.
  • Canonical update service. Update metadata and downloads come from publisher.webblocksui.com. Because the checksum is delivered alongside the download by the same service, the checksum protects against corrupted or tampered artifacts, but not against a fully compromised update service.
  • Installs are consumers, not publishers. Installed sites fetch updates but must not push to the upstream repository. Publishing is done only from the maintenance checkout with a WEBBLOCKS_PUBLISHER_TOKEN.

Signature verification (Ed25519)

For defense-in-depth against a compromised update service — where the checksum travels alongside the artifact — releases can be cryptographically signed. The publisher signs the release checksum with an Ed25519 secret key, and installs verify the signature against a pinned public key (sodium_crypto_sign), so an install rejects any release not signed by the real key.

To enable it:

  1. Generate a key pair once, on the maintenance/publisher machine: php artisan webblocks:updates:keygen.
  2. Keep the printed WEBBLOCKS_PUBLISHER_SIGNING_KEY (secret) private — set it only where you publish releases. Never commit it or set it on an install.
  3. Pin the printed public key so installs verify signed releases: set WEBBLOCKS_UPDATE_PUBLIC_KEY, or set ReleaseDefaults::UPDATE_PUBLIC_KEY so the key ships in the CMS code (recommended — a code-pinned key cannot be swapped through a compromised .env).
  4. Publish as usual; the publisher signs each release automatically.

Rollout is safe: while no public key is pinned, signature verification is not enforced (checksum verification still applies). Once a public key is pinned and installs receive that code, every future release must carry a valid Ed25519 signature over its checksum, or the update is refused.

Content and input safety

  • Public forms share a local protection pipeline: form-bound signed proof, generated honeypots, timing, content/repetition scoring, keyed sender and source counters, /24 or /64 network pressure, and site-local learned fingerprints. It makes no external request. Protection counters use keyed hashes; daily metrics contain aggregate decisions only. See Public Submission Protection.
  • Contact forms store scored submissions for review. Quarantine and spam suppress notification while remaining separate from notification delivery history. See Contact Forms & Messages.
  • Comments default to pending; a spam decision is retained as spam and never appears publicly without moderation.
  • Trusted HTML is limited to wrapper-adjacent layout markup and must not be used to inject scripts; prefer the native block contracts, which the Internal Content API validates draft-first.
  • Media uploads are restricted to an allowlist of image, video, and document types (content-sniffed, not extension-trusted). SVG uploads are disabled by default, because an SVG can carry inline script and media is served from the same origin as the admin. Enable it only on installs where every account that can upload media is trusted, via WEBBLOCKS_CMS_ALLOW_SVG_UPLOADS=true. The same allowlist governs server-side remote media fetches.
  • Remote media fetching validates every redirect target and pins the HTTP connection to the public IP address that passed validation. This closes the DNS lookup/connection race used by DNS-rebinding attacks. Remote fetching fails closed when PHP cURL address pinning is unavailable.
  • Managed Embedded Application iframes are opaque-origin sandboxes. Their entry responses apply restrictive CSP and referrer headers. CSP names the current registered site origin explicitly so opaque-origin documents can load their same-site scripts, styles, media, and <base> URL without granting the iframe same-origin access to CMS cookies, storage, the parent page, or authenticated panel requests.
  • Complete Embedded Application packages stay isolated. Immutable, versioned package files are served through an application-only public route with anonymous CORS and cross-origin resource headers, allowing opaque-origin games to load images, audio, fonts, JSON, and locale files without granting allow-same-origin. ZIP installation rejects traversal, duplicate paths, executable server files, and bounded-count or expanded-size violations.

Telemetry and privacy

  • Update checks may send privacy-preserving adoption telemetry to the Publisher: only product_key, installed_version, channel, a random locally persisted installation_id, and telemetry_schema_version. No domains, URLs, admin emails, paths, database details, user counts, tokens, or arbitrary env/config values are sent. Set WEBBLOCKS_TELEMETRY=false to opt out; metadata checks continue without an installation ID.
  • Visitor Reports retain page-view records with path, time, normalized referrer host, UTM values, device category and bot classification. Consent-based full tracking may also retain a session key and IP HMAC; these are pseudonymous identifiers, not a guarantee of anonymity. New charts and page detail modals introduce no additional identifiers or public tracking scripts. Scheduled retention replaces expired detail with daily site/locale counts and later expires those counts. See Operations.

Reporting a vulnerability

Report privately via GitHub Security Advisories or the maintainer contact in SECURITY.md. We aim to acknowledge reports within 5 business days and will coordinate a disclosure timeline with you.

Plugin Startup And Recovery (1.94.0–1.94.2)

CMS-managed plugin install, update, and activation validate the candidate in a separate PHP process before normal-runtime activation. Invalid source, provider/route failures, early exits, and timeouts reject it; a rejected update retains the working package. Database setup failures keep the plugin disabled and preserve its data. Runtime source or route failures quarantine the affected plugin and remove partially registered routes.

The /webadmin/plugin-recovery screen and login load without installed plugin source. CMS 1.94.2 applies active-account admin access and Super admin authorization, including existing sessions. Recovery can disable the failing plugin or restore the retained previous package only when no database migration ran; restoration repeats startup validation and republishes the previous assets. Normal login controls and CSRF protection remain in force. This protects the managed-plugin recovery path, not arbitrary host providers or executable PHP isolation. See Plugin System.

System Updates API Authority (1.90.0)

Installation updates require an installation-wide system token owned by an active user with system access. system-updates.read and system-updates.run are separate opt-ins; neither personal tokens nor site-scoped tokens can use them. Execution requires explicit approval of the installed version, target version, and checksum, with a durable idempotency receipt for uncertain responses. See Updates.