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 files1
chocapikk/cve-2023-35885Revision 78ece7c3f53e

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

src/Security/Authenticator/MfaAuthenticator.php

PHP · 7,488 bytes
<?php
 namespace App\Security\Authenticator; class MfaAuthenticator { private int $codeLength = 6; public static function createSecret($secretLength = 16) : string { goto cafe5; c930f: A4584: goto dc0a3; Ca1ec: $i = 0; goto b11b4; f2c8f: $rnd = false; goto B7223; A70b6: goto ef70b; goto dd72c; E134b: if ($cryptoStrong) { goto A53f7; } goto f2c8f; b11b4: ef70b: goto B2f88; Fe99e: goto ee80c; goto Bc915; d3db8: goto ab58d; goto b9ce5; B7223: A53f7: goto d0f11; Bc915: Cdc09: goto Ca1ec; Ab93a: $rnd = mcrypt_create_iv($secretLength, MCRYPT_DEV_URANDOM); goto bdc65; B2f88: if (!($i < $secretLength)) { goto f486e; } goto E3e42; b5371: $rnd = openssl_random_pseudo_bytes($secretLength, $cryptoStrong); goto E134b; E3172: if (function_exists("\x6f\160\x65\156\x73\x73\154\x5f\162\x61\156\144\157\155\137\x70\x73\x65\x75\144\157\137\x62\171\164\145\x73")) { goto cbe77; } goto e2dab; dc0a3: ++$i; goto A70b6; E3e42: $secret .= $validChars[ord($rnd[$i]) & 31]; goto c930f; d32de: throw new \Exception("\x4e\x6f\40\x73\157\165\162\143\x65\x20\157\146\x20\163\145\x63\165\162\x65\40\162\141\156\144\157\x6d"); goto Fe99e; b15e8: ca560: goto Dda6a; dd72c: f486e: goto ccb15; F6de9: return $secret; goto beb57; ccb15: ee80c: goto F6de9; A8b4e: $secret = ''; goto ce7f3; D0ea4: if ($rnd !== false) { goto Cdc09; } goto d32de; f6c33: if (function_exists("\155\143\162\x79\x70\x74\x5f\x63\162\x65\141\x74\x65\x5f\151\166")) { goto C6ef1; } goto E3172; bdc65: goto ab58d; goto a031b; a031b: cbe77: goto b5371; ce7f3: $rnd = false; goto Ec64f; e2dab: goto ab58d; goto b15e8; Ec64f: if (function_exists("\x72\x61\x6e\144\157\x6d\x5f\x62\x79\164\x65\163")) { goto ca560; } goto f6c33; b9ce5: C6ef1: goto Ab93a; cafe5: $validChars = self::getBase32LookupTable(); goto A8b4e; Dda6a: $rnd = random_bytes($secretLength); goto d3db8; d0f11: ab58d: goto D0ea4; beb57: } public function getCode($secret, $timeSlice = null) : string { goto Cea18; b33b5: $hm = hash_hmac("\x53\110\x41\61", $time, $secretKey, true); goto b7679; E4277: $value = unpack("\x4e", $hashpart); goto Afaa6; d51a7: D3f98: goto a184a; d5b3d: $timeSlice = floor(time() / 30); goto d51a7; df1e5: $value = $value & 0x7fffffff; goto C2fb7; C2fb7: $modulo = pow(10, $this->codeLength); goto d5164; b7679: $offset = ord(substr($hm, -1)) & 0xf; goto E56f2; E56f2: $hashpart = substr($hm, $offset, 4); goto E4277; D8777: $time = chr(0) . chr(0) . chr(0) . chr(0) . pack("\x4e\x2a", $timeSlice); goto b33b5; d5164: return str_pad($value % $modulo, $this->codeLength, "\60", STR_PAD_LEFT); goto B286e; Cea18: if (!($timeSlice === null)) { goto D3f98; } goto d5b3d; Afaa6: $value = $value[1]; goto df1e5; a184a: $secretKey = self::base32Decode($secret); goto D8777; B286e: } public function verifyCode($secret, $code, $discrepancy = 2, $currentTimeSlice = null) : bool { goto E8597; a4173: B72d2: goto Cd7c3; Dcee9: Bdf60: goto A9888; D55ee: D9157: goto E4918; E8597: if (!($currentTimeSlice === null)) { goto Bdf60; } goto db14e; Eeec8: E6d39: goto F8b34; ef82a: return true; goto f3b0a; F8b34: if (!($i <= $discrepancy)) { goto D9157; } goto E795b; db14e: $currentTimeSlice = floor(time() / 30); goto Dcee9; Ad498: goto E6d39; goto D55ee; C66ee: if (!self::timingSafeEquals($calculatedCode, $code)) { goto ed3af; } goto ef82a; f3b0a: ed3af: goto a4173; Ec114: return false; goto e4e32; A9888: if (!(strlen($code) != 6)) { goto e2917; } goto Ec114; B6711: $i = -$discrepancy; goto Eeec8; E795b: $calculatedCode = $this->getCode($secret, $currentTimeSlice + $i); goto C66ee; e4e32: e2917: goto B6711; E4918: return false; goto C23af; Cd7c3: ++$i; goto Ad498; C23af: } private static function base32Decode(string $secret) : string { goto c9c44; b8fff: B2003: goto C6de2; C6de2: ++$i; goto ef2fa; fb6f9: goto B4d47; goto f2482; A1546: Da4cd: goto a8051; c855f: return $binaryString; goto be9de; E53b3: A4782: goto d6cc0; b1eaa: if (!($z < count($eightBits))) { goto a8f18; } goto e1aa2; d6cc0: $secret = str_replace("\75", '', $secret); goto f8d3c; cdbe4: C6750: goto B42ca; Eeac4: B4d47: goto b1eaa; a8051: ++$j; goto fdd66; F91c2: $x .= str_pad(base_convert(@$base32charsFlipped[@$secret[$i + $j]], 10, 2), 5, "\60", STR_PAD_LEFT); goto A1546; B42ca: $i = $i + 8; goto Ed0fc; Ec3d4: if (in_array($paddingCharCount, $allowedValues)) { goto c3ebf; } goto d0eb4; feabf: if (in_array($secret[$i], $base32chars)) { goto c350c; } goto F66dc; ae2c1: $base32chars = self::getBase32LookupTable(); goto Bcab0; Fed2e: $i = 0; goto F7cc1; A3542: if (!($paddingCharCount == $allowedValues[$i] && substr($secret, -$allowedValues[$i]) != str_repeat($base32chars[32], $allowedValues[$i]))) { goto ac1cd; } goto f6577; Ed0fc: goto aa1e8; goto E9813; Dc8ee: $paddingCharCount = substr_count($secret, $base32chars[32]); goto A281c; f2482: a8f18: goto cdbe4; A281c: $allowedValues = array(6, 4, 3, 1, 0); goto Ec3d4; e1aa2: $binaryString .= ($y = chr(base_convert($eightBits[$z], 2, 10))) || ord($y) == 48 ? $y : ''; goto c8dd7; c9c44: if (!(true === empty($secret))) { goto D5d82; } goto f2506; fdd66: goto Ac887; goto f9def; C7468: if (!($j < 8)) { goto cd6d7; } goto F91c2; c8dd7: dbe70: goto b5068; F9099: D5d82: goto ae2c1; ef2fa: goto D8cb5; goto E53b3; Cf3fc: c3ebf: goto C32a7; a8470: $z = 0; goto Eeac4; C09ad: $eightBits = str_split($x, 8); goto a8470; ebe65: D8cb5: goto d620f; F7cc1: aa1e8: goto A16d7; d840e: c350c: goto e6500; d39e4: Ac887: goto C7468; A16d7: if (!($i < count($secret))) { goto ff32a; } goto D842e; Bcab0: $base32charsFlipped = array_flip($base32chars); goto Dc8ee; e9c6d: ac1cd: goto b8fff; F66dc: return false; goto d840e; D842e: $x = ''; goto feabf; f6577: return false; goto e9c6d; f8d3c: $secret = str_split($secret); goto ec716; f9def: cd6d7: goto C09ad; d620f: if (!($i < 4)) { goto A4782; } goto A3542; C32a7: $i = 0; goto ebe65; e6500: $j = 0; goto d39e4; d0eb4: return false; goto Cf3fc; f2506: return ''; goto F9099; ec716: $binaryString = ''; goto Fed2e; E9813: ff32a: goto c855f; b5068: ++$z; goto fb6f9; be9de: } private static function getBase32LookupTable() : array { return ["\101", "\102", "\103", "\104", "\x45", "\x46", "\x47", "\x48", "\x49", "\x4a", "\113", "\114", "\115", "\x4e", "\117", "\x50", "\121", "\x52", "\123", "\124", "\125", "\126", "\127", "\130", "\x59", "\132", "\x32", "\63", "\64", "\x35", "\66", "\x37", "\x3d"]; } private static function timingSafeEquals($safeString, $userString) : bool { goto e96f4; Fcd5b: ++$i; goto f80c1; Ea6eb: if (!($i < $userLen)) { goto Dfa5e; } goto e7eef; c6ed1: $result = 0; goto Ba855; e96f4: if (!function_exists("\150\x61\163\x68\x5f\x65\x71\165\141\154\163")) { goto b3c90; } goto d30f7; B21d3: B2947: goto c6ed1; Ba855: $i = 0; goto C0ea0; Ca477: b3c90: goto c5b58; E269b: return false; goto B21d3; Dfe03: Dfa5e: goto ecb40; f80c1: goto E87e2; goto Dfe03; C8350: $userLen = strlen($userString); goto ce8fb; C0ea0: E87e2: goto Ea6eb; Ef1b9: B445e: goto Fcd5b; c5b58: $safeLen = strlen($safeString); goto C8350; ce8fb: if (!($userLen != $safeLen)) { goto B2947; } goto E269b; e7eef: $result |= ord($safeString[$i]) ^ ord($userString[$i]); goto Ef1b9; d30f7: return hash_equals($safeString, $userString); goto Ca477; ecb40: return $result === 0; goto C5cb5; C5cb5: } public function getQrCodeLink($secret, $name, $issuer) : string { $qrCodeLink = sprintf("\157\x74\x70\141\165\164\x68\x3a\x2f\57\x74\x6f\164\160\x2f\45\x73\77\x73\x65\143\162\x65\164\x3d\45\163\x26\151\x73\x73\165\145\x72\x3d\45\163", $name, $secret, urlencode($issuer)); return $qrCodeLink; } }