Exploit database

GH-7feacea856188eafd49a6762828c436f

chocapikk/cve-2023-35885

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2023-35885

4 sources

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

Repository files43
chocapikk/cve-2023-35885Revision 78ece7c3f53e

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

src/Command/SiteAddPhpCommand.php

PHP · 11,965 bytes
<?php
 namespace App\Command; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Validator\ConstraintViolationList; use App\Command\SiteCommand as SiteCommand; use App\Entity\Site as SiteEntity; use App\Entity\Certificate as CertificateEntity; use App\Entity\PhpSettings as PhpSettingsEntity; use App\Site\PhpSite; use App\Site\Ssl\DistinguishedName; use App\Site\Ssl\Generator\RsaKeyGenerator; use App\Site\Ssl\Generator\CsrGenerator; use App\Site\Ssl\Util\Openssl; use App\Site\Nginx\Vhost\PhpTemplate as PhpVhostTemplate; use App\Site\Creator\PhpSite as PhpSiteCreator; use App\Site\Nginx\Vhost\Processor\ServerName as ServerNameProcessor; use App\Site\Nginx\Vhost\Processor\RedirectServerName as RedirectServerNameProcessor; use App\Site\Nginx\Vhost\Processor\RedirectDomain as RedirectDomainProcessor; class SiteAddPhpCommand extends SiteCommand { private const VARNISH_CACHE_SERVER = "\61\62\x37\x2e\60\56\60\x2e\x31\x3a\66\60\x38\x31"; protected function configure() : void { goto e90c9; ff054: $this->setComment("\x41\144\x64\151\x6e\147\40\141\x20\120\x48\120\40\123\x69\164\x65"); goto C4821; C4821: $this->addOption("\x64\x6f\x6d\141\x69\156\x4e\141\155\145", null, InputOption::VALUE_REQUIRED); goto e5811; d7fd5: $this->setDescription("\143\x6c\x70\143\x74\154\40\163\151\x74\x65\x3a\x61\x64\144\x3a\160\150\160\x20\55\x2d\144\x6f\155\141\151\x6e\116\141\x6d\x65\75\x77\x77\x77\x2e\144\157\155\141\x69\156\56\143\157\x6d\x20\55\55\x70\x68\x70\x56\x65\162\163\151\x6f\x6e\x3d\x38\56\61\x20\x2d\55\166\150\x6f\163\164\x54\x65\155\x70\x6c\x61\164\x65\x3d\x27\107\145\156\x65\x72\x69\143\x27\40\55\x2d\x73\151\x74\145\x55\163\145\x72\75\152\157\x68\x6e\40\x2d\55\163\x69\164\145\125\x73\145\x72\120\x61\163\163\167\x6f\x72\144\75\47\x21\163\x65\x63\x72\x65\164\120\141\163\163\x77\157\x72\x64\x21\x27"); goto ff054; Ba870: $this->addOption("\x73\x69\x74\x65\x55\x73\x65\162", null, InputOption::VALUE_REQUIRED); goto f1f74; ef3c6: $this->addOption("\166\150\x6f\163\x74\124\145\x6d\160\x6c\141\164\145", null, InputOption::VALUE_REQUIRED); goto Ba870; f1f74: $this->addOption("\x73\151\164\x65\125\x73\145\162\120\x61\x73\x73\x77\x6f\162\x64", null, InputOption::VALUE_REQUIRED); goto D4c70; e5811: $this->addOption("\160\150\160\x56\x65\162\x73\151\x6f\x6e", null, InputOption::VALUE_REQUIRED); goto ef3c6; e90c9: $this->setName("\x73\x69\x74\x65\72\x61\144\144\x3a\x70\x68\x70"); goto d7fd5; D4c70: } protected function execute(InputInterface $input, OutputInterface $output) : int { try { goto B10c9; Fc9d6: $phpSite->setRegistrableDomain($registrableDomain); goto B1008; Df9d7: $phpVersion = trim($input->getOption("\160\150\160\126\145\162\163\151\x6f\156")); goto B0d4e; B9f9b: $registrableDomain = $resolvedDomainName->registrableDomain()->toString(); goto e855a; D50b1: $phpSite->setVarnishCache(true); goto b7edd; a3ba3: $vhostTemplate->addProcessor(new RedirectServerNameProcessor()); goto bd04a; cf2df: $siteEntity = $this->siteEntityManager->createEntity(); goto E7dc0; f5421: $certificateEntity->setType(CertificateEntity::TYPE_SELF_SIGNED); goto Faf88; Fec22: $constraints = new ConstraintViolationList(); goto F5fa4; E73b2: $phpSettingsEntity->setPhpVersion($phpVersion); goto E417f; E2739: $constraints->addAll($phpSettingsConstraints); goto ee348; a4358: $domainName = trim($input->getOption("\x64\x6f\155\x61\151\x6e\116\x61\x6d\145")); goto F24ce; cd94a: $vhostTemplateEntity = $this->vhostTemplateEntityManager->findOneByName($vhostTemplate); goto C6028; c0dd3: $siteEntity->setVhostTemplate($vhostTemplate); goto b6029; B5a8b: $siteUserPassword = trim($input->getOption("\163\x69\164\x65\125\163\145\x72\120\x61\163\163\167\x6f\162\x64")); goto Af14d; Fc4d3: $siteUser = trim($input->getOption("\163\151\x74\145\x55\x73\145\162")); goto B5a8b; ddca4: if (!(false === empty($vhostTemplateRootDirectory))) { goto E2080; } goto B00ba; Eb26f: $phpSite->setUserPassword($siteEntity->getUserPassword()); goto d7545; D52f1: if (0 == count($siteConstraints) && 0 == count($phpSettingsConstraints)) { goto cffb1; } goto Fec22; e9bab: $certificateEntity->setPrivateKey($privateKey->getPEM()); goto dc278; Dbc60: e0cbd: goto c0dd3; ae29a: $phpSiteCreator = new PhpSiteCreator($phpSite); goto Ecb79; Cc686: $phpSite->setRootDirectory($siteEntity->getRootDirectory()); goto e59df; e5606: $siteEntity->setUser($siteUser); goto cbab1; Cde8d: goto Ca323; goto B627b; A7ed3: $siteEntity->setRootDirectory($rootDirectory); goto e5606; E0c58: $siteEntity->setPhpSettings($phpSettingsEntity); goto E73b2; b21dd: $siteConstraints = $this->validator->validate($siteEntity); goto Fb14e; F5fa4: $constraints->addAll($siteConstraints); goto E2739; Ac421: $phpSiteCreator->createLogrotateFile(); goto Eb125; Eaa20: E2080: goto f629b; dc278: $certificateEntity->setCertificate($selfSignedCertificate); goto ec0c4; c89ca: $varnishCacheSettings = array_merge($defaultVarnishCacheSettings, $varnishCacheSettings); goto E7673; f191d: goto Cb0c9; goto dd8cf; B568f: Cb0c9: goto Fff09; ff4de: $siteEntity->setDomainName($domainName); goto A7ed3; E417f: $phpSettingsEntity->setSite($siteEntity); goto b21dd; a4108: $distinguishedName = new DistinguishedName($domainName, $subjectAlternativeNames); goto b8279; d9650: if (!(true === is_null($subdomain))) { goto Cf248; } goto c5087; c5087: $subjectAlternativeNames[] = sprintf("\x77\x77\167\56\x25\163", $domainName); goto d9968; e855a: $subdomain = $resolvedDomainName->subDomain()->toString(); goto d03ed; dda85: $phpSite->setUser($siteEntity->getUser()); goto Eb26f; Cea66: $vhostTemplate = new PhpVhostTemplate($phpSite); goto A1347; fe096: $vhostTemplate->build(); goto d086f; Ed0d4: $redirectionVhostTemplate = file_get_contents($redirectionVhostTemplateFile); goto Df368; d35f6: $certificateEntity = $this->certificateEntityManager->createEntity(); goto b993c; Ed1d4: $csr = $csrGenerator->generate(); goto f9805; d03ed: $subdomain = false === empty($subdomain) ? $subdomain : null; goto cd94a; b7bbd: $this->siteEntityManager->updateEntity($siteEntity); goto dce5b; C6028: if (false === is_null($vhostTemplateEntity)) { goto C1a38; } goto B611e; dfbf0: if (!(false === empty($varnishCache))) { goto e0cbd; } goto Edb23; B10c9: $this->validateInput($input); goto a4358; fe09d: fca72: goto Ee995; ee348: return $this->renderConstraints($constraints, $output); goto f191d; Ecb79: $phpSiteCreator->createUser(); goto B3d6a; dd8cf: cffb1: goto d35f6; d086f: $siteEntity->setVhostTemplate($vhostTemplate->getContent()); goto Efe7b; Edb23: $siteEntity->setVarnishCache(true); goto Dbc60; e59df: $phpSite->setCertificate($certificateEntity); goto Da00e; b6029: $phpSettingsEntity = new PhpSettingsEntity(); goto E0c58; Fb7b8: $vhostTemplate->resetProcessors(); goto Edef3; F9b96: cf274: goto ba3e4; Bf552: $phpSiteCreator->reloadNginxService(); goto e2a53; Ff652: if (!(true === $varnishCache)) { goto Eea64; } goto D50b1; d8bed: $phpSite = new PhpSite(); goto dda85; D3cf5: $phpSiteCreator->createPhpFpmPool(); goto Efc30; ba3e4: $varnishCache = false === empty($varnishCacheSettings) ? true : false; goto cf2df; Cf5c1: if (!(false === empty($vhostTemplateEntity->getVarnishCacheSettings()))) { goto cf274; } goto E17cc; D741b: $phpSite->setVarnishCacheSettings($varnishCacheSettings); goto B4676; cbab1: $siteEntity->setUserPassword($siteUserPassword); goto d4c29; Efc30: $phpSiteCreator->reloadPhpFpmService(); goto Ff652; b380e: return SiteCommand::SUCCESS; goto B568f; b765f: if (!(false === is_null($subdomain) && "\x77\167\167" == $subdomain)) { goto aec74; } goto F92ac; Df368: if (!(false === empty($redirectionVhostTemplate))) { goto fca72; } goto F1909; b66c0: $redirectionVhostTemplateFile = realpath(dirname(__FILE__) . "\57\56\56\x2f\x2e\56\x2f\162\x65\x73\157\165\x72\x63\145\163\57\156\147\x69\x6e\x78\57\x76\x68\x6f\x73\x74\x5f\164\x65\x6d\x70\154\x61\x74\145\57\162\x65\x64\151\162\145\x63\x74"); goto Ed0d4; B3d6a: $phpSiteCreator->createRootDirectory(); goto Ac421; Eafa9: $phpSiteCreator->createPrivateKeyAndCertificate(); goto D3cf5; Af14d: $resolvedDomainName = $this->domainNameParser->resolveDomainName($domainName); goto B9f9b; Efe7b: $siteEntity->setApplication($vhostTemplateEntity->getName()); goto b7bbd; Fff09: Ca323: goto E07e4; e49bb: $vhostTemplate = $vhostTemplateEntity->getTemplate(); goto fe5c5; B0d4e: $vhostTemplate = trim($input->getOption("\x76\x68\x6f\x73\164\x54\145\155\160\x6c\141\x74\145")); goto Fc4d3; Cb69c: $phpSiteCreator->createNginxVhost(); goto Bf552; E17cc: $varnishCacheSettings = (array) json_decode($vhostTemplateEntity->getVarnishCacheSettings(), true); goto F9b96; b993c: $certificateEntity->setSite($siteEntity); goto Bbdb8; c7025: $subjectAlternativeNames = []; goto d9650; cd69e: $privateKey = $rsaKeyGenerator->generatePrivateKey(); goto c7025; d9968: Cf248: goto b765f; fe5c5: $vhostTemplateRootDirectory = $vhostTemplateEntity->getRootDirectory(); goto ddca4; D0798: $certificateEntity->setDefaultCertificate(true); goto f5421; dce5b: $output->writeln(sprintf("\x3c\x69\156\x66\157\76\123\x69\x74\x65\74\x2f\x69\156\x66\157\x3e\40\x3c\143\x6f\155\155\x65\156\x74\x3e\45\163\x3c\x2f\x63\157\155\x6d\x65\156\164\76\x20\74\x69\156\x66\157\x3e\150\141\x73\40\x62\x65\x65\156\40\141\144\144\145\x64\56\x3c\57\x69\x6e\146\157\x3e", $domainName)); goto b380e; Bbdb8: $rsaKeyGenerator = new RsaKeyGenerator(); goto cd69e; F92ac: $subjectAlternativeNames[] = $registrableDomain; goto cbf19; b8279: $csrGenerator = new CsrGenerator($privateKey, $distinguishedName); goto Ed1d4; B611e: throw new \Exception(sprintf("\x56\150\x6f\163\164\x20\x54\x65\155\160\154\x61\164\x65\40\x22\x25\x73\x22\40\x64\157\x65\x73\x20\x6e\157\x74\x20\145\x78\x69\163\164\x2e", $vhostTemplate)); goto Cde8d; cbf19: aec74: goto a4108; Da00e: $phpSite->setPhpSettings($phpSettingsEntity); goto f6e83; f9805: $selfSignedCertificate = Openssl::createSelfSignedCertificate($privateKey, $csr); goto D0798; e2a53: $phpSiteCreator->resetPermissions(); goto Cea66; bd04a: $vhostTemplate->addProcessor(new RedirectDomainProcessor()); goto fe096; ec0c4: $siteEntity->setCertificate($certificateEntity); goto d8bed; A1347: $vhostTemplate->setContent($siteEntity->getVhostTemplate()); goto Fb7b8; B627b: C1a38: goto e49bb; f6e83: $phpSite->setVhostTemplate($siteEntity->getVhostTemplate()); goto ae29a; E7dc0: $siteEntity->setType(SiteEntity::TYPE_PHP); goto ff4de; Ee995: F928b: goto dfbf0; d7545: $phpSite->setDomainName($domainName); goto Fc9d6; Eb125: $phpSiteCreator->createIndexPhp(); goto Eafa9; Faf88: $certificateEntity->setCsr($csr); goto e9bab; f629b: $varnishCacheSettings = []; goto Cf5c1; Fb14e: $phpSettingsConstraints = $this->validator->validate($phpSettingsEntity); goto D52f1; E7673: $phpSiteCreator->createVarnishCacheStructure($varnishCacheSettings); goto D741b; B4676: Eea64: goto Cb69c; d4c29: if (!(true === is_null($subdomain) || "\x77\167\x77" == $subdomain)) { goto F928b; } goto b66c0; b7edd: $defaultVarnishCacheSettings = ["\145\156\141\142\x6c\145\x64" => false, "\x73\x65\x72\166\145\x72" => self::VARNISH_CACHE_SERVER, "\143\141\143\x68\145\124\x61\147\120\162\145\146\151\170" => substr(md5(time()), 0, 4)]; goto c89ca; B1008: $phpSite->setSubdomain($subdomain); goto Cc686; F1909: $vhostTemplate = sprintf("\x25\163\x25\163", $redirectionVhostTemplate, $vhostTemplate); goto fe09d; Edef3: $vhostTemplate->addProcessor(new ServerNameProcessor()); goto a3ba3; F24ce: $rootDirectory = $domainName; goto Df9d7; B00ba: $rootDirectory = sprintf("\45\x73\x2f\45\x73", $rootDirectory, ltrim(rtrim($vhostTemplateRootDirectory, "\57"), "\57")); goto Eaa20; E07e4: } catch (\Exception $e) { goto C2229; Df009: return SiteCommand::FAILURE; goto c1b79; C2229: $errorMessage = $e->getMessage(); goto c4902; c4902: $output->writeln(sprintf("\74\x65\162\x72\x6f\162\76\x25\x73\x3c\x2f\x65\x72\162\x6f\162\x3e", $errorMessage)); goto Df009; c1b79: } } }