Wordpress 等でのPHPのマルウェア・ウィルス・改ざんコードをデコードして難読化をオンラインで解除し、
元の読みやすいコードに戻し解読できます。
<?php namespace MiniOrange; include_once "\x63\x6f\156\156\145\x63\164\157\x72\56\x70\150\x70"; use MiniOrange\Helper\DB; use DOMElement; use DOMNode; use DOMDocument; use Exception; use MiniOrange\Helper\SAMLUtilities; if (isset($_SESSION)) { goto dTD; } session_start(); dTD: if (isset($_SESSION["\x61\x75\164\x68\157\162\x69\x7a\145\x64"]) && !empty($_SESSION["\141\165\164\150\157\162\x69\x7a\145\x64"])) { goto cAR; } header("\114\157\x63\141\x74\151\x6f\x6e\x3a\x20\x61\144\155\151\x6e\137\x6c\157\147\x69\156\56\x70\x68\160"); exit; goto icJ; cAR: if (!($_SESSION["\x61\165\164\150\157\162\151\x7a\145\144"] != true)) { goto u1W; } header("\114\157\x63\x61\164\151\x6f\156\72\40\141\144\x6d\x69\x6e\137\154\157\147\x69\156\x2e\x70\150\160"); exit; u1W: icJ: class IDPMetadataReader { private $identityProviders; private $serviceProviders; public function __construct(DOMNode $OC = NULL) { $this->identityProviders = array(); $this->serviceProviders = array(); $Km = new SAMLUtilities(); $zR = $Km->xpQuery($OC, "\56\x2f\x73\141\155\x6c\x5f\155\145\x74\x61\144\x61\x74\141\x3a\105\156\164\151\x74\151\x65\163\x44\x65\x73\x63\x72\x69\160\x74\x6f\x72"); if (!empty($zR)) { goto T9K; } $Dw = $Km->xpQuery($OC, "\56\x2f\163\141\155\x6c\x5f\155\145\164\x61\x64\141\x74\x61\x3a\105\156\164\x69\164\x79\x44\145\x73\x63\x72\x69\160\164\x6f\x72"); goto WPx; T9K: $Dw = $Km->xpQuery($zR[0], "\x2e\57\163\141\x6d\x6c\x5f\x6d\145\164\141\144\x61\x74\141\72\105\156\164\151\164\x79\x44\x65\163\143\162\151\160\x74\x6f\162"); WPx: foreach ($Dw as $dt) { $wr = $Km->xpQuery($dt, "\x2e\57\x73\141\x6d\154\137\x6d\145\x74\x61\144\141\164\141\72\111\104\120\x53\x53\x4f\x44\145\x73\143\162\x69\160\164\x6f\x72"); if (!(isset($wr) && !empty($wr))) { goto LZh; } array_push($this->identityProviders, new IdentityProviders($dt)); LZh: fBm: } g5G: } public function getIdentityProviders() { return $this->identityProviders; } public function getServiceProviders() { return $this->serviceProviders; } } class IdentityProviders { private $entityID; private $loginDetails; private $logoutDetails; private $signingCertificate; private $encryptionCertificate; private $signedRequest; public function __construct(DOMElement $OC = NULL) { $this->loginDetails = array(); $this->logoutDetails = array(); $this->signingCertificate = array(); $this->encryptionCertificate = array(); if (!$OC->hasAttribute("\x65\156\x74\x69\x74\171\111\104")) { goto IiA; } $this->entityID = $OC->getAttribute("\x65\x6e\x74\x69\x74\171\x49\x44"); IiA: if (!$OC->hasAttribute("\x57\141\156\x74\101\x75\164\x68\156\122\x65\x71\165\145\x73\164\163\123\x69\147\156\x65\144")) { goto Ttn; } $this->signedRequest = $OC->getAttribute("\x57\141\156\164\x41\x75\164\x68\156\x52\x65\161\165\x65\x73\164\x73\x53\x69\147\x6e\x65\144"); Ttn: $Km = new SAMLUtilities(); $wr = $Km->xpQuery($OC, "\x2e\x2f\163\141\155\x6c\x5f\x6d\145\164\x61\x64\141\164\x61\72\x49\x44\x50\123\x53\x4f\x44\145\163\143\162\x69\160\164\157\162"); if (count($wr) > 1) { goto ACJ; } if (empty($wr)) { goto RFA; } goto O8Q; ACJ: throw new Exception("\x4d\157\162\x65\x20\164\150\x61\156\x20\x6f\156\145\x20\74\111\104\x50\x53\123\x4f\104\145\163\x63\x72\151\x70\164\157\x72\76\x20\x69\156\x20\74\x45\156\x74\151\x74\x79\x44\x65\163\143\162\x69\160\164\157\x72\x3e\56"); goto O8Q; RFA: throw new Exception("\115\x69\163\163\x69\156\147\x20\x72\145\x71\165\x69\162\145\144\x20\74\111\104\x50\123\123\x4f\x44\145\x73\x63\162\151\160\x74\x6f\162\x3e\x20\151\156\40\x3c\x45\x6e\164\x69\164\171\x44\x65\x73\143\x72\x69\x70\164\157\162\x3e\x2e"); O8Q: $AD = $wr[0]; $Ew = $Km->xpQuery($OC, "\x2e\x2f\x73\x61\155\x6c\137\155\x65\x74\x61\x64\141\x74\x61\72\x45\170\x74\145\156\x73\x69\x6f\156\x73"); if (!$Ew) { goto J2y; } $this->parseInfo($AD); J2y: $this->parseSSOService($AD); $this->parseSLOService($AD); $this->parsex509Certificate($AD); } private function parseInfo($OC) { $Km = new SAMLUtilities(); $V4 = $Km->xpQuery($OC, "\56\x2f\x6d\144\165\151\72\125\111\111\156\146\x6f\57\x6d\x64\165\x69\x3a\x44\x69\x73\160\154\141\171\116\x61\x6d\145"); foreach ($V4 as $rN) { if (!($rN->hasAttribute("\170\x6d\x6c\72\154\141\156\147") && $rN->getAttribute("\x78\x6d\x6c\x3a\x6c\x61\x6e\x67") == "\x65\156")) { goto hg5; } $this->idpName = $rN->textContent; hg5: ZQY: } g0u: } private function parseSSOService($OC) { $Km = new SAMLUtilities(); $dU = $Km->xpQuery($OC, "\x2e\57\x73\141\x6d\154\137\x6d\x65\164\141\144\x61\164\x61\x3a\123\151\x6e\x67\154\x65\x53\x69\x67\156\x4f\156\x53\x65\x72\x76\x69\x63\x65"); foreach ($dU as $s1) { $SJ = str_replace("\x75\162\156\72\157\x61\x73\x69\163\x3a\x6e\x61\155\x65\163\x3a\164\x63\72\123\101\x4d\114\x3a\x32\x2e\60\x3a\142\151\156\x64\x69\x6e\147\x73\x3a", '', $s1->getAttribute("\x42\151\x6e\x64\151\156\x67")); $this->loginDetails = array_merge($this->loginDetails, array($SJ => $s1->getAttribute("\114\157\x63\141\164\151\157\156"))); riI: } Kv3: } private function parseSLOService($OC) { $Km = new SAMLUtilities(); $PZ = $Km->xpQuery($OC, "\x2e\57\x73\x61\155\154\137\155\x65\164\x61\144\x61\164\141\x3a\x53\151\156\147\154\145\x4c\157\147\x6f\165\x74\123\x65\162\166\x69\143\x65"); foreach ($PZ as $BC) { $SJ = str_replace("\x75\x72\156\x3a\x6f\141\x73\151\163\x3a\156\x61\x6d\145\x73\72\x74\143\x3a\x53\101\115\x4c\72\62\56\x30\72\x62\x69\x6e\x64\151\x6e\147\163\72", '', $BC->getAttribute("\102\x69\156\x64\x69\x6e\x67")); $this->logoutDetails = array_merge($this->logoutDetails, array($SJ => $BC->getAttribute("\x4c\x6f\143\x61\x74\x69\157\x6e"))); InO: } g13: } private function parsex509Certificate($OC) { $Km = new SAMLUtilities(); foreach ($Km->xpQuery($OC, "\x2e\x2f\163\141\x6d\x6c\x5f\x6d\145\x74\x61\144\x61\164\141\72\x4b\x65\171\x44\145\x73\143\x72\x69\160\164\157\x72") as $c7) { if ($c7->hasAttribute("\165\x73\x65")) { goto rmZ; } $this->parseSigningCertificate($c7); goto peb; rmZ: if ($c7->getAttribute("\165\163\x65") == "\145\156\143\162\x79\160\164\x69\157\156") { goto ra4; } $this->parseSigningCertificate($c7); goto sFR; ra4: $this->parseEncryptionCertificate($c7); sFR: peb: CE8: } P43: } private function parseSigningCertificate($OC) { $Km = new SAMLUtilities(); $ff = $Km->xpQuery($OC, "\x2e\57\144\163\72\x4b\145\x79\x49\156\146\157\x2f\144\x73\72\x58\65\x30\71\x44\141\x74\x61\57\x64\x73\72\x58\x35\60\71\x43\145\x72\164\x69\146\151\x63\141\164\145"); $UD = trim($ff[0]->textContent); $UD = str_replace(array("\15", "\12", "\x9", "\40"), '', $UD); if (empty($ff)) { goto ZL_; } array_push($this->signingCertificate, $Km->sanitize_certificate($UD)); ZL_: } private function parseEncryptionCertificate($OC) { $Km = new SAMLUtilities(); $ff = $Km->xpQuery($OC, "\x2e\57\x64\163\72\113\x65\171\x49\156\x66\157\x2f\x64\x73\72\130\65\x30\71\104\x61\164\x61\57\x64\x73\72\130\65\60\x39\103\145\162\x74\x69\x66\x69\143\141\x74\145"); $UD = trim($ff[0]->textContent); $UD = str_replace(array("\xd", "\12", "\11", "\40"), '', $UD); if (empty($ff)) { goto bGZ; } array_push($this->encryptionCertificate, $UD); bGZ: } public function getEntityID() { return $this->entityID; } public function getLoginURL($SJ) { return $this->loginDetails[$SJ]; } public function getLogoutURL($SJ) { return $this->logoutDetails[$SJ]; } public function getLoginDetails() { return $this->loginDetails; } public function getLogoutDetails() { return $this->logoutDetails; } public function getSigningCertificate() { return $this->signingCertificate; } public function getEncryptionCertificate() { return $this->encryptionCertificate[0]; } public function isRequestSigned() { return $this->signedRequest; } } include_once "\x68\x65\x6c\160\x65\162\57\123\101\115\114\x55\x74\x69\154\x69\164\x69\x65\x73\56\x70\x68\x70"; if (isset($_SESSION)) { goto wQQ; } session_start(); wQQ: if (!isset($_SESSION["\x61\x75\164\150\x6f\162\x69\172\145\144"])) { goto NqO; } if (!($_SESSION["\141\165\164\150\157\162\x69\x7a\x65\144"] != true)) { goto WZf; } header("\114\157\x63\141\164\x69\x6f\156\72\40\141\x64\x6d\151\x6e\x5f\154\x6f\147\x69\156\x2e\x70\x68\x70"); WZf: goto XGR; NqO: header("\x4c\x6f\143\141\x74\x69\x6f\x6e\72\x20\141\x64\155\151\156\x5f\154\157\147\x69\x6e\56\160\150\x70"); exit; XGR: try { $user = DB::get_registered_user(); } catch (\Exception $kI) { $uu = $kI->getCode(); $f8 = $kI->getMessage(); $Zh = $kI->getTraceAsString(); $Rw = getenv("\104\x42\x5f\103\117\116\x4e\105\x43\x54\111\x4f\116"); $R8 = getenv("\104\102\x5f\104\x41\x54\101\102\x41\x53\105"); $rU = getenv("\x44\x42\137\x48\x4f\x53\x54"); $QU = config("\x64\141\x74\141\x62\141\x73\x65\56\x64\x72\x69\166\145\x72"); echo nl2br("{$uu}\x20\12\40{$f8}\x20\40\12\40\104\x42\x5f\x43\x4f\116\116\105\103\x54\x49\117\x4e\40\x3a\x20{$Rw}\x20\12\x20\x44\x42\x5f\x44\101\x54\101\x42\x41\x53\x45\40\72\40{$R8}\40\12\x20\x44\102\137\110\117\123\x54\x20\x3a\x20{$rU}\12\x20\111\x66\x20\164\x68\x65\40\141\142\x6f\166\x65\x20\143\x6f\156\146\x69\147\x75\162\141\x74\x69\x6f\x6e\x20\x72\145\160\x6f\x72\164\40\151\163\x20\145\x6d\160\164\x79\x20\157\x72\x20\151\156\x63\x6f\x6d\160\x6c\145\x74\x65\54\40\162\x75\156\x20\x3c\142\76\160\x68\x70\40\141\x72\164\x69\163\141\x6e\x20\143\157\156\146\x69\x67\x3a\x63\154\x65\x61\162\x3c\57\142\76\40\x69\x6e\x20\x79\157\165\x72\40\143\x6f\155\155\x61\x6e\x64\55\x6c\x69\156\x65\54\x20\x63\x68\x65\143\x6b\40\171\157\165\x72\40\x3c\x62\76\x2e\145\156\x76\x3c\x2f\142\x3e\40\x66\x69\154\x65\40\141\x6e\144\40\160\x6c\x65\x61\x73\145\40\164\162\x79\x20\x61\147\x61\151\x6e\56\x20\x20\12\xa\x54\122\101\103\105\x20\72\40\12\40{$Zh}"); exit; } if (!(isset($_POST["\x6f\x70\x74\x69\x6f\156"]) && $_POST["\x6f\160\x74\151\x6f\x6e"] == "\x73\141\166\145\x5f\x6d\145\164\x61\144\141\x74\141\137\x66\x69\154\145" && isset($_POST["\x55\160\x6c\157\141\144"]) && (isset($_FILES["\155\145\x74\141\144\141\x74\141\137\146\x69\x6c\x65"]) && $_FILES["\x6d\145\164\141\x64\141\164\x61\137\x66\151\154\x65"]["\145\162\x72\157\162"] == 0))) { goto E11; } if (!empty($_FILES["\155\145\x74\141\144\x61\164\141\x5f\146\151\154\x65"]["\164\155\x70\137\156\141\x6d\145"])) { goto Nnk; } if (mo_saml_is_curl_installed()) { goto je4; } DB::update_option("\x6d\x6f\137\163\x61\155\x6c\x5f\155\145\163\163\141\x67\145", "\120\110\x50\40\x63\x55\122\x4c\x20\145\x78\164\x65\x6e\163\x69\x6f\x6e\40\x69\x73\40\156\157\164\x20\151\156\163\164\x61\x6c\154\x65\144\40\x6f\162\x20\x64\151\x73\141\x62\154\145\x64\56\40\103\x61\x6e\156\157\x74\40\x66\x65\164\x63\150\40\155\145\164\x61\144\141\x74\141\40\x66\162\x6f\x6d\x20\125\x52\x4c\x2e"); mo_saml_show_error_message(); return; je4: goto bqQ; Nnk: $mu = @file_get_contents($_FILES["\155\x65\164\141\144\x61\164\141\137\x66\x69\x6c\x65"]["\164\155\x70\137\156\x61\x6d\145"]); bqQ: if (is_null($mu)) { goto jRO; } upload_metadata($mu); jRO: E11: function upload_metadata($mu) { $vq = new DOMDocument(); if (!($_FILES["\x6d\145\x74\x61\x64\141\164\x61\137\x66\151\x6c\x65"]["\164\x79\x70\145"] != "\x74\x65\x78\164\57\170\x6d\x6c")) { goto ezU; } DB::update_option("\155\x6f\137\x73\141\155\154\x5f\x6d\145\163\163\x61\x67\145", "\x50\x6c\x65\141\x73\145\x20\160\x72\x6f\166\151\144\145\x20\x61\x20\x76\141\154\x69\144\40\x6d\x65\164\x61\x64\x61\x74\x61\x20\146\151\x6c\x65\x2e"); mo_saml_show_error_message(); return; ezU: $vq->loadXML($mu); $Ak = $vq->firstChild; if (!empty($Ak)) { goto jdh; } if (empty($_FILES["\x6d\x65\164\141\144\x61\164\x61\x5f\146\151\x6c\x65"]["\x74\x6d\x70\137\156\x61\155\145"])) { goto Q4B; } DB::update_option("\x6d\x6f\137\163\141\155\154\137\x6d\145\x73\163\141\147\145", "\x50\x6c\145\141\x73\145\40\160\162\157\x76\x69\x64\x65\40\x61\x20\x76\x61\154\x69\x64\40\155\145\164\x61\x64\x61\164\141\x20\x66\x69\x6c\145\56"); mo_saml_show_error_message(); Q4B: goto dXv; jdh: $Z_ = new IDPMetadataReader($vq); $U4 = $Z_->getIdentityProviders(); if (!(empty($U4) && !empty($_FILES["\155\x65\164\x61\x64\x61\x74\x61\x5f\146\x69\154\x65"]["\164\155\x70\x5f\156\141\155\145"]))) { goto RSY; } DB::update_option("\155\157\137\163\x61\155\154\x5f\x6d\x65\x73\x73\141\147\145", "\x50\154\x65\x61\163\x65\40\160\x72\x6f\x76\151\144\145\40\x61\x20\166\141\x6c\151\x64\40\x6d\x65\164\x61\144\141\x74\x61\40\146\151\154\x65\56"); mo_saml_show_error_message(); return; RSY: foreach ($U4 as $g6 => $LO) { $yK = $LO->getLoginURL("\x48\x54\x54\120\x2d\122\x65\x64\151\x72\145\x63\164"); $eX = $LO->getEntityID(); $ek = $LO->getLogoutURL("\110\124\x54\x50\x2d\x52\145\x64\151\x72\145\143\164"); $oW = $LO->getSigningCertificate(); DB::update_option("\163\141\155\154\x5f\154\157\x67\x69\156\137\x75\x72\154", $yK); DB::update_option("\151\144\160\137\x65\156\x74\x69\164\x79\x5f\151\144", $eX); DB::update_option("\163\x61\155\154\x5f\154\x6f\147\x6f\x75\164\x5f\165\x72\154", $ek); DB::update_option("\163\141\x6d\154\137\x78\x35\x30\x39\137\143\145\162\x74\x69\x66\x69\143\141\x74\145", $oW[0]); goto G0F; TjJ: } G0F: DB::update_option("\x6d\157\x5f\x73\141\155\x6c\x5f\x6d\x65\x73\x73\x61\147\x65", "\111\144\x65\x6e\164\151\x74\x79\40\x50\x72\157\166\x69\144\145\x72\x20\x64\x65\164\141\x69\154\x73\40\x73\141\166\145\144\x20\x73\x75\143\x63\145\x73\163\146\x75\154\x6c\x79\56"); mo_saml_show_success_message(); dXv: } if (!(isset($_POST["\x6f\160\x74\151\x6f\x6e"]) && $_POST["\157\x70\164\151\157\156"] == "\163\x61\166\x65\137\x63\157\156\x6e\145\x63\164\157\162\x5f\x73\x65\x74\x74\151\156\147\163")) { goto f2m; } $o7 = ''; $un = ''; $yK = ''; $oX = ''; $ek = ''; $oW = ''; $YA = ''; $N2 = ''; $HA = ''; $xx = ''; $d2 = ''; $Uj = ''; $ds = ''; $VK = ''; $e6 = ''; $Lr = ''; if (mo_saml_check_empty_or_null($_POST["\x69\144\160\137\x6e\x61\x6d\x65"]) || mo_saml_check_empty_or_null($_POST["\163\x61\155\154\137\x6c\157\x67\x69\x6e\137\165\162\x6c"]) || mo_saml_check_empty_or_null($_POST["\151\144\x70\137\145\x6e\164\x69\x74\171\x5f\x69\144"])) { goto Rlm; } if (!preg_match("\x2f\x5e\x5c\167\52\x24\57", $_POST["\151\x64\160\x5f\156\x61\x6d\x65"])) { goto bam; } $o7 = trim($_POST["\151\144\x70\137\156\141\155\x65"]); $yK = trim($_POST["\x73\x61\155\x6c\137\154\x6f\x67\x69\x6e\137\165\x72\154"]); $ek = trim($_POST["\163\141\155\x6c\x5f\154\x6f\147\157\x75\164\x5f\165\x72\154"]); if (!array_key_exists("\154\x6f\x67\151\156\x5f\x62\x69\x6e\144\x69\156\147\137\164\x79\x70\145", $_POST)) { goto GYT; } $oX = $_POST["\x6c\x6f\x67\151\x6e\137\x62\x69\156\x64\x69\x6e\147\x5f\x74\171\x70\145"]; GYT: if (!array_key_exists("\x73\x61\x6d\x6c\x5f\x6c\x6f\x67\x6f\x75\x74\x5f\x75\x72\154", $_POST)) { goto uff; } $ek = trim($_POST["\163\141\155\x6c\137\x6c\157\x67\157\165\164\x5f\x75\x72\154"]); uff: $un = trim($_POST["\151\x64\160\x5f\145\x6e\x74\151\164\171\137\151\x64"]); $oW = sanitize_certificate($_POST["\x78\x35\x30\71\x5f\x63\145\x72\164\151\146\x69\x63\x61\164\x65"]); if (isset($_POST["\146\x6f\x72\x63\145\x5f\x61\x75\x74\150\156"]) && !empty($_POST["\146\157\x72\x63\145\137\141\165\x74\150\156"])) { goto BtT; } $YA = false; goto eJg; BtT: $YA = true; eJg: if (isset($_POST["\x66\x6f\162\143\x65\137\x73\163\x6f"]) && !empty($_POST["\146\x6f\162\x63\145\137\163\163\157"])) { goto oVR; } $N2 = false; goto dhj; oVR: $N2 = true; dhj: if (isset($_POST["\141\165\164\x6f\x5f\x63\x72\145\141\164\145\137\165\x73\x65\162\163"]) && !empty($_POST["\x61\165\164\x6f\x5f\143\162\x65\141\x74\145\137\165\x73\x65\162\163"])) { goto x9q; } $HA = false; goto umc; x9q: $HA = true; umc: $Uj = trim($_POST["\163\151\164\145\137\x62\x61\x73\x65\137\165\x72\154"]); pzh: if (!(substr($Uj, -1) == "\57")) { goto ft4; } $Uj = substr($Uj, 0, -1); goto pzh; ft4: $ds = $Uj . "\57\155\151\156\151\x6f\162\141\x6e\x67\145\137\x6c\141\162\x61\x76\145\x6c\137\x73\x61\x6d\154\x5f\143\x6f\x6e\x6e\145\x63\164\157\162"; $VK = $Uj . "\57\163\x73\157\56\160\x68\160"; $e6 = $Uj . "\57\x6c\x6f\x67\x6f\165\x74\56\160\x68\160"; $xx = trim($_POST["\162\145\x6c\x61\x79\163\164\x61\x74\145\137\165\x72\x6c"]); $d2 = trim($_POST["\x73\x69\x74\x65\137\154\x6f\x67\x6f\165\164\137\165\162\154"]); $Lr = trim($_POST["\163\x73\x6f\137\x61\164\x74\162\151\x62\x75\164\x65"]); if (filter_var($Uj, FILTER_VALIDATE_URL)) { goto Rac; } DB::update_option("\155\157\137\163\141\x6d\154\137\155\145\163\163\141\x67\x65", "\111\x6e\166\x61\x6c\x69\x64\40\x53\120\x20\102\x61\x73\145\40\x55\122\x4c"); mo_saml_show_error_message(); return; Rac: if (filter_var($VK, FILTER_VALIDATE_URL)) { goto GTx; } DB::update_option("\155\x6f\137\x73\141\155\x6c\x5f\155\145\163\x73\x61\147\145", "\x49\x6e\166\x61\x6c\151\x64\40\x41\103\x53\x20\x55\x52\114"); mo_saml_show_error_message(); return; GTx: if (filter_var($e6, FILTER_VALIDATE_URL)) { goto Xop; } DB::update_option("\155\x6f\x5f\x73\141\155\x6c\x5f\x6d\x65\163\x73\141\x67\x65", "\111\156\x76\x61\x6c\x69\x64\x20\123\120\x20\x53\114\x4f\40\x55\x52\x4c"); mo_saml_show_error_message(); return; Xop: if (!(!empty($ek) and !filter_var($ek, FILTER_VALIDATE_URL))) { goto u5D; } DB::update_option("\155\x6f\x5f\x73\141\155\154\137\x6d\145\163\x73\141\147\145", "\x49\156\x76\x61\x6c\x69\x64\x20\123\x41\115\114\x20\x4c\x6f\x67\157\165\164\40\x55\x52\114"); mo_saml_show_error_message(); return; u5D: if (filter_var($yK, FILTER_VALIDATE_URL)) { goto u6T; } DB::update_option("\155\157\137\x73\x61\155\x6c\x5f\x6d\x65\x73\163\141\147\145", "\111\x6e\x76\141\154\x69\x64\x20\123\x41\x4d\114\40\114\157\x67\x69\x6e\40\x55\122\114"); mo_saml_show_error_message(); u6T: DB::update_option("\x73\141\x6d\154\137\151\x64\145\x6e\164\151\x74\171\137\156\x61\155\x65", $o7); DB::update_option("\151\x64\x70\x5f\x65\156\x74\x69\x74\171\x5f\151\x64", $un); DB::update_option("\x73\141\155\x6c\x5f\154\x6f\147\x69\x6e\137\x75\162\x6c", $yK); DB::update_option("\x73\141\x6d\x6c\x5f\x6c\x6f\x67\x69\x6e\137\x62\x69\156\144\x69\x6e\147\x5f\x74\171\160\x65", $oX); DB::update_option("\163\x61\x6d\154\137\x6c\x6f\147\x6f\x75\164\137\x75\162\154", $ek); DB::update_option("\x73\x61\x6d\x6c\x5f\170\65\60\x39\x5f\x63\x65\x72\164\x69\146\151\143\141\x74\145", $oW); DB::update_option("\146\157\x72\x63\x65\137\x61\x75\x74\150\145\156\x74\151\x63\141\x74\151\x6f\x6e", $YA); DB::update_option("\x66\157\162\x63\145\x5f\x73\x73\x6f", $N2); DB::update_option("\x61\165\x74\x6f\x5f\x63\162\145\141\164\145\x5f\165\163\x65\x72\163", $HA); DB::update_option("\x73\x70\x5f\x62\x61\163\x65\x5f\165\162\x6c", $Uj); DB::update_option("\x73\x70\x5f\145\156\x74\x69\164\171\x5f\151\144", $ds); DB::update_option("\x61\143\x73\x5f\x75\x72\154", $VK); DB::update_option("\163\151\156\147\x6c\x65\137\x6c\157\147\x6f\x75\164\137\165\162\154", $e6); DB::update_option("\x72\x65\x6c\141\171\x73\x74\x61\x74\145\x5f\x75\x72\x6c", $xx); DB::update_option("\x73\x69\164\145\137\154\157\x67\157\x75\164\137\x75\162\x6c", $d2); DB::update_option("\x73\163\157\x5f\141\x74\x74\162\x69\142\165\164\x65", $Lr); DB::update_option("\155\x6f\137\x73\141\x6d\x6c\x5f\x6d\145\163\163\x61\147\x65", "\123\145\164\x74\151\x6e\x67\x73\x20\163\x61\166\145\x64\40\163\x75\x63\143\x65\x73\163\x66\165\x6c\154\171\x2e"); mo_saml_show_success_message(); if (!empty($oW)) { goto VaT; } DB::update_option("\155\157\x5f\163\141\x6d\154\x5f\155\145\x73\163\141\x67\x65", "\111\x6e\166\141\x6c\151\144\x20\x43\145\x72\164\151\x66\x69\143\141\164\x65\x3a\x50\154\145\x61\163\x65\x20\x70\x72\x6f\x76\151\x64\x65\40\141\40\x63\x65\162\x74\x69\x66\151\143\x61\x74\145"); mo_saml_show_error_message(); VaT: $oW = sanitize_certificate($oW); if (@openssl_x509_read($oW)) { goto NiU; } DB::update_option("\x6d\x6f\x5f\x73\x61\155\154\137\155\x65\x73\x73\141\x67\x65", "\x49\x6e\x76\141\154\151\x64\40\x63\145\162\164\x69\146\x69\x63\141\164\145\72\x20\x50\154\x65\x61\x73\145\x20\160\162\x6f\166\151\x64\x65\x20\x61\x20\x76\x61\x6c\151\144\x20\143\145\162\x74\x69\x66\151\143\x61\x74\x65\56"); mo_saml_show_error_message(); DB::delete_option("\x73\x61\155\x6c\137\170\65\60\x39\137\143\x65\x72\x74\151\146\x69\x63\x61\164\x65"); NiU: goto Zs3; bam: DB::update_option("\155\x6f\x5f\163\x61\155\x6c\137\155\145\163\x73\x61\x67\145", "\120\x6c\145\x61\163\145\x20\155\x61\x74\x63\x68\x20\x74\150\145\40\x72\x65\x71\165\x65\163\x74\x65\144\x20\146\x6f\162\x6d\x61\164\40\x66\x6f\162\40\111\144\x65\x6e\x74\151\164\x79\40\x50\x72\x6f\166\x69\x64\x65\162\40\116\141\155\145\x2e\x20\x4f\156\154\171\40\141\154\x70\150\x61\142\x65\x74\163\54\40\156\165\155\142\145\x72\x73\40\141\x6e\144\x20\x75\x6e\x64\145\x72\x73\143\157\x72\145\40\x69\x73\40\x61\154\x6c\157\167\x65\x64\56"); mo_saml_show_error_message(); return; Zs3: goto maC; Rlm: DB::update_option("\155\157\x5f\x73\x61\x6d\154\137\x6d\145\x73\x73\141\x67\x65", "\101\154\154\x20\x74\x68\x65\x20\x66\x69\x65\154\x64\x73\x20\141\x72\145\40\162\x65\x71\x75\x69\x72\145\144\56\40\120\x6c\x65\141\163\x65\x20\145\x6e\164\145\162\x20\x76\141\x6c\151\x64\x20\x65\x6e\x74\162\x69\145\x73\x2e"); mo_saml_show_error_message(); return; maC: f2m: if (!(isset($_POST["\157\x70\164\151\x6f\156"]) && $_POST["\x6f\x70\164\x69\x6f\x6e"] == "\141\x74\164\162\x69\142\165\x74\x65\137\x6d\x61\160\160\x69\x6e\x67")) { goto fSi; } if (isset($_POST["\x73\x61\155\154\x5f\x61\155\137\145\155\141\x69\154"]) && !empty($_POST["\x73\141\155\154\x5f\x61\x6d\x5f\x65\x6d\x61\151\x6c"])) { goto pyC; } DB::update_option("\x73\x61\155\154\137\x61\155\137\145\155\x61\151\x6c", "\116\x61\155\x65\x49\104"); goto sja; pyC: DB::update_option("\x73\x61\155\154\137\141\155\137\145\x6d\x61\151\x6c", $_POST["\x73\x61\155\154\137\141\x6d\x5f\145\155\x61\x69\x6c"]); sja: if (isset($_POST["\x73\141\x6d\154\x5f\141\155\x5f\x75\x73\x65\x72\156\x61\155\x65"]) && !empty($_POST["\163\141\155\x6c\137\141\x6d\137\165\x73\x65\162\156\x61\x6d\145"])) { goto NOm; } DB::update_option("\x73\x61\x6d\154\x5f\x61\x6d\137\165\x73\x65\162\x6e\141\155\145", "\x4e\x61\155\x65\111\x44"); goto PTF; NOm: DB::update_option("\163\141\x6d\x6c\x5f\141\x6d\137\165\x73\x65\x72\x6e\x61\155\x65", $_POST["\163\141\x6d\154\137\141\x6d\137\x75\x73\x65\162\156\141\x6d\x65"]); PTF: if (!(isset($_POST["\141\x74\x74\162\x69\142\165\164\145\x5f\x6e\141\155\145"]) && isset($_POST["\141\164\x74\162\x69\x62\165\164\145\137\166\x61\x6c\x75\x65"]))) { goto WwC; } $g6 = $_POST["\141\164\x74\162\x69\142\165\x74\145\x5f\x6e\141\155\x65"]; $kZ = $_POST["\x61\x74\x74\x72\151\142\x75\164\145\x5f\166\141\x6c\165\145"]; $H0 = array_combine($g6, $kZ); $H0 = array_filter($H0); $H0 = serialize($H0); DB::update_option("\x6d\x6f\137\x73\x61\155\x6c\x5f\143\165\x73\x74\157\x6d\x5f\x61\164\164\162\163\x5f\155\141\160\x70\x69\x6e\x67", $H0); WwC: DB::update_option("\x6d\157\x5f\x73\141\155\154\137\155\145\163\x73\x61\147\x65", "\101\x74\164\x72\151\x62\x75\x74\145\40\x4d\141\160\160\151\x6e\147\x20\144\145\164\141\x69\x6c\x73\x20\163\x61\166\145\144\x20\163\165\143\143\x65\163\x73\146\x75\154\x6c\x79"); mo_saml_show_success_message(); fSi: echo "\x20\40\x20\40\15\xa";
<?php namespace MiniOrange; include_once "connector.php"; use MiniOrange\Helper\DB; use DOMElement; use DOMNode; use DOMDocument; use Exception; use MiniOrange\Helper\SAMLUtilities; if (isset($_SESSION)) { goto dTD; } session_start(); dTD: if (isset($_SESSION["authorized"]) && !empty($_SESSION["authorized"])) { if (!($_SESSION["authorized"] != true)) { class IDPMetadataReader { private $identityProviders; private $serviceProviders; public function __construct(DOMNode $OC = NULL) { $this->identityProviders = array(); $this->serviceProviders = array(); $Km = new SAMLUtilities(); $zR = $Km->xpQuery($OC, "./saml_metadata:EntitiesDescriptor"); if (!empty($zR)) { $Dw = $Km->xpQuery($zR[0], "./saml_metadata:EntityDescriptor"); // [PHPDeobfuscator] Implied goto goto WPx; } $Dw = $Km->xpQuery($OC, "./saml_metadata:EntityDescriptor"); WPx: foreach ($Dw as $dt) { $wr = $Km->xpQuery($dt, "./saml_metadata:IDPSSODescriptor"); if (!(isset($wr) && !empty($wr))) { goto LZh; } array_push($this->identityProviders, new IdentityProviders($dt)); LZh: } } public function getIdentityProviders() { return $this->identityProviders; } public function getServiceProviders() { return $this->serviceProviders; } } class IdentityProviders { private $entityID; private $loginDetails; private $logoutDetails; private $signingCertificate; private $encryptionCertificate; private $signedRequest; public function __construct(DOMElement $OC = NULL) { $this->loginDetails = array(); $this->logoutDetails = array(); $this->signingCertificate = array(); $this->encryptionCertificate = array(); if (!$OC->hasAttribute("entityID")) { goto IiA; } $this->entityID = $OC->getAttribute("entityID"); IiA: if (!$OC->hasAttribute("WantAuthnRequestsSigned")) { goto Ttn; } $this->signedRequest = $OC->getAttribute("WantAuthnRequestsSigned"); Ttn: $Km = new SAMLUtilities(); $wr = $Km->xpQuery($OC, "./saml_metadata:IDPSSODescriptor"); if (count($wr) > 1) { throw new Exception("More than one <IDPSSODescriptor> in <EntityDescriptor>."); } if (empty($wr)) { throw new Exception("Missing required <IDPSSODescriptor> in <EntityDescriptor>."); } $AD = $wr[0]; $Ew = $Km->xpQuery($OC, "./saml_metadata:Extensions"); if (!$Ew) { goto J2y; } $this->parseInfo($AD); J2y: $this->parseSSOService($AD); $this->parseSLOService($AD); $this->parsex509Certificate($AD); } private function parseInfo($OC) { $Km = new SAMLUtilities(); $V4 = $Km->xpQuery($OC, "./mdui:UIInfo/mdui:DisplayName"); foreach ($V4 as $rN) { if (!($rN->hasAttribute("xml:lang") && $rN->getAttribute("xml:lang") == "en")) { goto hg5; } $this->idpName = $rN->textContent; hg5: } } private function parseSSOService($OC) { $Km = new SAMLUtilities(); $dU = $Km->xpQuery($OC, "./saml_metadata:SingleSignOnService"); foreach ($dU as $s1) { $SJ = str_replace("urn:oasis:names:tc:SAML:2.0:bindings:", '', $s1->getAttribute("Binding")); $this->loginDetails = array_merge($this->loginDetails, array($SJ => $s1->getAttribute("Location"))); } } private function parseSLOService($OC) { $Km = new SAMLUtilities(); $PZ = $Km->xpQuery($OC, "./saml_metadata:SingleLogoutService"); foreach ($PZ as $BC) { $SJ = str_replace("urn:oasis:names:tc:SAML:2.0:bindings:", '', $BC->getAttribute("Binding")); $this->logoutDetails = array_merge($this->logoutDetails, array($SJ => $BC->getAttribute("Location"))); } } private function parsex509Certificate($OC) { $Km = new SAMLUtilities(); foreach ($Km->xpQuery($OC, "./saml_metadata:KeyDescriptor") as $c7) { if ($c7->hasAttribute("use")) { if ($c7->getAttribute("use") == "encryption") { $this->parseEncryptionCertificate($c7); // [PHPDeobfuscator] Implied goto goto sFR; } $this->parseSigningCertificate($c7); goto sFR; } $this->parseSigningCertificate($c7); sFR: peb: } } private function parseSigningCertificate($OC) { $Km = new SAMLUtilities(); $ff = $Km->xpQuery($OC, "./ds:KeyInfo/ds:X509Data/ds:X509Certificate"); $UD = trim($ff[0]->textContent); $UD = str_replace(array("\r", "\n", "\t", " "), '', $UD); if (empty($ff)) { goto ZL_; } array_push($this->signingCertificate, $Km->sanitize_certificate($UD)); ZL_: } private function parseEncryptionCertificate($OC) { $Km = new SAMLUtilities(); $ff = $Km->xpQuery($OC, "./ds:KeyInfo/ds:X509Data/ds:X509Certificate"); $UD = trim($ff[0]->textContent); $UD = str_replace(array("\r", "\n", "\t", " "), '', $UD); if (empty($ff)) { goto bGZ; } array_push($this->encryptionCertificate, $UD); bGZ: } public function getEntityID() { return $this->entityID; } public function getLoginURL($SJ) { return $this->loginDetails[$SJ]; } public function getLogoutURL($SJ) { return $this->logoutDetails[$SJ]; } public function getLoginDetails() { return $this->loginDetails; } public function getLogoutDetails() { return $this->logoutDetails; } public function getSigningCertificate() { return $this->signingCertificate; } public function getEncryptionCertificate() { return $this->encryptionCertificate[0]; } public function isRequestSigned() { return $this->signedRequest; } } include_once "helper/SAMLUtilities.php"; if (isset($_SESSION)) { goto wQQ; } session_start(); wQQ: if (!isset($_SESSION["authorized"])) { header("Location: admin_login.php"); exit; } if (!($_SESSION["authorized"] != true)) { goto WZf; } header("Location: admin_login.php"); WZf: try { $user = DB::get_registered_user(); } catch (\Exception $kI) { $uu = $kI->getCode(); $f8 = $kI->getMessage(); $Zh = $kI->getTraceAsString(); $Rw = getenv("DB_CONNECTION"); $R8 = getenv("DB_DATABASE"); $rU = getenv("DB_HOST"); $QU = config("database.driver"); echo nl2br("{$uu} \n {$f8} \n DB_CONNECTION : {$Rw} \n DB_DATABASE : {$R8} \n DB_HOST : {$rU}\n If the above configuration report is empty or incomplete, run <b>php artisan config:clear</b> in your command-line, check your <b>.env</b> file and please try again. \n\nTRACE : \n {$Zh}"); exit; } if (!(isset($_POST["option"]) && $_POST["option"] == "save_metadata_file" && isset($_POST["Upload"]) && (isset($_FILES["metadata_file"]) && $_FILES["metadata_file"]["error"] == 0))) { jRO: function upload_metadata($mu) { $vq = new DOMDocument(); if (!($_FILES["metadata_file"]["type"] != "text/xml")) { $vq->loadXML($mu); $Ak = $vq->firstChild; if (!empty($Ak)) { $Z_ = new IDPMetadataReader($vq); $U4 = $Z_->getIdentityProviders(); if (!(empty($U4) && !empty($_FILES["metadata_file"]["tmp_name"]))) { foreach ($U4 as $g6 => $LO) { $yK = $LO->getLoginURL("HTTP-Redirect"); $eX = $LO->getEntityID(); $ek = $LO->getLogoutURL("HTTP-Redirect"); $oW = $LO->getSigningCertificate(); DB::update_option("saml_login_url", $yK); DB::update_option("idp_entity_id", $eX); DB::update_option("saml_logout_url", $ek); DB::update_option("saml_x509_certificate", $oW[0]); goto G0F; } G0F: DB::update_option("mo_saml_message", "Identity Provider details saved successfully."); mo_saml_show_success_message(); // [PHPDeobfuscator] Implied goto goto dXv; } DB::update_option("mo_saml_message", "Please provide a valid metadata file."); mo_saml_show_error_message(); return; } if (empty($_FILES["metadata_file"]["tmp_name"])) { goto Q4B; } DB::update_option("mo_saml_message", "Please provide a valid metadata file."); mo_saml_show_error_message(); Q4B: dXv: // [PHPDeobfuscator] Implied return return; } DB::update_option("mo_saml_message", "Please provide a valid metadata file."); mo_saml_show_error_message(); return; } if (!(isset($_POST["option"]) && $_POST["option"] == "save_connector_settings")) { goto f2m; } $o7 = ''; $un = ''; $yK = ''; $oX = ''; $ek = ''; $oW = ''; $YA = ''; $N2 = ''; $HA = ''; $xx = ''; $d2 = ''; $Uj = ''; $ds = ''; $VK = ''; $e6 = ''; $Lr = ''; if (mo_saml_check_empty_or_null($_POST["idp_name"]) || mo_saml_check_empty_or_null($_POST["saml_login_url"]) || mo_saml_check_empty_or_null($_POST["idp_entity_id"])) { DB::update_option("mo_saml_message", "All the fields are required. Please enter valid entries."); mo_saml_show_error_message(); return; } if (!preg_match("/^\\w*\$/", $_POST["idp_name"])) { DB::update_option("mo_saml_message", "Please match the requested format for Identity Provider Name. Only alphabets, numbers and underscore is allowed."); mo_saml_show_error_message(); return; } $o7 = trim($_POST["idp_name"]); $yK = trim($_POST["saml_login_url"]); $ek = trim($_POST["saml_logout_url"]); if (!array_key_exists("login_binding_type", $_POST)) { goto GYT; } $oX = $_POST["login_binding_type"]; GYT: if (!array_key_exists("saml_logout_url", $_POST)) { goto uff; } $ek = trim($_POST["saml_logout_url"]); uff: $un = trim($_POST["idp_entity_id"]); $oW = sanitize_certificate($_POST["x509_certificate"]); if (isset($_POST["force_authn"]) && !empty($_POST["force_authn"])) { $YA = true; // [PHPDeobfuscator] Implied goto goto eJg; } $YA = false; eJg: if (isset($_POST["force_sso"]) && !empty($_POST["force_sso"])) { $N2 = true; // [PHPDeobfuscator] Implied goto goto dhj; } $N2 = false; dhj: if (isset($_POST["auto_create_users"]) && !empty($_POST["auto_create_users"])) { $HA = true; // [PHPDeobfuscator] Implied goto goto umc; } $HA = false; umc: $Uj = trim($_POST["site_base_url"]); pzh: if (!(substr($Uj, 1) == "/")) { $ds = $Uj . "/miniorange_laravel_saml_connector"; $VK = $Uj . "/sso.php"; $e6 = $Uj . "/logout.php"; $xx = trim($_POST["relaystate_url"]); $d2 = trim($_POST["site_logout_url"]); $Lr = trim($_POST["sso_attribute"]); if (filter_var($Uj, FILTER_VALIDATE_URL)) { if (filter_var($VK, FILTER_VALIDATE_URL)) { if (filter_var($e6, FILTER_VALIDATE_URL)) { if (!(!empty($ek) and !filter_var($ek, FILTER_VALIDATE_URL))) { if (filter_var($yK, FILTER_VALIDATE_URL)) { goto u6T; } DB::update_option("mo_saml_message", "Invalid SAML Login URL"); mo_saml_show_error_message(); u6T: DB::update_option("saml_identity_name", $o7); DB::update_option("idp_entity_id", $un); DB::update_option("saml_login_url", $yK); DB::update_option("saml_login_binding_type", $oX); DB::update_option("saml_logout_url", $ek); DB::update_option("saml_x509_certificate", $oW); DB::update_option("force_authentication", $YA); DB::update_option("force_sso", $N2); DB::update_option("auto_create_users", $HA); DB::update_option("sp_base_url", $Uj); DB::update_option("sp_entity_id", $ds); DB::update_option("acs_url", $VK); DB::update_option("single_logout_url", $e6); DB::update_option("relaystate_url", $xx); DB::update_option("site_logout_url", $d2); DB::update_option("sso_attribute", $Lr); DB::update_option("mo_saml_message", "Settings saved successfully."); mo_saml_show_success_message(); if (!empty($oW)) { goto VaT; } DB::update_option("mo_saml_message", "Invalid Certificate:Please provide a certificate"); mo_saml_show_error_message(); VaT: $oW = sanitize_certificate($oW); if (@openssl_x509_read($oW)) { goto NiU; } DB::update_option("mo_saml_message", "Invalid certificate: Please provide a valid certificate."); mo_saml_show_error_message(); DB::delete_option("saml_x509_certificate"); NiU: f2m: if (!(isset($_POST["option"]) && $_POST["option"] == "attribute_mapping")) { goto fSi; } if (isset($_POST["saml_am_email"]) && !empty($_POST["saml_am_email"])) { DB::update_option("saml_am_email", $_POST["saml_am_email"]); // [PHPDeobfuscator] Implied goto goto sja; } DB::update_option("saml_am_email", "NameID"); sja: if (isset($_POST["saml_am_username"]) && !empty($_POST["saml_am_username"])) { DB::update_option("saml_am_username", $_POST["saml_am_username"]); // [PHPDeobfuscator] Implied goto goto PTF; } DB::update_option("saml_am_username", "NameID"); PTF: if (!(isset($_POST["attribute_name"]) && isset($_POST["attribute_value"]))) { goto WwC; } $g6 = $_POST["attribute_name"]; $kZ = $_POST["attribute_value"]; $H0 = array_combine($g6, $kZ); $H0 = array_filter($H0); $H0 = serialize($H0); DB::update_option("mo_saml_custom_attrs_mapping", $H0); WwC: DB::update_option("mo_saml_message", "Attribute Mapping details saved successfully"); mo_saml_show_success_message(); fSi: echo " \r\n"; } DB::update_option("mo_saml_message", "Invalid SAML Logout URL"); mo_saml_show_error_message(); return; } DB::update_option("mo_saml_message", "Invalid SP SLO URL"); mo_saml_show_error_message(); return; } DB::update_option("mo_saml_message", "Invalid ACS URL"); mo_saml_show_error_message(); return; } DB::update_option("mo_saml_message", "Invalid SP Base URL"); mo_saml_show_error_message(); return; } $Uj = substr($Uj, 0, 1); goto pzh; } if (!empty($_FILES["metadata_file"]["tmp_name"])) { $mu = @file_get_contents($_FILES["metadata_file"]["tmp_name"]); bqQ: if (is_null($mu)) { goto jRO; } upload_metadata($mu); // [PHPDeobfuscator] Implied goto goto jRO; } if (mo_saml_is_curl_installed()) { goto bqQ; } DB::update_option("mo_saml_message", "PHP cURL extension is not installed or disabled. Cannot fetch metadata from URL."); mo_saml_show_error_message(); return; } header("Location: admin_login.php"); exit; } header("Location: admin_login.php"); exit;
■【無料】ワードプレス:マルウェアスキャン&セキュリティープラグイン [マルウェア・ウィルス検出と駆除]
■WordPress のマルウェア駆除、セキュリティー対策 カスタマイズや修正、引っ越し・復旧のご依頼承ります
(C)2019 ワードプレス ドクター All rights reserved.