/

CVE-2026-45117

Severity:

CRITICAL RISK

(9.8)

PHP Code Injection (CWE-94) in MyBB Installer Module

CVE-2026-45117

Deferred

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

(9.8)

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

MyBB's installer can improperly escape database configuration values before writing them into a PHP configuration file. When the installer remains accessible and an attacker can submit crafted configuration data, the resulting code injection may enable remote code execution on the server.

Affected context

The issue affects MyBB installations in the vulnerable 1.8.x release range when the installer module is accessible. It occurs while user-supplied database configuration values are processed and written into a generated PHP configuration file, particularly when the escaping logic does not treat backslashes as characters requiring protection.

Exploit preconditions

  • Attack surface: The MyBB installer endpoint, including install/index.php
  • Required access: Ability to reach the installer and submit database configuration values
  • Trigger point: Processing and writing submitted values into the PHP configuration file
  • Why exploitation is possible: Incomplete escaping can allow input to break out of the intended PHP string context and introduce executable PHP code

Why this happens

The vulnerability results from incomplete escaping of user-controlled data before embedding it in generated PHP source code. The installer uses addcslashes() with a character set that omits the backslash character, allowing specially formed input to alter the structure of the generated PHP string. This is a form of CWE-94: Improper Control of Generation of Code, in which data is incorporated into executable code without reliably preserving its literal meaning.

Potential impact

  • An attacker may execute arbitrary PHP code on the server
  • The attacker could access, modify, or delete forum data
  • Application credentials and other secrets may be exposed
  • The compromise could enable account takeover or persistent server access
  • The server may be used for further attacks against connected systems

General mitigation guidance

Mitigation generally focuses on removing installer exposure and preventing user-controlled values from becoming executable source code.

Common defensive patterns include:

  • Keep installation and setup endpoints inaccessible after deployment
  • Avoid generating executable configuration files from raw user input where possible
  • Use structured configuration formats and trusted serializers instead of string-based PHP code generation
  • Apply complete, context-aware escaping when code generation cannot be avoided
  • Validate configuration values against strict type, format, and length constraints
  • Run the web application with least-privilege filesystem and process permissions
  • Store secrets outside web-accessible paths and limit write access to configuration files

How teams detect issues like this

Organizations can look for this vulnerability through:

  • Static analysis rules identifying user input embedded in generated PHP source
  • Code review checks for incomplete escaping, especially around backslash and quote handling
  • Tests that submit boundary characters to installer configuration fields and inspect generated files safely
  • Web-application policies that block or isolate installer endpoints after deployment
  • File-integrity monitoring for unexpected changes to PHP configuration files
  • Runtime monitoring for unusual child processes or outbound connections from the PHP application

Automated security review tools may help identify code-generation paths and incomplete output encoding.

Sources

SourceLink
github.comgithub.com/mybb/mybb/commit/0fe713e3b964bfc878ea65bdd9f746f585f6ebbf
github.comgithub.com/mybb/mybb/releases/tag/mybb_1840
github.comgithub.com/mybb/mybb/security/advisories/GHSA-gpc4-77rp-3xqr
mybb.commybb.com/versions/1.8.40

Frequently asked

questions

It can be remotely exploitable when the MyBB installer is reachable over the network and accepts attacker-controlled database configuration values.

Normal application authentication may not be required because the vulnerable functionality is located in the installer. Access to the exposed installer endpoint is the important prerequisite.

Remove or strictly restrict access to the installer after deployment, and prevent untrusted values from being incorporated into executable PHP source code.

Use structured configuration handling, context-aware escaping, strict validation, secure code-generation practices, and deployment policies that disable setup endpoints when they are no longer needed.

Find out what's already
exploitable in your codebase.