CVE-2019-14868

7.4 HIGH

📋 TL;DR

CVE-2019-14868 is a command injection vulnerability in ksh (KornShell) that allows attackers to bypass environment restrictions and execute arbitrary shell commands. This affects systems using ksh version 20120801 where attackers can control specific environment variables. Remote exploitation is possible if services allow unauthenticated users to set these variables.

💻 Affected Systems

Products:
  • ksh (KornShell)
  • AT&T AST ksh
  • systems using ksh as default shell
Versions: ksh version 20120801 specifically
Operating Systems: Linux distributions, Unix-like systems, macOS (pre-Catalina)
Default Config Vulnerable: ⚠️ Yes
Notes: Affects systems where ksh is installed and used, particularly where environment variables can be influenced by untrusted sources.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution with the privileges of the ksh process, potentially leading to full system compromise.

🟠

Likely Case

Local privilege escalation or command execution in multi-user environments where users can influence environment variables.

🟢

If Mitigated

Limited impact if proper input validation and environment sanitization are implemented.

🌐 Internet-Facing: MEDIUM - Exploitable remotely only if services allow environment variable injection.
🏢 Internal Only: HIGH - Local users can exploit this for privilege escalation in shared environments.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires ability to set specific environment variables (ENV, FPATH). Public disclosure includes technical details.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Patched in ksh versions after 20120801, specific patches vary by distribution

Vendor Advisory: https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2019-14868

Restart Required: No

Instructions:

1. Update ksh package using system package manager
2. For RedHat/CentOS: yum update ksh
3. For Debian/Ubuntu: apt-get update && apt-get install ksh
4. For macOS: Update to Catalina or later, or install patched version

🔧 Temporary Workarounds

Restrict environment variable usage

linux

Limit ability to set ENV and FPATH environment variables in vulnerable services

export ENV=/dev/null
unset FPATH

Use alternative shell

linux

Change default shell to bash or other unaffected shell for vulnerable users/services

chsh -s /bin/bash username

🧯 If You Can't Patch

  • Implement strict input validation for all services accepting environment variables
  • Use mandatory access controls (SELinux/AppArmor) to limit ksh process capabilities

🔍 How to Verify

Check if Vulnerable:

Check ksh version: ksh --version 2>&1 | grep -i version

Check Version:

ksh --version 2>&1 | head -1

Verify Fix Applied:

Verify updated version is installed and test with known exploit vectors

📡 Detection & Monitoring

Log Indicators:

  • Unusual ksh process execution with unexpected environment variables
  • Failed attempts to set ENV/FPATH variables

Network Indicators:

  • Network services allowing environment variable injection

SIEM Query:

process.name:"ksh" AND (env.ENV:* OR env.FPATH:*)

🔗 References

📤 Share & Export