Exploit databaseDownload repository ZIP
GH-7feacea856188eafd49a6762828c436f
chocapikk/cve-2023-35885
Sources for CVE-2023-35885
4 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files18
chocapikk/cve-2023-35885Revision 78ece7c3f53e
- ↑..Parent directory
- Application/
- Creator/
- Deleter/
- Nginx/
- Parser/
- PhpFpm/
- Ssl/
- Updater/
- VarnishCache/
- Creator.php
- Deleter.php
- NodejsSite.php
- PhpSite.php
- PythonSite.php
- ReverseProxySite.php
- Site.php
- StaticSite.php
- Updater.php
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
src/Site/Creator.php
PHP · 8,505 bytes<?php
namespace App\Site; use App\Entity\Site as SiteEntity; use App\System\CommandExecutor; use App\System\Command\CreateUserCommand; use App\System\Command\CreateDirectoryCommand; use App\System\Command\ServiceReloadCommand; use App\System\Command\ChownCommand; use App\System\Command\FindChmodCommand; use App\System\Command\WriteFileCommand; use App\Site\Nginx\Vhost\PhpTemplate; use App\Site\Nginx\Vhost\StaticTemplate; use App\Site\Nginx\Vhost\NodejsTemplate; use App\Site\Nginx\Vhost\PythonTemplate; use App\Site\Nginx\Vhost\ReverseProxyTemplate; abstract class Creator { public const NGINX_VHOST_DIRECTORY = "\57\145\x74\143\57\x6e\147\x69\x6e\x78\x2f\x73\x69\164\x65\163\x2d\145\x6e\x61\x62\154\145\144\57"; public const NGINX_SSL_CERTIFICATES_DIRECTORY = "\57\x65\164\x63\57\156\x67\x69\x6e\170\57\163\163\154\x2d\x63\145\x72\164\x69\146\151\143\x61\164\145\163\57"; public const LOGROTATE_DIRECTORY = "\x2f\x65\x74\x63\x2f\154\x6f\147\162\x6f\x74\141\164\x65\x2e\144\x2f"; protected Site $site; protected CommandExecutor $commandExecutor; public function __construct(Site $site) { $this->site = $site; $this->commandExecutor = new CommandExecutor(); } public function createUser() : void { goto f8da8; f8da8: $siteUser = $this->site->getUser(); goto ce416; c6ffe: $createUserCommand->setPassword($siteUserPassword); goto bbc86; ce416: $siteUserPassword = $this->site->getUserPassword(); goto F6dfb; ae936: $this->commandExecutor->execute($createUserCommand); goto C42cd; e4528: $createUserCommand->createHomeDirectory(true); goto ae936; ae1d7: $createUserCommand = new CreateUserCommand(); goto Ea9f1; Bd3c2: $createUserCommand->setHomeDirectory($homeDirectory); goto e4528; C8f59: $createUserCommand->setSkeletonDirectory($skeletonDirectory); goto Bd3c2; bbc86: $createUserCommand->setShell("\x2f\142\151\x6e\x2f\142\141\x73\x68"); goto C8f59; Cd236: $skeletonDirectory = realpath(dirname(__FILE__) . "\57\56\x2e\57\56\56\57\x72\x65\163\157\165\162\143\x65\x73\57\145\x74\143\57\163\x6b\x65\x6c\x2f\x73\x69\x74\x65\x2d\165\x73\x65\x72\57"); goto ae1d7; Ea9f1: $createUserCommand->setUserName($siteUser); goto c6ffe; F6dfb: $homeDirectory = sprintf("\x2f\150\157\x6d\145\x2f\x25\163", $siteUser); goto Cd236; C42cd: } public function createRootDirectory() { goto F770d; acb64: $this->commandExecutor->execute($createRootDirectoryCommand); goto b5e46; E1826: $createRootDirectoryCommand = new CreateDirectoryCommand(); goto c089e; c089e: $createRootDirectoryCommand->setDirectory($rootDirectory); goto acb64; F770d: $rootDirectory = $this->getRootDirectory(); goto E1826; b5e46: } public function createNginxVhost() : void { goto A3e82; dbe0e: $vhostFile = sprintf("\x25\163\x2f\x25\163\x2e\x63\157\156\146", rtrim(self::NGINX_VHOST_DIRECTORY, "\57"), $domainName); goto e8234; e8234: $vhostTemplate->build(); goto B0a5b; B8e56: cd1f5: goto B64d6; A3e82: $domainName = $this->site->getDomainName(); goto b8ba8; e05fe: $writeVhostFileCommand->setFile($vhostFile); goto be88d; C8376: switch ($this->site->getType()) { case SiteEntity::TYPE_PHP: $vhostTemplate = new PhpTemplate($this->site); goto d2d7a; case SiteEntity::TYPE_NODEJS: $vhostTemplate = new NodejsTemplate($this->site); goto d2d7a; case SiteEntity::TYPE_STATIC: $vhostTemplate = new StaticTemplate($this->site); goto d2d7a; case SiteEntity::TYPE_PYTHON: $vhostTemplate = new PythonTemplate($this->site); goto d2d7a; case SiteEntity::TYPE_REVERSE_PROXY: $vhostTemplate = new ReverseProxyTemplate($this->site); goto d2d7a; } goto B8e56; B64d6: d2d7a: goto C333d; b8ba8: $vhostFileContent = $this->site->getVhostTemplate(); goto C8376; ae6e6: $writeVhostFileCommand = new WriteFileCommand(); goto e05fe; B0a5b: $vhostTemplate->removeEmptyPlaceholders(); goto a13a3; C333d: $vhostTemplate->setContent($vhostFileContent); goto dbe0e; be88d: $writeVhostFileCommand->setContent($vhostContent); goto Aba63; a13a3: $vhostContent = $vhostTemplate->getContent(); goto ae6e6; Aba63: $this->commandExecutor->execute($writeVhostFileCommand); goto bd267; bd267: } public function createLogrotateFile() { goto Ac50b; c8240: $writeLogrotateFileCommand->setContent($logrotateFileContent); goto Fdc93; a3430: $logrotateTemplate = file_get_contents($logrotateTemplateFile); goto Eb260; Fdc93: $this->commandExecutor->execute($writeLogrotateFileCommand); goto f6765; Ac50b: $siteUser = $this->site->getUser(); goto Aef49; Aef49: $logrotateTemplateFile = realpath(dirname(__FILE__) . "\57\x2e\56\57\x2e\x2e\57\x72\x65\163\157\x75\162\x63\145\x73\57\x65\164\143\x2f\154\x6f\147\162\x6f\x74\x61\x74\x65\x2f\x74\145\x6d\160\154\x61\164\x65"); goto a3430; Bbf62: $writeLogrotateFileCommand->setFile($logrotateFile); goto c8240; B8718: $logrotateFileContent = str_replace(["\173\x7b\x75\x73\145\x72\x7d\x7d", "\x7b\173\x67\x72\x6f\x75\x70\175\x7d"], [$siteUser, $siteUser], $logrotateTemplate); goto Bc356; Eb260: $logrotateFile = sprintf("\45\163\57\x25\163", rtrim(self::LOGROTATE_DIRECTORY, "\57"), $siteUser); goto B8718; Bc356: $writeLogrotateFileCommand = new WriteFileCommand(); goto Bbf62; f6765: } public function resetPermissions() : void { goto bb251; da612: $homeDirectoryChmodCommand->setDirectoryChmod(770); goto b4d14; E0be9: $chownCommand->setUser($siteUser); goto a80ea; Ae06b: $this->commandExecutor->execute($homeDirectoryChmodCommand); goto F4823; d7f8e: $userSshDirectoryChmodCommand->setFile($userSshDirectory); goto a0119; F4ffc: $homeDirectory = sprintf("\x2f\x68\157\x6d\x65\x2f\45\163", $siteUser); goto be72b; a0119: $userSshDirectoryChmodCommand->setDirectoryChmod(700); goto B1571; ceac1: $userSshDirectory = sprintf("\57\x68\x6f\155\145\x2f\45\163\x2f\x2e\x73\163\150", $siteUser); goto A694b; a46d8: $chownCommand->setFile($homeDirectory); goto a6f10; F4823: $this->commandExecutor->execute($userSshDirectoryChmodCommand); goto A8877; bb251: $siteUser = $this->site->getUser(); goto F4ffc; a6f10: $chownCommand->setRecursive(true); goto E0be9; B1571: $userSshDirectoryChmodCommand->setFileChmod(600); goto Ef414; be72b: $chownCommand = new ChownCommand(); goto a46d8; a80ea: $chownCommand->setGroup($siteUser); goto a7bbf; Ef414: $this->commandExecutor->execute($chownCommand); goto Ae06b; a7911: $homeDirectoryChmodCommand->setFile($homeDirectory); goto da612; b4d14: $homeDirectoryChmodCommand->setFileChmod(770); goto ceac1; a7bbf: $homeDirectoryChmodCommand = new FindChmodCommand(); goto a7911; A694b: $userSshDirectoryChmodCommand = new FindChmodCommand(); goto d7f8e; A8877: } public function reloadNginxService() : void { $this->reloadService("\156\x67\151\156\x78"); } protected function getRootDirectory() : string { goto f6072; cdbdb: $rootDirectory = sprintf("\57\150\157\155\145\57\x25\x73\57\x68\164\x64\x6f\x63\x73\57\x25\163", $siteUser, $rootDirectory); goto C3bce; D34f3: $rootDirectory = $this->site->getRootDirectory(); goto cdbdb; f6072: $siteUser = $this->site->getUser(); goto D34f3; C3bce: return $rootDirectory; goto c2f1f; c2f1f: } public function createPrivateKeyAndCertificate() : void { goto D78ee; df43b: $writeCertificateFileCommand->setContent($certificate->getCertificate()); goto eda60; becb6: $this->commandExecutor->execute($writeCertificateFileCommand); goto F6541; e76c9: $writeCertificateFileCommand->setFile($certificateFile); goto df43b; Cc908: $privateKeyFile = sprintf("\x25\x73\x2f\x25\163\x2e\x6b\x65\x79", rtrim(self::NGINX_SSL_CERTIFICATES_DIRECTORY, "\x2f"), $domainName); goto a157c; b8f3f: $writePrivateKeyFileCommand->setFile($privateKeyFile); goto a21cb; eda60: $this->commandExecutor->execute($writePrivateKeyFileCommand); goto becb6; E2df1: $writeCertificateFileCommand = new WriteFileCommand(); goto e76c9; a157c: $certificateFile = sprintf("\45\x73\x2f\x25\163\x2e\x63\x72\x74", rtrim(self::NGINX_SSL_CERTIFICATES_DIRECTORY, "\57"), $domainName); goto b6d4f; d2000: $certificate = $this->site->getCertificate(); goto Cc908; D78ee: $domainName = $this->site->getDomainName(); goto d2000; b6d4f: $writePrivateKeyFileCommand = new WriteFileCommand(); goto b8f3f; a21cb: $writePrivateKeyFileCommand->setContent($certificate->getPrivateKey()); goto E2df1; F6541: } public function reloadService($serviceName) { goto E15a6; E15a6: if (!("\144\x65\166" != $_ENV["\x41\120\120\x5f\x45\116\x56"])) { goto fd1a7; } goto E4fbe; Ac24b: $this->commandExecutor->execute($reloadServiceCommand); goto a323e; E4fbe: $reloadServiceCommand = new ServiceReloadCommand(); goto fd38e; fd38e: $reloadServiceCommand->setServiceName($serviceName); goto Ac24b; a323e: fd1a7: goto e79d2; e79d2: } }