/

CVE-2020-37002

Severity:

CRITICAL RISK

(9.8)

OS Command Injection in Ajenti 2.1.36

CVE-2020-37002

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

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

Ajenti 2.1.36 contains an authentication bypass flaw that exposes a terminal creation API, enabling attackers to execute arbitrary OS commands after gaining access.

By abusing the /api/terminal/create endpoint, a remote attacker can send a crafted payload, such as a netcat reverse shell, to establish remote command execution on the server.

Affected context

This vulnerability affects deployments of Ajenti 2.1.36 where the web management interface is network-accessible and the terminal functionality is enabled.

The risk is most pronounced when Ajenti is reachable from untrusted networks and when the Ajenti service runs with high privileges (e.g., root), as terminal sessions created via the API may inherit those privileges.

Environments that expose Ajenti directly to the internet without additional access controls or network segmentation are particularly susceptible.

Exploit preconditions

  • Attack surface: The Ajenti HTTP(S) management interface, specifically the /api/terminal/create endpoint.
  • Required access: Ability to reach the Ajenti API over the network and bypass or satisfy its authentication flow (e.g., using weak/compromised credentials or flaws in auth enforcement).
  • Trigger point: Sending a crafted request to the terminal creation API that includes shell commands or a reverse shell invocation.
  • Why exploitation is possible: The terminal API effectively exposes an OS command execution primitive without sufficient restriction, validation, or isolation, allowing user-controlled input to be executed by the underlying shell.

Why this happens

The core issue is that Ajenti's terminal creation endpoint provides a direct bridge between user-controlled API parameters and the operating system shell.

Instead of treating terminal sessions as highly sensitive operations that must be tightly constrained, the implementation allows arbitrary commands to be executed with the privileges of the Ajenti process.

This matches CWE-78: Improper Neutralization of Special Elements used in an OS Command, where an application constructs or invokes system-level commands based on untrusted input without robust validation, sandboxing, or policy enforcement.

Potential impact

  • Remote execution of arbitrary OS commands on the server hosting Ajenti
  • Establishment of reverse shells and persistent remote access
  • Reading, modifying, or deleting sensitive files and configuration data
  • Pivoting to other systems within the same network environment
  • Escalation to full system compromise if Ajenti runs with high privileges
  • Disruption of services through process termination or resource exhaustion

General mitigation guidance

Effective mitigation focuses on reducing the exposure of powerful admin APIs and hardening how command execution capabilities are exposed:

  • Restrict access to the Ajenti interface to trusted administrative networks and use additional access controls such as VPNs or bastion hosts.
  • Treat terminal and command execution features as highly sensitive; disable them when not strictly necessary.
  • Apply strong authentication and authorization around any endpoint that can spawn shells or run system commands, ensuring only appropriately privileged users can access them.
  • Constrain command execution paths using allowlists, non-interactive command wrappers, or restricted shells that prevent arbitrary argument injection.
  • Run Ajenti and related services with least-privilege OS accounts and limit their ability to access critical files or system utilities.
  • Use network egress controls to prevent unapproved outbound connections, which can limit the practicality of reverse shells.

How teams detect issues like this

Organizations can approach detection of this class of vulnerability and its exploitation through:

  • Static analysis and code review:
  • Flagging code that directly spawns shells or terminals from web/API endpoints.
  • Identifying uses of command execution primitives (e.g., subprocess, exec, system) that accept user-derived input without strict constraints.
  • Reviewing API definitions for endpoints that create terminals, shells, or interactive sessions and ensuring strong authorization checks.
  • Runtime monitoring and logging:
  • Recording and reviewing access to /api/terminal/create and similar endpoints, including source IPs, user identities, and parameters.
  • Monitoring for unusual outbound connections (e.g., netcat to arbitrary IP/ports) that may indicate reverse shell activity.
  • Using host-based intrusion detection to alert on suspicious process trees spawned by the Ajenti service.
  • Policy and configuration checks:
  • Periodic audits that verify terminal/command execution features are disabled or locked down when not needed.
  • Automated compliance checks that ensure the management interface is not exposed directly to the internet without compensating controls.
  • Automated security scanners and code review tools can help flag high-risk command execution patterns early in the development lifecycle.

Sources

SourceLink
github.comgithub.com/ajenti/ajenti
exploit-db.comexploit-db.com/exploits/48929
vulncheck.comvulncheck.com/advisories/ajenti-remote-code-execution

Frequently asked

questions

Yes. If the Ajenti management interface is reachable from an attacker's machine and the authentication can be bypassed or satisfied, the terminal API can be used to execute commands remotely.

The description notes an authentication bypass in conjunction with the terminal endpoint, meaning that either weak or compromised credentials, or flaws in the authentication layer, can allow an attacker to reach command execution. In practice, any path that grants access to /api/terminal/create poses a risk.

The safest pattern is to avoid exposing general-purpose command execution or interactive terminals directly through web APIs. Where such functionality is unavoidable, enforce strict authentication and authorization, constrain the allowed commands, and isolate the execution environment so that it cannot affect the broader system.

Design administrative interfaces with the assumption that network-exposed APIs will be probed by attackers: minimize functionality, avoid exposing raw shell access, apply least privilege, and subject all command-executing code to thorough security review and automated checks. Complement this with strong network segmentation, secure defaults, and continuous monitoring for anomalous use of administrative endpoints.

Find out what's already
exploitable in your codebase.