Path: blob/master/src/applications/config/check/PhabricatorSecuritySetupCheck.php
12256 views
<?php12final class PhabricatorSecuritySetupCheck extends PhabricatorSetupCheck {34public function getDefaultGroup() {5return self::GROUP_OTHER;6}78protected function executeChecks() {910// This checks for a version of bash with the "Shellshock" vulnerability.11// For details, see T6185.1213$payload = array(14'SHELLSHOCK_PAYLOAD' => '() { :;} ; echo VULNERABLE',15);1617list($err, $stdout) = id(new ExecFuture('echo shellshock-test'))18->setEnv($payload, $wipe_process_env = true)19->resolve();2021if (!$err && preg_match('/VULNERABLE/', $stdout)) {22$summary = pht(23'This system has an unpatched version of Bash with a severe, widely '.24'disclosed vulnerability.');2526$message = pht(27'The version of %s on this system is out of date and contains a '.28'major, widely disclosed vulnerability (the "Shellshock" '.29'vulnerability).'.30"\n\n".31'Upgrade %s to a patched version.'.32"\n\n".33'To learn more about how this issue affects this software, see %s.',34phutil_tag('tt', array(), 'bash'),35phutil_tag('tt', array(), 'bash'),36phutil_tag(37'a',38array(39'href' => 'https://secure.phabricator.com/T6185',40'target' => '_blank',41),42pht('T6185 "Shellshock" Bash Vulnerability')));4344$this45->newIssue('security.shellshock')46->setName(pht('Severe Security Vulnerability: Unpatched Bash'))47->setSummary($summary)48->setMessage($message);49}5051$file_key = 'security.alternate-file-domain';52$file_domain = PhabricatorEnv::getEnvConfig($file_key);53if (!$file_domain) {54$doc_href = PhabricatorEnv::getDoclink('Configuring a File Domain');5556$this->newIssue('security.'.$file_key)57->setName(pht('Alternate File Domain Not Configured'))58->setSummary(59pht(60'Improve security by configuring an alternate file domain.'))61->setMessage(62pht(63'This software is currently configured to serve user uploads '.64'directly from the same domain as other content. This is a '.65'security risk.'.66"\n\n".67'Configure a CDN (or alternate file domain) to eliminate this '.68'risk. Using a CDN will also improve performance. See the '.69'guide below for instructions.'))70->addPhabricatorConfig($file_key)71->addLink(72$doc_href,73pht('Configuration Guide: Configuring a File Domain'));74}75}76}777879