fix(dependencies): update dependency pyrofork to v2.3.69 [security]#459
Closed
renovate[bot] wants to merge 1 commit intov7from
Closed
fix(dependencies): update dependency pyrofork to v2.3.69 [security]#459renovate[bot] wants to merge 1 commit intov7from
renovate[bot] wants to merge 1 commit intov7from
Conversation
| datasource | package | from | to | | ---------- | -------- | ------ | ------ | | pypi | pyrofork | 2.3.61 | 2.3.69 |
Contributor
Author
Renovate Ignore NotificationBecause you closed this PR without merging, Renovate will ignore this update ( If you accidentally closed this PR, or if you changed your mind: rename this PR to get a fresh replacement PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
==2.3.61→==2.3.69GitHub Vulnerability Alerts
CVE-2025-67720
Summary
The
download_mediamethod in Pyrofork does not sanitize filenames received from Telegram messages before using them in file path construction. This allows a remote attacker to write files to arbitrary locations on the filesystem by sending a specially crafted document with path traversal sequences (e.g.,../) or absolute paths in the filename.Details
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_nameattribute from the media object. This attribute originates from Telegram'sDocumentAttributeFilenameand is controlled by the message sender.Vulnerable Code Path
Step 1: In
pyrogram/methods/messages/download_media.py(lines 145-151):When a user calls
download_media(message)ordownload_media(message, "downloads/"), theos.path.split()returns an empty filename, causing the code to usemedia_file_namewhich is attacker-controlled.Step 2: In
pyrogram/client.py(line 1125):The
os.path.join()function does not prevent path traversal. Whenfile_namecontains../sequences or is an absolute path, it allows writing outside the intended download directory.Why the existing
isabscheck is insufficientThe check at line 153 in
download_media.py:This check only handles absolute paths by skipping the directory prefix, but:
../,os.path.isabs()returnsFalse, so the check doesn't catch itos.path.join()in the next step will still use the absolute path directlyPoC
The following Python script demonstrates the vulnerability by simulating the exact code logic from
download_media.pyandclient.py:How to Run
Save the above script and run:
Expected Output
Why This Proves the Vulnerability
download_media.pyandclient.py../../../tmp/malicious_filecauses the path to escape from/tmp/tmpXXX/downloads/to/tmp/malicious_fileos.path.join()andos.path.abspath()behavior is deterministic - this will work the same way in the real libraryImpact
Who is affected?
await client.download_media(message)is affectedConditions required for exploitation
Potential consequences
Recommended Fix
Add filename sanitization in
download_media.pyafter line 151:This ensures that only the filename component is used, stripping any directory traversal sequences or absolute paths.
Thank you for your time in reviewing this report. Please let me know if you need any additional information or clarification.
Pyrofork has a Path Traversal in download_media Method
CVE-2025-67720 / GHSA-6h2f-wjhf-4wjx
More information
Details
Summary
The
download_mediamethod in Pyrofork does not sanitize filenames received from Telegram messages before using them in file path construction. This allows a remote attacker to write files to arbitrary locations on the filesystem by sending a specially crafted document with path traversal sequences (e.g.,../) or absolute paths in the filename.Details
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_nameattribute from the media object. This attribute originates from Telegram'sDocumentAttributeFilenameand is controlled by the message sender.Vulnerable Code Path
Step 1: In
pyrogram/methods/messages/download_media.py(lines 145-151):When a user calls
download_media(message)ordownload_media(message, "downloads/"), theos.path.split()returns an empty filename, causing the code to usemedia_file_namewhich is attacker-controlled.Step 2: In
pyrogram/client.py(line 1125):The
os.path.join()function does not prevent path traversal. Whenfile_namecontains../sequences or is an absolute path, it allows writing outside the intended download directory.Why the existing
isabscheck is insufficientThe check at line 153 in
download_media.py:This check only handles absolute paths by skipping the directory prefix, but:
../,os.path.isabs()returnsFalse, so the check doesn't catch itos.path.join()in the next step will still use the absolute path directlyPoC
The following Python script demonstrates the vulnerability by simulating the exact code logic from
download_media.pyandclient.py:How to Run
Save the above script and run:
Expected Output
Why This Proves the Vulnerability
download_media.pyandclient.py../../../tmp/malicious_filecauses the path to escape from/tmp/tmpXXX/downloads/to/tmp/malicious_fileos.path.join()andos.path.abspath()behavior is deterministic - this will work the same way in the real libraryImpact
Who is affected?
await client.download_media(message)is affectedConditions required for exploitation
Potential consequences
Recommended Fix
Add filename sanitization in
download_media.pyafter line 151:This ensures that only the filename component is used, stripping any directory traversal sequences or absolute paths.
Thank you for your time in reviewing this report. Please let me know if you need any additional information or clarification.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:NReferences
This data is provided by OSV and the GitHub Advisory Database (CC-BY 4.0).
Release Notes
Mayuri-Chan/pyrofork (pyrofork)
v2.3.69Compare Source
v2.3.68Compare Source
v2.3.67Compare Source
v2.3.66Compare Source
v2.3.65Compare Source
v2.3.64Compare Source
v2.3.63Compare Source
v2.3.62Compare Source
Configuration
📅 Schedule: Branch creation - "" in timezone Europe/Paris, Automerge - At any time (no schedule defined).
🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.