LMS security and performance are one engineering problem, not two. The same choices decide both: which versions you run, how the stack is layered, where sessions and caches live, how background jobs are scheduled, which plugins are installed and how custom code checks permissions. A site that is patched, properly cached, running cron from the command line and serving files from the web server is faster and harder to attack than one that is not. This guide is the hub for our LMS security and performance articles, written for the engineers who run Moodle and WordPress-based LMS platforms in production.
We cover the reference architecture, platform hardening, identity and roles, secure custom code mapped to the OWASP Top 10:2025, patching and plugin supply chain, performance tuning, scaling for exam-day peaks, and the monitoring, backup and incident routines that hold it all together. Each section points to the deeper article where one exists.
Checked against Moodle 5.3.0 source and the Moodle developer documentation, the WordPress and PHP official documentation, and the LearnDash 4.18.0.1, LifterLMS 8.0.1 and Tutor LMS 4.1.3 source code, in October 2026. LearnDash 5.x is the current release line; nothing below depends on a 5.x change.
How LMS security and performance depend on each other
A learning platform has a load and risk profile that a brochure site or a shop does not. Almost every request is from a logged-in user, so full-page caching helps far less than people expect. Traffic arrives in bursts tied to the timetable: a quiz opening at 09:00, a compliance deadline at month end, enrolment day. Teachers upload HTML, SCORM and H5P packages that run JavaScript in the learner's session. And the data is personal, graded and often regulated.
| LMS trait | Performance effect | Security effect |
|---|---|---|
| Mostly authenticated traffic | Page caches bypass most requests; PHP, the object cache and the database do the work | Session handling, cookie flags and session storage matter on every request |
| Timetabled peaks (quiz starts, deadlines) | Hundreds of logins and quiz attempts in the same minute | Login rate limits and lockouts must not lock out real learners during the peak |
| Uploaded interactive content (SCORM, H5P, HTML) | Large packages, many small files, heavy file serving | Content runs JavaScript with the user's session, so only trusted roles should upload it |
| Grades, certificates and progress records | Large, fast-growing tables (logs, activity, attempts) | Integrity and audit requirements; tampering is a real incentive |
| Large plugin ecosystems | One slow plugin can dominate page time | Each plugin is third-party code with your users' data |
| Scheduled background work (cron, WP-Cron) | Backlogs delay emails, completions and reports | Security tasks (cleanup, log rotation, session expiry) also run here |
Two consequences follow. First, a performance fix is often a security fix: moving cron to the command line, running sessions in Redis and serving files through the web server reduce both load and exposed surface. Second, security controls have performance costs that you must design for, such as MFA prompts at login peaks, malware scanning of uploads and log volume. Decide those trade-offs on purpose rather than discovering them during an exam.
Reference architecture and supported versions
Whether the LMS is Moodle or WordPress with LearnDash, LifterLMS or Tutor LMS, a production stack that scales past a single server has the same layers:
- Edge: DNS, a CDN or reverse proxy, TLS termination and a web application firewall with rate limiting.
- Web tier: Nginx or Apache with PHP-FPM and OPcache, on one or more stateless nodes behind a load balancer.
- Cache and sessions: Redis (or a similar in-memory store) for sessions and application caches, shared by all web nodes.
- Database: a dedicated MySQL, MariaDB or PostgreSQL server, optionally with read replicas, reachable only from the web and worker tiers.
- Files: shared storage for uploaded files (moodledata or wp-content/uploads), kept outside the code tree where the platform allows it.
- Workers: a node or container that runs cron and background tasks, separate from user-facing web nodes on larger sites.
- Observability and backups: central logs, metrics, uptime checks and off-site, tested backups.
Our LMS hosting requirements guide gives server sizing from 1,000 to 50,000 learners. The first rule in both security and performance is to run versions that still receive fixes:
| Component | Version | Status on 31 October 2026 |
|---|---|---|
| Moodle | 5.3 LTS | Bug fixes to 4 Oct 2027, security fixes to 1 Oct 2029; PHP 8.3 to 8.4 |
| Moodle | 5.2 | Bug fixes to 19 Apr 2027, security fixes to 4 Oct 2027 |
| Moodle | 5.1 | Security fixes only, until 19 Apr 2027 |
| Moodle | 4.5 LTS | Security fixes only, until 4 Oct 2027; PHP 8.1 to 8.3 |
| Moodle | 5.0 and older | Unsupported; upgrade |
| PHP | 8.2 | Security fixes end 31 Dec 2026 |
| PHP | 8.3 | Security fixes to 31 Dec 2027 |
| PHP | 8.4 | Active support to 31 Dec 2026, security fixes to 31 Dec 2028 |
| PHP | 8.5 | Active support to 31 Dec 2027; Moodle lists 8.5 as development only, and LMS plugins should state support before you adopt it |
| WordPress | Current release | WordPress.org recommends PHP 8.3 or greater, MySQL 8.0 or MariaDB 10.11 or greater, and HTTPS support |
If your LMS still runs on PHP 8.2, plan the move now: it stops receiving security fixes at the end of 2026. For Moodle sites, 5.3 LTS is the natural target, and the minimum version to upgrade from is 4.4.
Hardening the platform: Moodle and WordPress LMS
Hardening means removing what an attacker could use before they find it: writable code, exposed data directories, admin features that change code from the browser, and debug output. Do it in configuration files that live in version control, not in settings someone can change from the admin screens.
Moodle
- Directory layout. From Moodle 5.1 the web server document root must point to the
public/directory, whileconfig.phpand theadmin/cliscripts stay in the project root. Keepmoodledataoutside the web root and writable only by the web server user. The installation guide is explicit that code files should not be writable by the web server user. - Lock admin features in config.php.
$CFG->preventexecpath = truestops executable paths being edited from the web,$CFG->disableupdateautodeploy = truedisables installing or updating plugins from the browser, and$CFG->forced_plugin_settingspins plugin settings so they cannot drift. - Never leave debug settings on.
$CFG->debugdisplay,$CFG->themedesignermodeand$CFG->cachejs = falseare marked "NOT FOR PRODUCTION SERVERS" inconfig-dist.php. The first leaks information; the other two also slow every page. - Proxies. When TLS terminates at a load balancer, set
$CFG->sslproxy; use$CFG->reverseproxyonly when the proxy really serves a different host name. - Outbound requests. Review the "cURL blocked hosts list" setting so that features which fetch URLs cannot be pointed at internal addresses.
- Run the Security checks report (Site administration > Reports > Security checks). It flags displayed errors, a web-accessible dataroot, executable paths, a writable config.php, insecure cookies, weak password policy and risky role definitions.
// config.php additions (Moodle 5.x) - not run on a live site; test on staging first
$CFG->preventexecpath = true;
$CFG->disableupdateautodeploy = true;
$CFG->sslproxy = true; // only when TLS terminates at the load balancer
WordPress with LearnDash, LifterLMS or Tutor LMS
- Disable code editing from wp-admin. Define
DISALLOW_FILE_EDITas true inwp-config.phpso the theme and plugin file editors are gone. If deployments come from Git or CI,DISALLOW_FILE_MODSalso blocks installing and updating plugins from the dashboard; in that case your pipeline must apply updates promptly. - File ownership. Code owned by a deploy user and not writable by PHP; only
wp-content/uploadswritable. A compromised plugin then cannot rewrite other plugins. - Database user. A dedicated user with rights on the site's own database only, never a shared root account.
- Limit XML-RPC and REST exposure to what integrations need. LMS plugins register their own REST routes, so review which ones are public on your site rather than blocking the REST API wholesale, which breaks the block editor and many plugins.
- Use Site Health (Tools > Site Health) as a baseline check. Since WordPress 6.1 it also reports whether a persistent object cache and a full-page cache are in use.
Our LMS security checklist turns these items into a review list with owners and review intervals.
Identity, roles and access control
Broken access control is first in the OWASP Top 10:2025, and in an LMS it usually looks mundane: a manager role that can see every learner's grades, a teacher who can upload unfiltered HTML, an instructor account shared by three people, a former contractor who still has admin rights.
Authentication
- Single sign-on moves password policy, MFA and deprovisioning to your identity provider, which is where they are best enforced. Our comparison of SAML and OIDC for LMS SSO covers the choice. In Moodle, OAuth 2 is core and SAML 2 needs a third-party plugin; in WordPress, both need plugins.
- MFA for privileged accounts. Moodle has had MFA in core (
tool_mfa) since 4.3. WordPress core has no built-in second factor; the Two Factor plugin maintained under the WordPress GitHub organisation is one option, and most SSO identity providers enforce MFA before the user reaches the site. - Brute-force protection. Moodle's "Account lockout threshold" setting locks accounts after repeated failures, but its own description warns that the feature "may be abused in denial of service attacks". On an LMS with timetabled logins, rate-limit by IP at the edge first and keep the account lockout threshold generous enough that a class mistyping passwords at 09:00 does not lock itself out.
- Sessions. Use secure, HTTP-only cookies (Moodle's "Secure cookies only" setting), a session timeout that matches how long learners spend in long quizzes, and keep sessions in Redis or the database rather than local files once you have more than one web node. Moodle 5.3 also sends new login notifications by default.
Roles and capabilities
Moodle's own security guidelines state that all administrators must be fully trusted and that teachers with risky capabilities must be trusted too, because content such as SCORM packages needs to run JavaScript with the user's session. Capabilities carry risk flags (for example RISK_XSS), and Moodle 5.3 made role risks more visible. Review who holds capabilities with XSS, configuration or personal-data risks at every term start.
WordPress LMS plugins add their own roles on top of WordPress roles: LearnDash group leaders, LifterLMS instructors and assistants, Tutor LMS instructors. Check what each role can reach in reports and the REST API, not only in the admin menus, and avoid giving instructors the unfiltered_html capability unless you would also trust them with an administrator account.
| Control | Moodle (core) | WordPress LMS |
|---|---|---|
| MFA | tool_mfa, core since 4.3 | Plugin or identity provider |
| SSO | OAuth 2, LDAP, Shibboleth core; SAML 2 via plugin | Plugins |
| Lockout and password policy | Account lockout threshold, Password policy, Password rotation limit | Plugin or edge rate limiting |
| Role review | Capability risk flags, Security checks report | Manual review of roles and plugin capabilities |
| Force login | "Force users to log in"; on by default for new 5.2+ installs | Theme, plugin or LMS access settings |
Secure custom code: OWASP Top 10 for LMS developers
A common entry point we see in LMS incidents is custom or third-party plugin code rather than the core platform. The OWASP Top 10:2025 is a useful map, and both platforms already provide the tools to avoid each risk. The job is to use them every time.
| OWASP Top 10:2025 | What it looks like in an LMS | Moodle API | WordPress API |
|---|---|---|---|
| A01 Broken Access Control | A report or certificate URL that returns another learner's data when the ID changes | require_login() with the course and module, require_capability() | current_user_can() plus an ownership or enrolment check |
| A02 Security Misconfiguration | Debug display on, dataroot reachable, file editor enabled | Security checks report, config.php locks | Site Health, DISALLOW_FILE_EDIT |
| A03 Software Supply Chain Failures | Abandoned plugins, nulled premium plugins, unpinned dependencies | Plugins directory, composer install --no-dev from 5.1 | Licensed sources only, update monitoring |
| A04 Cryptographic Failures | HTTP logins, unencrypted backups, API tokens in plain text | Secure cookies, TLS to Redis | HTTPS everywhere, secrets outside the database where possible |
| A05 Injection | Search or report filters concatenated into SQL; XSS in forum posts or feedback | $DB placeholders, format_text(), s() | $wpdb->prepare(), esc_html(), wp_kses_post() |
| A06 Insecure Design | Quiz answers sent to the browser; certificates verifiable only by guessable IDs | Threat-model new features before building them | |
| A07 Authentication Failures | Shared instructor accounts, no MFA for admins, weak reset flows | MFA, lockout, CAPTCHA on forgot password (5.1) | SSO or MFA plugin, edge rate limits |
| A08 Software or Data Integrity Failures | Grade or completion changes from an unsigned webhook | Web service tokens scoped to a service | Verify webhook signatures; nonces for state changes |
| A09 Logging and Alerting Failures | No record of who changed a grade or role | Event and log stores, "Keep logs for" | No core audit log; add one |
| A10 Mishandling of Exceptional Conditions | Errors that reveal paths or SQL; failures that leave access granted | Debug display off in production | WP_DEBUG_DISPLAY off; fail closed |
The Moodle developer guidelines summarise the rules in a few lines: call require_login near the start of every script, check capabilities before showing or doing anything, never read $_GET or $_POST directly but use required_param and optional_param with a PARAM_ type, check confirm_sesskey() before any state change, pass values to SQL as bound parameters, and output with s, format_string or format_text. The WordPress plugin handbook asks for the same discipline with its own functions: sanitise input, escape output late, verify a nonce with check_admin_referer() or wp_verify_nonce(), and check capabilities with current_user_can().
A nonce is not authorisation. In LMS code the check that most often goes missing is the second one: the user is logged in and the nonce is valid, but nobody checked that the course, group or attempt they asked for belongs to them. Write that check into every handler that takes an ID from the request.
// WordPress LMS AJAX handler pattern - not run on a live site; test on staging first
add_action( 'wp_ajax_aiol_get_attempt', 'aiol_get_attempt' );
function aiol_get_attempt() {
check_ajax_referer( 'aiol_attempt', 'nonce' );
$attempt_id = isset( $_POST['attempt_id'] ) ? absint( $_POST['attempt_id'] ) : 0;
global $wpdb;
$row = $wpdb->get_row( $wpdb->prepare(
"SELECT * FROM {$wpdb->prefix}tutor_quiz_attempts WHERE attempt_id = %d", $attempt_id
) );
if ( ! $row || ( (int) $row->user_id !== get_current_user_id() && ! current_user_can( 'manage_options' ) ) ) {
wp_send_json_error( null, 403 );
}
wp_send_json_success( array( 'score' => esc_html( $row->earned_marks ) ) );
}
The table and column names in that example come from the Tutor LMS 4.1.3 source; adapt the ownership check to the plugin you build on, and prefer the plugin's own API functions over direct queries where it has them.
Patching, plugins and the supply chain
Unpatched software is one of the most common ways into an LMS, and on most sites plugins hold more code than the core platform. A dependable patching routine beats any single security product.
Know the release rhythm
- Moodle ships major releases every April and October and minor releases every two months, and security fixes arrive in those minor releases. The next scheduled minors are 5.3.1, 5.2.5, 5.1.9 and 4.5.16 on 7 December 2026. Register the site so the administrator receives security advisories before they are published.
- WordPress applies minor core releases automatically by default; major releases, plugins and themes need a decision. LMS plugins often ship database migrations, so update them on staging first.
- PHP and the operating system need their own schedule. A PHP security release protects every site on the server at once, and critical PHP flaws do happen; treat PHP updates as part of the LMS patch cycle, not as hosting housekeeping.
Treat plugins as dependencies
- Keep an inventory: every plugin, its version, its source, who maintains it and why you need it.
- Remove what is not used. Deactivated WordPress plugins and disabled Moodle plugins still sit on disk.
- Check maintenance before installing: last release date, supported platform versions and how the maintainer handles security reports.
- Buy premium plugins only from the vendor. Nulled copies are a common source of backdoors.
- Deploy from version control or a pipeline so that the code on the server is known. Moodle's guidance makes the same point: with a Git deployment,
git statusshows any file that was changed on the server. - For Moodle 5.1 and later, run
composer install --no-dev --classmap-authoritativeas the docs advise, so development dependencies never reach production.
Keep the WordPress LMS plugin and its add-ons in step. With LearnDash in particular, an old add-on running against a newer core is a frequent cause of errors after updates.
Performance engineering: caching, database, background jobs and files
Measure before changing anything. Record p50 and p95 response times for login, dashboard, course page, quiz attempt and gradebook, plus PHP-FPM worker saturation, database load and background queue length, on a normal day and on your busiest day. Moodle's "Performance info" setting prints page time, database queries and cache use in the footer for admins; on WordPress, a query monitor plugin on staging does the same job. Our Moodle performance tuning checklist walks through the profiling-first method step by step.
PHP
Run PHP-FPM with OPcache on, sized so the whole codebase fits; Moodle's environment check recommends opcache.enable. Size pm.max_children from measured memory per worker. Too few workers queue requests at the peak, too many push the server into swap, which is worse.
Caching for logged-in users
Because most LMS traffic is authenticated, the wins come from the application and object caches rather than the page cache.
- Moodle: the cache subsystem (MUC) defaults to file stores in moodledata, which are slow on network storage. Core store plugins in 5.3 are APCu, File, Redis, Session and Static. Map application caches to Redis, keep
$CFG->localcachediron fast local disk on each node, and set$CFG->session_handler_classto\core\session\redis. Moodle's performance documentation recommends Redis over Memcached, partly because Memcached lacks security features. - WordPress: add a persistent object cache backed by Redis or Memcached, which Site Health suggests on larger sites. Keep full-page caching for the public catalogue and landing pages, and make sure it never caches pages for logged-in learners, cart, checkout or lesson pages with progress state.
Database
Give the database its own server, enough memory for the working set (on MySQL and MariaDB, innodb_buffer_pool_size is the main lever), slow query logging, and regular review of the biggest tables. In an LMS those are predictable: logs and events in Moodle; in WordPress, wp_usermeta and wp_options plus the LMS plugin's own tables, such as LearnDash's learndash_user_activity, LifterLMS's lifterlms_user_postmeta and lifterlms_events, and Tutor LMS's tutor_quiz_attempts. Moodle's "Keep logs for" setting controls log retention; balance it against your audit needs rather than cutting it to the minimum. Read replicas are supported in Moodle's config.php, and 5.2 can mark tables that must always use the writer.
Background jobs
- Moodle: run
php admin/cli/cron.phpevery minute as the web server user, from the project root on 5.1 and later. Turn on "Cron execution via command line only" so cron cannot be triggered over the web. On large sites, run cron on dedicated worker nodes and tune the task concurrency limits. - WordPress: by default WP-Cron runs on page loads. Define
DISABLE_WP_CRONas true and callwp-cron.phpfrom the system scheduler instead, as the WordPress plugin handbook describes. LMS emails, drip content and subscription renewals then run on time, and visitors stop paying for them.
# crontab entries - not run on a live site; test on staging first
* * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php >/dev/null 2>&1
*/5 * * * * wget -q --delete-after https://lms.example.com/wp-cron.php
Files and media
Let the web server send files instead of PHP. Moodle supports this with $CFG->xsendfile (X-Sendfile for Apache, X-Accel-Redirect for Nginx) and $CFG->xsendfilealiases. Serve course video from a streaming service or CDN rather than from the LMS file store: video is the fastest way to saturate a web node, and streaming services provide access controls that a plain file URL does not.
Scaling for peaks and proving it with load tests
The LMS outages we are called in for rarely come from average load. They happen when a whole cohort starts a timed quiz in the same minute, or a compliance deadline drives a month's traffic into one afternoon. Plan for those minutes.
Scale out cleanly
Adding web nodes only helps if every node is stateless. For Moodle, the cluster documentation requires the same wwwroot on every node, shared dataroot, tempdir, cachedir and backuptempdir, node-local localcachedir, and sessions in a shared store such as Redis. For WordPress, uploads must be shared or offloaded to object storage, the object cache shared, and nothing written to the plugin directories at runtime.
Load test before the event, not during it
- Write the peak down in numbers: how many learners log in within how many minutes, and what they do next.
- Build a realistic test site. Moodle's generator tool (
tool_generator) creates test courses and generates JMeter test plans; it requires the debug level set to developer, so use it only on a test copy. - Run the test against a staging stack sized like production, with the same caches, PHP-FPM settings and database configuration.
- Watch the database and PHP-FPM worker saturation, not just response time. The first resource to run out is the one to fix.
- Fix, re-run and record the result so the next term starts from a known baseline.
The week before a peak
- Freeze deployments and plugin updates, except security fixes.
- Clear the background queue and check that no scheduled task is failing.
- Warm caches after any deployment, and check that the edge rate limits will not block a whole campus behind one NAT address.
- Stagger quiz open times where teaching allows; it costs nothing and flattens the spike.
- Agree who is on call and how they will be alerted.
Monitoring, backups and incident response
You cannot defend or tune what you cannot see. Monitoring, backups and an incident routine are where security and performance work becomes operations.
Monitoring
- Health checks. Moodle's Check API exposes security, status and performance checks, and
php admin/cli/checks.phpreturns them in a form that Nagios-style monitoring can read. The core status checks confirm that cron runs regularly and that tasks are not failing. On WordPress, external uptime checks plus a check that the system cron is callingwp-cron.phpcover the same ground. - Metrics. Response time percentiles, PHP-FPM active and idle workers, database connections and slow queries, Redis memory, and queue length. Moodle 5.2 added OpenTelemetry integration for teams that already run a tracing stack.
- Security signals. Failed logins by IP and account, new administrator or manager role assignments, plugin installs, changes to authentication settings and spikes in 4xx and 5xx responses at the edge.
Backups that restore
A Moodle site backup is three things taken together: the code, moodledata and a database dump. Course backups are not a site backup. A WordPress LMS backup is the database plus wp-content, including the LMS plugin's custom tables. Keep at least one copy off-site and out of reach of the web server's credentials, so ransomware on the server cannot delete it, and restore to a separate environment on a schedule. The time a full restore takes is your real recovery time; measure it.
Incident response
- Contain: enable maintenance mode (
php admin/cli/maintenance.phpon Moodle), block the source at the edge, and revoke exposed tokens and sessions. Moodle'sadmin/cli/kill_all_sessions.phplogs everyone out. - Preserve: copy logs, the database and changed files before cleaning anything.
- Find the way in: compare deployed code with version control, review new admin accounts, plugin changes and web server logs.
- Recover: rebuild from known-good code, rotate every credential (database, API keys, SSO secrets, admin passwords), patch the cause and restore data if needed.
- Notify: follow your legal and contractual duties for learner data, which depend on your jurisdiction and contracts.
- Review: write down what would have caught it sooner, and add that check.
Rehearse this once a year as a tabletop exercise. The first time you run it should not be during a real incident at exam time.
How we can help
We run security reviews, hardening, patching programmes and incident support for Moodle and WordPress LMS platforms through our LMS security service, and profiling, caching, database tuning, scaling and pre-peak load testing through our LMS performance optimization service. If your platform has a busy term or a large rollout ahead, we can start with a baseline review of the areas in this guide and a prioritised list of fixes.
Frequently asked questions
What are the most important LMS security controls?
Run supported versions of the LMS, PHP and the database; enforce MFA or SSO for every privileged account; review roles and capabilities each term; keep a plugin inventory and patch on a schedule; lock risky admin features in configuration files; and keep tested, off-site backups. Our LMS security checklist turns these into a review list.
Why is my LMS slow when page caching is enabled?
Most LMS pages are served to logged-in learners, and full-page caches normally skip logged-in users. Performance then depends on PHP-FPM and OPcache, the object or application cache (Redis), session storage, the database and background jobs, so profile those first.
How do I prepare an LMS for exam-day traffic?
Write the expected peak down in numbers, load test it on a staging stack sized like production, fix the first resource that saturates, freeze non-security deployments the week before, clear background queues, check that edge rate limits will not block shared campus IP addresses, and stagger quiz start times where you can.
Does Moodle have built-in multi-factor authentication?
Yes. MFA has been part of Moodle core as tool_mfa since Moodle 4.3, with an SMS factor added in 4.4. WordPress core does not include a second factor, so WordPress LMS sites use a plugin or enforce MFA at the SSO identity provider.
Which PHP version should an LMS run in 2026?
PHP 8.3 or 8.4 for most sites. PHP 8.2 receives security fixes only until 31 December 2026. Moodle 5.2 and 5.3 require PHP 8.3 or later and list PHP 8.5 as development only, while WordPress.org recommends PHP 8.3 or greater.
Free 30-minute consultation
Not sure where to start? Talk to an LMS engineer.
Tell us what platform you run and what you need. You’ll get honest, practical advice - even if the answer is that you don’t need us.
Sources & references
- OWASP Top 10:2025 - OWASP Foundation
- Moodle security guidelines - Moodle HQ
- Check API - Moodle HQ
- Performance recommendations - Moodle
- PHP supported versions - The PHP Group
- Plugin handbook: Securing output - WordPress.org