Exploit database

GH-8c7f0e4b0e998904a1d6f7dcd99e3e7d

d-xuan/cve-2024-52510

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2024-52510

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files2

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

lib/private/IntegrityCheck/Iterator/ExcludeFoldersByPathFilterIterator.php

PHP · 1,486 bytes
<?php

declare(strict_types=1);
/**
 * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
 * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
 * SPDX-License-Identifier: AGPL-3.0-only
 */
namespace OC\IntegrityCheck\Iterator;

class ExcludeFoldersByPathFilterIterator extends \RecursiveFilterIterator {
	private $excludedFolders;

	public function __construct(\RecursiveIterator $iterator, $root = '') {
		parent::__construct($iterator);

		$appFolders = \OC::$APPSROOTS;
		foreach ($appFolders as $key => $appFolder) {
			$appFolders[$key] = rtrim($appFolder['path'], '/');
		}

		$excludedFolders = [
			rtrim($root . '/data', '/'),
			rtrim($root . '/themes', '/'),
			rtrim($root . '/config', '/'),
			rtrim($root . '/apps', '/'),
			rtrim($root . '/assets', '/'),
			rtrim($root . '/lost+found', '/'),
			// Ignore folders generated by updater since the updater is replaced
			// after the integrity check is run.
			// See https://github.com/owncloud/updater/issues/318#issuecomment-212497846
			rtrim($root . '/updater', '/'),
			rtrim($root . '/_oc_upgrade', '/'),
		];
		$customDataDir = \OC::$server->getConfig()->getSystemValueString('datadirectory', '');
		if ($customDataDir !== '') {
			$excludedFolders[] = rtrim($customDataDir, '/');
		}

		$this->excludedFolders = array_merge($excludedFolders, $appFolders);
	}

	public function accept(): bool {
		return !\in_array(
			$this->current()->getPathName(),
			$this->excludedFolders,
			true
		);
	}
}