CVE-2025-64714: PrivateBin's template-switching feature allows arbitrary local file inclusion through path traversal

Published Nov 13, 2025
·
Updated

Summary

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 RCE.

Affected versions

PrivateBin versions since 1.7.7.

Conditions

- templateselection got enabled in cfg/conf.php - Visitor sets a cookie template pointing to an existing PHP file without it's suffix, using a path relative to the tpl folder. Absolute paths do not work.

Impact

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.

Impact analysis In detail, we have analyzed different ways of exploiting this vulnerability and found no way to cause a full remote code execution (RCE) vulnerability or denial of service (DoS) as recursive includes, e.g., are not possible.

Generally, it is again notably to remember only PHP files of the local filesystem can be included. That's why potentially at risk PrivateBin PHP files have been analyzed.

the PrivateBin config file is by default protected as it prevents access itself resulting in a 403 HTTP status code. This is called the “(PHP) protection line”. Likewise, the paste data cannot be accessed due to that “protection line”. Each created file contains the same line protecting it against PHP execution/inclusion. As for the salt, purge and trafficlimiter files, they get included, but no data is displayed (variables or comments only), and a webserver specific error message is returned. When one tries to include index.php, you get a PHP error (possibly visible, depending on the webserver setup), due to define being called twice. With any of the files in lib and likely those in vendor (we have not verified each dependency), code is only declared and not executed and the result is again a webserver specific error message. With the scripts in bin, the result is an error message, but code is executed to some extent, but you cannot pass arguments to any administrative scripts [as they are read via $SERVER['argc']](https://github.com/PrivateBin/PrivateBin/blob/d32ac29925066c668241a165264c76de051398e3/bin/administration#L357C37-L357C54).

That said, the vulnerability could be used to chain more attacks or execute other non-PrivateBin related PHP files on the host system, if such other files exist and the (relative) path to them can be guessed. Also, should for some reason the PHP “protection line” be missing on your deployment the impact could be much worse and e.g. data like the URL shortener token or the database configuration from the configuration file could possibly be exfiltrated.

Real-life impact

PrivateBin has checked all instances versioned 1.7.7 and above listed in the PrivateBin directory and did find 11 instances that had the template switcher enabled. The following script was used to detect this:

shell for URL in $( curl --silent --header 'Accept: application/json' 'https://privatebin.info/directory/api?top=100&version=1.7.7' | jq --raw-output '.[].url' ) $( curl --silent --header 'Accept: application/json' 'https://privatebin.info/directory/api?top=100&version=1.7.8' | jq --raw-output '.[].url' ) $( curl --silent --header 'Accept: application/json' 'https://privatebin.info/directory/api?top=100&version=2' | jq --raw-output '.[].url' ) do curl --silent "$URL" | grep -q 'id="template"' && echo "$URL uses template switcher" done

None of these instances had an unprotected PrivateBin configuration file in use. The following script was used and may be adapted to check any single instance:

shell curl --silent --cookie 'template=../cfg/conf' https://privatebin.net

Technical Description

Users can select their preferred template via the template cookie, as seen in TemplateSwitcher::getSelectedByUserTemplate:

php private static function getSelectedByUserTemplate(): ?string { $selectedTemplate = null; $templateCookieValue = $COOKIE['template'] ?? '';

if (self::isTemplateAvailable($templateCookieValue)) { $selectedTemplate = $templateCookieValue; }

return $selectedTemplate; }

In this commit, introduced in 1.7.7, the TemplateSwitcher::isTemplateAvailable method went from this:

php public static function isTemplateAvailable(string $template): bool { return inarray($template, self::getAvailableTemplates()); }

to this:

php public static function isTemplateAvailable(string $template): bool { $available = inarray($template, self::getAvailableTemplates());

if (!$available && !View::isBootstrapTemplate($template)) { $path = View::getTemplateFilePath($template); $available = fileexists($path); }

return $available; }

The new code will now blindly trust $template, unless it starts with the string bootstrap-.

View::getTemplateFilePath will return PATH . 'tpl' . DIRECTORYSEPARATOR . $file . '.php', allowing directory traversal, but preventing non-PHP files to be included.

View::draw will then include the user-submitted template:

php public function draw($template) { $path = self::getTemplateFilePath($template); if (!fileexists($path)) { throw new Exception('Template ' . $template . ' not found!', 80); } extract($this->variables); include $path; }

Note: this is only possible if templateselection configuration is enabled, or if no template has been set. The template will be rewritten if this condition isn't met:

php private function setDefaultTemplate() { $templates = $this->conf->getKey('availabletemplates'); $template = $this->conf->getKey('template'); TemplateSwitcher::setAvailableTemplates($templates); TemplateSwitcher::setTemplateFallback($template);

// force default template, if template selection is disabled and a default is set if (!$this->conf->getKey('templateselection') && !empty($template)) { $COOKIE['template'] = $template; setcookie('template', $template, array('SameSite' => 'Lax', 'Secure' => true)); } }

Reproduction Steps

1. Configure PrivateBin with templateselection = true (default template list is fine). 2. Send a request with a malicious template cookie like template=../cfg/conf, where the relative path points to a PHP file without its file suffix 3. The script now includes the select PHP file (leading to a 500 in that specific case).

Mitigation

Patches

The issue has been patched in version 2.0.3.

Workarounds

Set templateselection = false in cfg/conf.php or remove it, it's default is false.

Credits

PrivateBin would like to thank Benoit Esnard, who reported this vulnerability.

In general, PrivateBin would like to thank everyone reporting issues and potential vulnerabilities to us.

If a user suspects they have found a vulnerability or potential security risk, PrivateBin kindly asks them to follow the security policy and report it to PrivateBin. After submssion the report is assessed and necessary actions will be taken to address it.

Timeline

- 2025-11-09 Received report via GitHub Security Advisory - 2025-11-10 Discussed and reproduced issue, wrote a unit test case based on this, started work on a patch - 2025-11-11 Further work on patch, refactored related code - 2025-11-12 Released patch with PrivateBin 2.0.3

Other sources

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

— MITRE

PrivateBin's template-switching feature allows arbitrary local file inclusion through path traversal

— Packagist

Affected Software

3 affected componentsFixes available
PrivateBin PrivateBin>=1.7.7<2.0.3
composer/privatebin/privatebin>=1.7.7<2.0.3
2.0.3
composer/privatebin/privatebin>=1.7.7, <2.0.3
2.0.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/privatebin/privatebin to a version that resolves this vulnerability.

    Fixed in 2.0.3
  2. Upgrade

    Upgrade PrivateBin to a version that resolves this vulnerability.

    Fixed in 2.0.3
  3. Configuration

    Set templateselection = false in cfg/conf.php, or remove the setting entirely, to disable template selection.

    PrivateBin templateselection = false

Event History

Nov 13, 2025
CVE Published
via MITRE·03:16 PM
Data Sourced
via MITRE·03:16 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·04:15 PM
DescriptionSeverityWeakness
Nov 14, 2025
Advisory Published
via GitHub·08:33 PM
Data Sourced
via GitHub·08:33 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Packagist·08:33 PM
DescriptionSeverityAffected Software
May 7, 2026
Exploit Published
via GitHub·08:01 PM

Frequently Asked Questions

1

What is the severity of CVE-2025-64714?

CVE-2025-64714 is classified as a moderate severity vulnerability due to its potential for unauthorized file access.

2

How do I fix CVE-2025-64714?

To fix CVE-2025-64714, upgrade PrivateBin to version 2.0.3 or later where the vulnerability has been addressed.

3

What type of vulnerability is CVE-2025-64714?

CVE-2025-64714 is classified as a Local File Inclusion vulnerability that can be exploited if the template-switching feature is enabled.

4

Which versions of PrivateBin are affected by CVE-2025-64714?

CVE-2025-64714 affects PrivateBin versions between 1.7.7 and 2.0.2 inclusive.

5

What configuration setting increases the risk of CVE-2025-64714?

The risk of CVE-2025-64714 increases when the 'templateselection' feature is enabled in the PrivateBin configuration.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203