CVE-2023-24816: IPython command injection in set_term_title

CVE-2023-24816 · Severity: low · CVSS 3.1 · Published 2023-02-10

IPython is an interactive Python shell used by data scientists and developers. A command injection vulnerability in its terminal title-setting function allows an attacker to execute arbitrary commands if a user changes into a specially-named directory on Windows systems with a specific Python build lacking ctypes support. This could lead to unauthorized code execution and system compromise.

Technologies: ipython (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2023-24816 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2023-24816 being exploited in the wild.
How severe is CVE-2023-24816?
Low severity, with a CVSS score of 3.1, published 10 February 2023.
Which products and versions are affected?
ipython (PyPI) ECOSYSTEM:introduced=0,fixed=8.10.0, GIT:introduced=0,fixed=385d69325319a5972ee9b5983638e3617f21cb1f|ECOSYSTEM:introduced=0,fixed=8.10.0.
Is there a fix for CVE-2023-24816?
Yes. ipython (PyPI): upgrade to 8.10.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2023-24816 attacked?
It is attacked with local access.
Am I affected by CVE-2023-24816?
Check whether you run ipython (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • ipython (PyPI): upgrade to 8.10.0 or later
    pip install "ipython>=8.10.0"

Technical details

The vulnerability is a command injection (CWE-78, CWE-20) in the set_term_title function in IPython.utils.terminal.py, which unsafely passes unsanitized input directly to os.system() on Windows. Attack requires: Windows OS, Python built without ctypes, set_term_title enabled, and user interaction (cd into attacker-controlled directory with shell metacharacters in its name). An attacker can inject arbitrary shell commands via directory names; for example, a directory named "&& echo pwn > pwn.txt" would create a file when the user cds into it. The function is effectively dead code in normal IPython usage because IPython depends on ctypes elsewhere, but could pose risk if used as a library. Fixed in IPython 8.10.0 and later.

Affected products

  • IPython IPython <8.10.0

Identifiers

  • CVE-2023-24816
  • GHSA-29gw-9793-fvw7
  • PYSEC-2023-17

Timeline

  • 2023-02-10: disclosed
  • 2023-02-10: patched: IPython 8.10.0 and later

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.