/

CVE-2026-40177

Severity:

HIGH RISK

(7.5)

Authentication Bypass in Ajenti Core Plugin

CVE-2026-40177

Analyzed

Vulnerability type

Category:

Authentication Bypass

CWE:

CWE-287

Impact:

Unauthorized Access to Administrative Interface

Severity:

HIGH RISK

(7.5)

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

Ajenti's core plugin contained an authentication logic flaw that allowed users to bypass password verification whenever two-factor authentication (2FA) was enabled.

Under certain conditions in versions prior to 0.112, an attacker could gain access to the Ajenti interface without providing a valid password, undermining the intended protection of 2FA.

Affected context

The vulnerability exists in Ajenti deployments using the core plugin with 2FA enabled.

It affects environments where Ajenti serves as a management or administrative interface, and where the 2FA flow is expected to require both a password and a second factor.

The flaw manifests in the authentication logic, allowing a session to be established without fully satisfying the password check step when 2FA is turned on.

Exploit preconditions

  • Attack surface: Ajenti web interface (typically over HTTP/HTTPS)
  • Required access: Network access to the Ajenti login page
  • Trigger point: Initiation of the login process when 2FA is activated
  • Why exploitation is possible: The authentication state machine incorrectly handles the relationship between password verification and 2FA validation, allowing login completion without a successful password check.

Why this happens

This issue stems from flawed authentication logic in the Ajenti core plugin's login flow.

When 2FA is enabled, the code responsible for enforcing password verification and second-factor validation does not correctly ensure that both steps are satisfied before granting access.

This maps to CWE-287: Improper Authentication, where the application either omits essential checks or misorders them, resulting in conditions where a principal can be authenticated without fulfilling all required credentials.

Potential impact

  • Attackers may gain unauthorized access to the Ajenti administrative interface.
  • Compromise of systems and services managed via Ajenti.
  • Modification of configuration, services, and access controls through the interface.
  • Potential lateral movement or escalation within the managed environment, depending on Ajenti's privileges.

General mitigation guidance

Effective mitigation focuses on hardening the authentication workflow and validating security assumptions about 2FA:

  • Treat 2FA as an additional layer, not a replacement, ensuring password verification is always required and completed first.
  • Centralize authentication decision-making so that all login paths pass through a single, well-tested routine that checks both primary and secondary factors.
  • Apply strict state management in the login process, ensuring that a 2FA challenge can only be issued after a successful password check.
  • Enforce least privilege for accounts and minimize the number of users with Ajenti administrative access, reducing the impact of any authentication weakness.
  • Regularly review and test authentication flows, including edge cases, using both manual security review and automated tests.

How teams detect issues like this

Detecting this type of authentication flaw generally involves a combination of review and testing:

  • Code review: Examine the authentication controller or middleware for any branches where a session is created, or tokens are issued, without explicit confirmation of both password and second-factor validation.
  • Static analysis: Use tools or custom rules that flag authentication logic spread across multiple components, missing checks, or conditionals that short-circuit password validation when 2FA is enabled.
  • Dynamic testing: Perform targeted login tests that vary correct/incorrect combinations of password and second factor, verifying that no combination without a valid password results in access.
  • Security logging and monitoring: Ensure login attempts, including failed password checks and 2FA challenges, are logged and can be analyzed for anomalous patterns suggesting bypass behavior.

Sources

SourceLink
github.comgithub.com/ajenti/ajenti/security/advisories/GHSA-3mcx-6wxm-qr8v

Frequently asked

questions

Yes. Anyone with network access to the Ajenti login interface could potentially exploit the flaw when 2FA is enabled, assuming no additional network or access controls are in place.

The vulnerability centers on bypassing password verification in the presence of 2FA, so exploitation may not require knowledge of a valid password. However, details such as whether a known username is needed depend on the surrounding configuration and usage patterns.

The most reliable fix is to enforce a strict, ordered authentication flow where password verification must succeed before any 2FA challenge is considered, and to centralize all authentication decisions in a single hardened component.

Design authentication as a state machine with explicit transitions, add automated tests covering all combinations of correct/incorrect credentials and factors, conduct regular security reviews of login logic, and avoid ad hoc conditionals that alter authentication behavior based on feature flags like 2FA.

Find out what's already
exploitable in your codebase.