Security Vulnerability Report
中文
CVE-2025-67720 CVSS 6.5 MEDIUM

CVE-2025-67720

Published: 2025-12-11 02:16:19
Last Modified: 2026-04-15 00:35:42

Description

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.

CVSS Details

CVSS Score
6.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N

Configurations (Affected Products)

No configuration data available.

Pyrofork <= 2.3.68

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import asyncio from pyrogram import Client # 恶意文件名示例:使用路径遍历序列 # 攻击者发送的文件名:../../../tmp/pwned.txt # 这将导致文件被写入到/tmp/pwned.txt而非预期的下载目录 async def exploit_download(): """ CVE-2025-67720 PoC - Path Traversal in Pyrofork download_media This PoC demonstrates how an attacker can trigger the path traversal vulnerability by sending a message with a crafted file_name that contains path traversal sequences like '../'. """ api_id = 12345 api_hash = "your_api_hash_here" async with Client("my_account", api_id, api_hash) as client: # Simulate receiving a message with malicious filename # The actual exploitation occurs when download_media is called # without specifying a custom filename parameter # Vulnerable code path: # file_name = message.document.file_name # attacker controlled # save_path = os.path.join(download_dir, file_name) # no sanitization # Example malicious filename: malicious_filename = "../../../tmp/arbitrary_file.txt" # The download_media method will use this filename directly # resulting in file being written outside the intended directory print(f"Malicious filename: {malicious_filename}") print("This filename will be used if download_media is called without custom filename") if __name__ == "__main__": asyncio.run(exploit_download()) # Defense: Always specify a sanitized custom filename # await message.download(file_name=os.path.basename(message.document.file_name))

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-67720", "sourceIdentifier": "[email protected]", "published": "2025-12-11T02:16:19.090", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "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."}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:N", "baseScore": 6.5, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "HIGH", "availabilityImpact": "NONE"}, "exploitabilityScore": 2.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-22"}]}], "references": [{"url": "https://github.com/Mayuri-Chan/pyrofork/commit/2f2d515575cc9c360bd74340a61a1d2b1e1f1f95", "source": "[email protected]"}, {"url": "https://github.com/Mayuri-Chan/pyrofork/security/advisories/GHSA-6h2f-wjhf-4wjx", "source": "[email protected]"}]}}