Concrete5 <= 8.5.5 (Logging Settings) Phar Deserialization Vulnerability

• Software Link:

https://www.concrete5.org

• Affected Versions:

Version 8.5.5 and prior versions.

• Vulnerability Description:

The vulnerable code is located within the /concrete/controllers/single_page/dashboard/system/environment/logging.php script. Specifically, into the Logging::update_logging() method:

    public function update_logging()
    {
        $config = $this->app->make('config');
        $request = $this->request;

        if (!$this->token->validate('update_logging')) {
            return $this->showError($this->token->getErrorMessage());
        }

        // Load in variables from the request
        $mode = (string) $request->request->get('logging_mode') === 'advanced' ? 'advanced' : 'simple';
        $handler = $mode === 'simple' ? (string) $request->request->get('handler', 'database') : null;
        $logFile = $handler === 'file' ? (string) $request->request->get('logFile') : null;
        $enableDashboardReport = $request->request->get('enable_dashboard_report') ? true : false;
        $loggingLevel = strtoupper((string) $request->request->get('logging_level'));
        $intLogErrorsPost = $request->request->get('ENABLE_LOG_ERRORS') === 1 ? 1 : 0;
        $intLogEmailsPost = $request->request->get('ENABLE_LOG_EMAILS') === 1 ? 1 : 0;
        $intLogApiPost = $request->request->get('ENABLE_LOG_API') === 1 ? 1 : 0;


        // Handle 'file' based logging
        if ($handler === 'file') {
            $directory = dirname($logFile);

            // Validate the file name
            if (pathinfo($logFile, PATHINFO_EXTENSION) !== 'log') {
                return $this->showError(t('The filename provided must be a valid filename and end with .log'));
            }

            // Validate the file path, create the log file if needed
            if (!file_exists($logFile)) {

User input passed through the “logFile” request parameter is not properly sanitized before being used in a call to the file_exists() function at line 91. This can be exploited by malicious users to inject arbitrary PHP objects into the application scope (PHP Object Injection via phar:// stream wrapper), allowing them to carry out a variety of attacks, such as executing arbitrary PHP code. Successful exploitation of this vulnerability requires an administrator account.

• Solution:

No official solution is currently available.

• Disclosure Timeline:

[20/12/2020] – Vendor notified through HackerOne
[22/12/2020] – Vendor asks suggestions to fix the issue, feedback provided
[18/03/2021] – Version 8.5.5 released, vulnerability not fixed
[02/06/2021] – Asked for an update, no response
[06/07/2021] – Asked for an update, no response
[16/07/2021] – CVE number assigned
[19/07/2021] – Public disclosure

• CVE Reference:

The Common Vulnerabilities and Exposures project (cve.mitre.org)
has assigned the name CVE-2021-36766 to this vulnerability.

• Credits:

Vulnerability discovered by Egidio Romano.

• Other References:

https://hackerone.com/reports/1063039