Skip to main content

Pyrofork CVE-2025-67720

MEDIUM
Path Traversal (CWE-22)
2025-12-11 security-advisories@github.com
6.5
CVSS 3.1 · Vendor: github
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Send crafted Telegram document with traversal filename
  2. Delivery
    Victim app calls download_media default usage
  3. Exploit
    Attacker file_name bypasses isabs check
  4. Execution
    os.path.join builds path outside directory
  5. Impact
    Write file to arbitrary filesystem location

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that the victim runs Pyrofork <=2.3.68 and calls download_media() either with no filename argument or with only a directory (e.g. download_media(message) or download_media(message, "downloads/")) - the common/default usage, where os.path.split yields an empty filename and the code falls back to the attacker-controlled media file_name from Telegram's DocumentAttributeFilename. The attacker must be able to deliver a message/document to the victim account or bot and set a filename containing ../ relative traversal sequences or an absolute path (the existing os.path.isabs check does not stop relative traversal, and os.path.join honors absolute paths). Limiting factors: requires the victim application to actually trigger the media download (UI:R); if the developer passes an explicit custom filename the fallback is never reached; impact is arbitrary file write (integrity) only, with no direct confidentiality or availability impact; and only versions <=2.3.68 are affected (patched in 2.3.69).

Impact

Signals are internally consistent and point to a genuine but moderate-priority issue. The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N, base 6.5) describes a network-reachable, low-complexity, unauthenticated flaw whose impact is limited to integrity (arbitrary file write) with no confidentiality or availability loss, and which is gated by required user/application interaction (UI:R) - the victim must actually invoke download_media on an attacker's message. EPSS is low (0.32%, 23rd percentile) and the CVE is NOT on CISA KEV, so there is no evidence of active or widespread exploitation. A proof-of-concept logic-simulation script is published in the vendor GHSA advisory, so publicly available exploit code exists, but POC availability must not be conflated with in-the-wild exploitation. The realistic risk is that an exploit is trivially constructed (anyone can send a Telegram document with a ../ or absolute-path filename) yet exploitation depends entirely on a victim application running Pyrofork <=2.3.68 and calling download_media in its default/common form; this narrows real-world impact. Net: a legitimately exploitable path-traversal file-write that warrants prompt patching for affected deployments, but not an emergency given low EPSS, no KEV, bounded (integrity-only) impact, and the interaction requirement.

Exploit ScenarioDerived

An attacker sends a crafted Telegram document to a bot or user-client built on Pyrofork <=2.3.68, setting the message's DocumentAttributeFilename to a value containing path traversal sequences (e.g. ../../etc/...) or an absolute path. When the victim application calls download_media without a custom filename (the common default, or with only a directory such as download_media(message, "downloads/")), the attacker-controlled file_name flows into os.path.join path construction and the file is written outside the intended download directory to an arbitrary location. A proof-of-concept script simulating this exact logic is included in the vendor GHSA advisory.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 08, 2026

Arbitrary file write in the Pyrofork async MTProto/Telegram framework (versions 2.3.68 and earlier) lets a message sender control the filename used by download_media(), so a crafted document name containing '../' sequences or an absolute path causes files to be written outside the intended download directory. Affected applications are those that call download_media(message) or download_media(message, "downloads/") without an explicit filename, which is the documented default usage; the issue is rated CVSS 6.5 with integrity-only impact (C:N/I:H/A:N) and requires the victim application to actually perform the download (UI:R), while the network attack vector is unauthenticated (PR:N). The vendor addressed the flaw in version 2.3.69, and the GHSA advisory (GHSA-6h2f-wjhf-4wjx) ships a proof-of-concept that mirrors the vulnerable code path, though there is no CISA KEV listing or other confirmation of active exploitation and EPSS remains low at 0.32% (23rd percentile).

RemediationAI

Upgrade to Pyrofork 2.3.69 or later (pip install --upgrade "pyrofork>=2.3.69"), which is the vendor-released patch containing the os.path.basename()/null-byte sanitization from commit 2f2d515575cc9c360bd74340a61a1d2b1e1f1f95; refer to GHSA-6h2f-wjhf-4wjx for the official advisory. If upgrading is not immediately possible, the most effective compensating control is to always pass an explicit, developer-controlled filename to download_media(message, "downloads/your_name.ext") so the attacker-controlled media.file_name fallback is never reached - the trade-off is that callers lose automatic naming and must generate safe names themselves, and any code path that still omits the filename stays vulnerable. You can additionally pre-sanitize names by applying os.path.basename() and rejecting values containing '..', '/' or null bytes before use, or accept the download and then verify with os.path.realpath() that the resulting path is inside the intended download directory. Because the write is driven by an inbound Telegram message, restricting which accounts or channels may send documents to the bot (or disabling auto-download for untrusted peers) reduces exposure but degrades functionality for legitimate users, and running the bot under a low-privilege service account with a containerized or read-only-restricted filesystem limits where the arbitrary write can land without blocking the traversal itself. Note that, per available data, there is no CISA KEV entry or confirmed active exploitation, so these measures are risk reduction rather than emergency containment.

Affected Packages

pypi pyrofork fix: 2.3.69

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Pyrofork is a pure-Python asynchronous implementation of the Telegram MTProto client API, so it routinely processes attacker-influenced metadata embedded in Telegram messages. The relevant field is DocumentAttributeFilename, the Telegram document attribute that carries a user-supplied display name; Pyrofork surfaces it as media.file_name. In download_media(), the developer-supplied path argument is passed through os.path.split(), and the resulting empty filename triggers a fallback to media.file_name. The existing guard checks only os.path.isabs(file_name), which does not block relative traversal such as '../../' and which is bypassed for absolute names because the subsequent os.path.join(directory, file_name) discards the directory prefix when the second component is absolute. The joined path is then converted with os.path.abspath() and suffixed with '.temp' in client.py before the file is created, meaning the write lands on the resolved attacker-chosen location. This is classic CWE-22 path traversal arising from missing input normalization - the string is trusted as a safe path component. The upstream commit 2f2d515575cc9c360bd74340a61a1d2b1e1f1f95 fixes it by running os.path.basename() over the name, stripping null bytes, and blanking values that reduce to '', '.' or '..', thereby forcing the downloaded file to stay within the caller's directory. No CPE identifiers were supplied with the source data; the package is tracked by ecosystem coordinates as pip/pyrofork.

Know when the next one hits your stack

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (github) PRIMARY 6.5 MEDIUM
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
vuln.today AI 6.5 MEDIUM

Any sender can deliver a malicious filename over the network without authentication (PR:N) but the victim must invoke download_media (UI:R); impact is arbitrary file write, so I:H with C:N/A:N.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (github).

CVSS VectorVendor: github

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

DescriptionCVE.org

Pyrofork is a modern, asynchronous MTProto API framework. Versions 2.3.68 and earlier do not properly sanitize filenames received from Telegram messages in the download_media method before using them in file path construction. When downloading media, if the user does not specify a custom filename (which is the common/default usage), the method falls back to using the file_name attribute from the media object. The attribute originates from Telegram's DocumentAttributeFilename and is controlled by the message sender. This issue is fixed in version 2.3.69.

Threat Intelligence Overview

EPSS Score
0.3%
Top 77% exploitable
Prevalence
Low
niche Python MTProto library used by Telegram bot/client developers
Data Quality
4 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

32
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +32
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy