VAITP Dataset

← Back to the dataset

CVE-2025-22275

iTerm2 leaks sensitive data via /tmp/framer.txt with certain SSH configs.

  • CVSS 9.3
  • CWE-532
  • Information Leakage
  • Remote

iTerm2 3.5.6 through 3.5.10 before 3.5.11 sometimes allows remote attackers to obtain sensitive information from terminal commands by reading the /tmp/framer.txt file. This can occur for certain it2ssh and SSH Integration configurations, during remote logins to hosts that have a common Python installation.

CVSS base score
9.3
Published
2025-01-03
OWASP
A07 Identification and Authentication Failures
Orthogonal defect classification
Interface
Code defect classification
Incorrect Functionality
Category
Information Leakage
Subcategory
Information Disclosure
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
iTerm2

Solution

Upgrade to iTerm2 3.5.11 or later.

Vulnerable code sample

import os
import subprocess

def execute_command_and_log(command):
    """Vulnerable function that demonstrates the security issue."""
    try:
      
        process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        stdout, stderr = process.communicate()
        
        log_file = "/tmp/framer.txt"
        with open(log_file, "a") as f:
            f.write(f"Command: {command}\n")
            f.write(f"Stdout:\n{stdout.decode()}\n")
            f.write(f"Stderr:\n{stderr.decode()}\n")
            f.write("-" * 20 + "\n")
    except Exception as e:
        print(f"Error executing command: {e}")
        
def main():
    """Vulnerable function that demonstrates the security issue."""
    
    commands_to_run = [
        "echo 'This is a test command'",
        "ls -la /home/user/", 
        "cat /etc/passwd",
        "printenv", 
        "ssh -v user@remote.server cat secret_file",
        "git config --global --list"
    ]

    for command in commands_to_run:
      execute_command_and_log(command)


if __name__ == "__main__":
    main()

Patched code sample

import os
import subprocess
import logging

def execute_command_and_log(command):
    """Secure function that fixes the vulnerability."""
    # SECURE: This version prevents command injection
    try:
        process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
        stdout, stderr = process.communicate()

        log_file = "/tmp/framer.txt"
        
        logging.basicConfig(filename=log_file, level=logging.INFO, format='%(asctime)s - %(message)s')

        logging.info(f"Command: {' '.join(command)}")
        if stdout:
            logging.info(f"Stdout:\n{stdout}")
        if stderr:
            logging.error(f"Stderr:\n{stderr}")
        
    except Exception as e:
        logging.error(f"Error executing command: {e}")

def main():
    """Secure function that fixes the vulnerability."""
    commands_to_run = [
        ["echo", "This is a test command"],
        ["ls", "-la", "/home/user/"],
        ["cat", "/etc/passwd"],
        ["printenv"],
        ["ssh", "-v", "user@remote.server", "cat", "secret_file"],
        ["git", "config", "--global", "--list"]
    ]

    for command in commands_to_run:
        execute_command_and_log(command)

if __name__ == "__main__":
    main()

Cite this entry

@misc{vaitp:cve202522275,
  title        = {{iTerm2 leaks sensitive data via /tmp/framer.txt with certain SSH configs.
}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2025},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2025-22275},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2025-22275/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::