Summary
MajorDoMo's admin PHP console exposes an unauthenticated code execution path where user-supplied GET parameters are passed directly to eval().
Due to an include-order flaw and missing exit after a redirect, unauthenticated requests can reach the console's AJAX handler and execute arbitrary PHP code via crafted admin.php requests.
Affected context
This vulnerability arises in MajorDoMo deployments where the admin panel is exposed over HTTP(S) and reachable by attackers.
The issue is tied to the admin.php entry point, modules/panel.class.php, and the inc_panel_ajax.php console handler, which together create an execution path that bypasses normal authentication checks.
It specifically affects environments where:
- The admin interface is accessible from untrusted networks, and
- PHP is configured to execute code via eval(), and
- Legacy patterns such as
register_globalsor equivalent variable extraction are in effect.
Exploit preconditions
- Attack surface: HTTP(S) interface on
/admin.php. - Required access: Network access to the MajorDoMo admin endpoint (no valid credentials required under default vulnerable flow).
- Trigger point: A crafted GET request containing
ajax_panel,op, andcommandparameters that reaches the AJAX console handler ininc_panel_ajax.php. - Why exploitation is possible:
- An include order bug in
modules/panel.class.phpallows execution to continue past aredirect()call that lacks anexit/die, so unauthenticated requests still reach AJAX logic. - The console handler takes user-controlled input (via GET and
register_globals-style promotion) and passes it directly into PHPeval()without sanitization, validation, or authentication.
Why this happens
The core bug is an unsafe dynamic code execution pattern combined with broken access control.
Specifically, the console handler implements a "PHP console" by directly feeding request parameters into eval(), trusting them as executable PHP source.
Due to an include order issue and missing termination after a redirect, authentication checks in the admin panel do not effectively guard the AJAX endpoint, allowing unauthenticated traffic to reach the eval call.
This matches CWE-94: Improper Control of Generation of Code, where user input is treated as source code and executed at runtime without strict validation, isolation, or privilege constraints.
Potential impact
- Remote execution of arbitrary PHP code on the server.
- Complete compromise of the MajorDoMo application and its configuration.
- Extraction or modification of sensitive data, including credentials or API keys accessible to the PHP process.
- Installation of web shells or backdoors for persistent access.
- Lateral movement within the hosting environment, depending on server privileges.
- Use of the compromised host as a pivot for further attacks on internal networks.
General mitigation guidance
Effective mitigation focuses on removing unsafe code execution patterns and enforcing strict access boundaries around administrative functionality.
Recommended high-level patterns include:
- Eliminate direct eval usage: Replace dynamic evaluation with whitelisted commands, parameterized operations, or explicit function dispatch tables. Avoid treating user input as code.
- Isolate admin-only features: Ensure all admin console and debug features are strictly protected by robust authentication and authorization checks, enforced before any handler code runs.
- Enforce early exits after redirects: After security-related redirects (e.g., on failed authentication), immediately terminate script execution (
exit/diepattern) to prevent fall-through. - Remove
register_globals-style patterns: Use explicit access to$_GET,$_POST, and other superglobals instead of global variable promotion, reducing accidental data flows into sensitive logic. - Apply least privilege: Run the web server and application with minimal filesystem and OS permissions, limiting the blast radius of any code execution flaw.
- Restrict admin panel exposure: Place the admin interface behind VPNs, IP allowlists, or additional authentication layers to reduce the accessible attack surface.
How teams detect issues like this
Detection can rely on both code-centric and environment-centric approaches:
- Static analysis: Configure static analyzers or linters to flag:
- Usage of
eval(),assert()with variable content,create_function(), or similar dynamic execution constructs. - Unauthenticated code paths leading to dynamic execution or high-privilege actions.
- Redirect or authentication checks that do not terminate execution afterward.
- Targeted code review: Focus manual review on:
- Admin and debug modules, especially "console" or "shell" features.
- Include/require ordering in entry-point scripts (e.g.,
admin.php) and their handler chains. - Any reliance on
register_globalsor mass-assignment patterns. - Runtime monitoring and logging:
- Inspect web server logs for suspicious requests to
/admin.phpwithajax_panel,op, orcommandparameters from untrusted sources. - Use application or WAF rules to detect generic code injection patterns in query strings (e.g., PHP code fragments).
- Policy enforcement:
- Establish coding policies banning unsafe dynamic execution in production code.
- Integrate automated checks in CI pipelines to block merges that introduce new instances of these patterns.

