New MCP server — Bring vulnerability intelligence into your AI
Back to feed

CVE-2025-64714

NVDCIRCLENISA

EUVD-2025-175312 · Published Nov 14, 2025

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

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 traffic_limiter 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'].

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:

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:

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:

    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:

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

to this:

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

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

        return $available;
    }

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

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

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

    public function draw($template)
    {
        $path = self::getTemplateFilePath($template);
        if (!file_exists($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:

    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

Technologies

Privatebin Privatebin

Weaknesses

CWE-73CWE-98CWE-23

CVSS scores

  • v3.15.8CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:N/A:N

MITRE ATT&CK

Inferred

Where this vulnerability fits in an attack

Initial Access Execution Stealth Defense Impairment

References

Potentially impacted assets

See if this affects your attack surface

Latest trending attack

Criticalyesterday

Google Brotli decoder - Remote Code Execution via compressed requests (Exploitation Check)

This control is the second step of the Patrowl response to CVE-2026-111497 (Node2Shell). It complements the first control of 22 October 2026, which focused on the Node.js runtime, and does not replace it. Why a second control CVE-2026-111497 is an out-of-bounds write in the Google Brotli decoder, the library that decompresses Brotli ("br") data. It was first published as a Node.js vulnerability, because Node.js bundles this decoder. Later publications showed that the flaw is in the library itself. Every product that embeds an affected version of the decoder is concerned, whatever its language or vendor. A public proof of concept demonstrates code execution. Any server that decompresses request bodies sent with "Content-Encoding: br" exposes the decoder to unauthenticated attackers. Known cases include Express 5 and NestJS 11 on Node.js, Koa and Fastify setups, Bun, Envoy and Istio with request decompression enabled, and any application or reverse proxy that decodes Brotli request bodies with an affected library. The flaw also works in the other direction. A malicious server can compromise an unpatched client that decodes a Brotli response, for example Node.js fetch(), Python clients (requests, httpx, aiohttp, Scrapy) with the Brotli or brotlicffi package, or libcurl builds with Brotli support. What this control checks Patrowl sends small, valid Brotli-compressed requests to each asset and observes whether the server decodes them. The check does not depend on the technology: it detects the behaviour, whatever the stack behind it. These requests are what any legitimate client could send. They never reach the vulnerable code path and cannot affect the availability of the service. How to read the result Potentially impacted means the asset decodes Brotli request bodies: the attack surface is exposed. It does not confirm that the asset is vulnerable. The version of the Brotli decoder in use is not visible from the outside. This check covers applications that parse request bodies on their root path. A Not impacted result does not rule out exposure on other routes, nor on the client side. Checking the versions on the servers remains the only exhaustive verification. Affected and fixed versions Google Brotli 1.0.3 to 1.2.0 are affected, fixed in 1.0.10, 1.1.1 and 1.2.1. Fixed releases of the main products embedding it: Node.js 22.23.4, 24.22.1 and 26.12.1 (end-of-life lines 20.x and older and 25.x receive no fix), Bun 1.4.4, Envoy 1.37.8, 1.38.6, 1.39.3 and 1.40.0, Istio 1.29.9, 1.30.6 and 1.31.2, Python Brotli 1.2.1 and brotlicffi 1.2.1.0. Products that link against the system library depend on the Brotli package of the Linux distribution. Recommendations Update every component that embeds the Brotli decoder (only real fix). Start with the assets flagged by this control. Restart the processes after the update. Rebuild containers, single-executable applications and appliances that bundle an affected runtime or library. Reduce the exposure until the update is deployed. Reject requests with "Content-Encoding: br" at the reverse proxy, load balancer or WAF, case-insensitively and including lists such as "gzip, br". On Envoy and Istio, disable request decompression for Brotli. Review outbound calls. List the features that fetch content from servers you do not control, and patch the services that host them first.

Take 15 minutes to discover our platform with our experts

Patrowl Intel platform screenshot