VYPR
Low severityNVD Advisory· Published Feb 10, 2023· Updated Mar 10, 2025

set_term_title command injection in ipython

CVE-2023-24816

Description

IPython (Interactive Python) is a command shell for interactive computing in multiple programming languages, originally developed for the Python programming language. Versions prior to 8.1.0 are subject to a command injection vulnerability with very specific prerequisites. This vulnerability requires that the function IPython.utils.terminal.set_term_title be called on Windows in a Python environment where ctypes is not available. The dependency on ctypes in IPython.utils._process_win32 prevents the vulnerable code from ever being reached in the ipython binary. However, as a library that could be used by another tool set_term_title could be called and hence introduce a vulnerability. Should an attacker get untrusted input to an instance of this function they would be able to inject shell commands as current process and limited to the scope of the current process. Users of ipython as a library are advised to upgrade. Users unable to upgrade should ensure that any calls to the IPython.utils.terminal.set_term_title function are done with trusted or filtered input.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
ipythonPyPI
< 8.10.08.10.0

Affected products

1

Patches

2
385d69325319

Merge pull request from GHSA-29gw-9793-fvw7

https://github.com/ipython/ipythonMatthias BussonnierFeb 10, 2023via ghsa
3 files changed · +21 25
  • docs/source/whatsnew/version8.rst+12 0 modified
    @@ -2,6 +2,18 @@
      8.x Series
     ============
     
    +
    +IPython 8.9.1
    +-------------
    +
    +Out of schedule release of IPython with minor fixes to patch a potential CVE-2023-24816.
    +This is a really low severity CVE that you most likely are not affected by unless:
    +
    + - You are on windows.
    + - You have a custom build of Python without ``_ctypes``
    + - You cd or start IPython or Jupyter in untrusted directory which names may be valid shell commands.
    +
    +
     .. _version 8.9.0:
     
     IPython 8.9.0
    
  • IPython/__init__.py+1 1 modified
    @@ -63,7 +63,7 @@
     version_info = release.version_info
     # list of CVEs that should have been patched in this release.
     # this is informational and should not be relied upon.
    -__patched_cves__ = {"CVE-2022-21699"}
    +__patched_cves__ = {"CVE-2022-21699", "CVE-2023-24816"}
     
     
     def embed_kernel(module=None, local_ns=None, **kwargs):
    
  • IPython/utils/terminal.py+8 24 modified
    @@ -91,30 +91,14 @@ def _restore_term_title_xterm():
             _set_term_title = _set_term_title_xterm
             _restore_term_title = _restore_term_title_xterm
     elif sys.platform == 'win32':
    -    try:
    -        import ctypes
    -
    -        SetConsoleTitleW = ctypes.windll.kernel32.SetConsoleTitleW
    -        SetConsoleTitleW.argtypes = [ctypes.c_wchar_p]
    -    
    -        def _set_term_title(title):
    -            """Set terminal title using ctypes to access the Win32 APIs."""
    -            SetConsoleTitleW(title)
    -    except ImportError:
    -        def _set_term_title(title):
    -            """Set terminal title using the 'title' command."""
    -            global ignore_termtitle
    -
    -            try:
    -                # Cannot be on network share when issuing system commands
    -                curr = os.getcwd()
    -                os.chdir("C:")
    -                ret = os.system("title " + title)
    -            finally:
    -                os.chdir(curr)
    -            if ret:
    -                # non-zero return code signals error, don't try again
    -                ignore_termtitle = True
    +    import ctypes
    +
    +    SetConsoleTitleW = ctypes.windll.kernel32.SetConsoleTitleW
    +    SetConsoleTitleW.argtypes = [ctypes.c_wchar_p]
    +
    +    def _set_term_title(title):
    +        """Set terminal title using ctypes to access the Win32 APIs."""
    +        SetConsoleTitleW(title)
     
     
     def set_term_title(title):
    
991849c247fc

Fix CVE-2023-24816 by removing legacy code.

https://github.com/ipython/ipythonKonstantin WeddigeDec 3, 2022via ghsa
3 files changed · +21 25
  • docs/source/whatsnew/version8.rst+12 0 modified
    @@ -2,6 +2,18 @@
      8.x Series
     ============
     
    +
    +IPython 8.9.1
    +-------------
    +
    +Out of schedule release of IPython with minor fixes to patch a potential CVE-2023-24816.
    +This is a really low severity CVE that you most likely are not affected by unless:
    +
    + - You are on windows.
    + - You have a custom build of Python without ``_ctypes``
    + - You cd or start IPython or Jupyter in untrusted directory which names may be valid shell commands.
    +
    +
     .. _version 8.9.0:
     
     IPython 8.9.0
    
  • IPython/__init__.py+1 1 modified
    @@ -63,7 +63,7 @@
     version_info = release.version_info
     # list of CVEs that should have been patched in this release.
     # this is informational and should not be relied upon.
    -__patched_cves__ = {"CVE-2022-21699"}
    +__patched_cves__ = {"CVE-2022-21699", "CVE-2023-24816"}
     
     
     def embed_kernel(module=None, local_ns=None, **kwargs):
    
  • IPython/utils/terminal.py+8 24 modified
    @@ -91,30 +91,14 @@ def _restore_term_title_xterm():
             _set_term_title = _set_term_title_xterm
             _restore_term_title = _restore_term_title_xterm
     elif sys.platform == 'win32':
    -    try:
    -        import ctypes
    -
    -        SetConsoleTitleW = ctypes.windll.kernel32.SetConsoleTitleW
    -        SetConsoleTitleW.argtypes = [ctypes.c_wchar_p]
    -    
    -        def _set_term_title(title):
    -            """Set terminal title using ctypes to access the Win32 APIs."""
    -            SetConsoleTitleW(title)
    -    except ImportError:
    -        def _set_term_title(title):
    -            """Set terminal title using the 'title' command."""
    -            global ignore_termtitle
    -
    -            try:
    -                # Cannot be on network share when issuing system commands
    -                curr = os.getcwd()
    -                os.chdir("C:")
    -                ret = os.system("title " + title)
    -            finally:
    -                os.chdir(curr)
    -            if ret:
    -                # non-zero return code signals error, don't try again
    -                ignore_termtitle = True
    +    import ctypes
    +
    +    SetConsoleTitleW = ctypes.windll.kernel32.SetConsoleTitleW
    +    SetConsoleTitleW.argtypes = [ctypes.c_wchar_p]
    +
    +    def _set_term_title(title):
    +        """Set terminal title using ctypes to access the Win32 APIs."""
    +        SetConsoleTitleW(title)
     
     
     def set_term_title(title):
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

9

News mentions

0

No linked articles in our index yet.