Issues (85)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  Header Injection
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/XML/md/AbstractSignedMdElement.php (4 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\md;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\XML\SignableElementTrait;
9
use SimpleSAML\SAML2\XML\SignedElementTrait;
10
use SimpleSAML\XMLSecurity\XML\SignableElementInterface;
11
use SimpleSAML\XMLSecurity\XML\SignedElementInterface;
12
13
use function method_exists;
14
15
/**
16
 * Abstract class that represents a signed metadata element.
17
 *
18
 * @package simplesamlphp/saml2
19
 */
20
abstract class AbstractSignedMdElement extends AbstractMdElement implements
21
    SignableElementInterface,
22
    SignedElementInterface
23
{
24
    use SignableElementTrait;
0 ignored issues
show
The trait SimpleSAML\SAML2\XML\SignableElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\md\AbstractSignedMdElement: $ownerDocument, $documentElement
Loading history...
25
    use SignedElementTrait {
0 ignored issues
show
The trait SimpleSAML\SAML2\XML\SignedElementTrait requires some properties which are not provided by SimpleSAML\SAML2\XML\md\AbstractSignedMdElement: $ownerDocument, $documentElement
Loading history...
26
        SignedElementTrait::getBlacklistedAlgorithms insteadof SignableElementTrait;
27
    }
28
29
    /**
30
     * The original signed XML
31
     *
32
     * @var \DOMElement
33
     */
34
    protected DOMElement $xml;
35
36
37
    /**
38
     * Get the XML element.
39
     *
40
     * @return \DOMElement
41
     */
42
    public function getXML(): DOMElement
43
    {
44
        return $this->xml;
45
    }
46
47
48
    /**
49
     * Set the XML element.
50
     *
51
     * @param \DOMElement $xml
52
     */
53
    protected function setXML(DOMElement $xml): void
54
    {
55
        $this->xml = $xml;
56
    }
57
58
59
    /**
60
     * @param \DOMElement|null $parent The EntityDescriptor we should append this SPSSODescriptor to.
61
     * @return \DOMElement
62
     * @throws \Exception
63
     */
64
    public function toXML(?DOMElement $parent = null): DOMElement
65
    {
66
        if ($this->isSigned() === true && $this->signer === null) {
67
            // We already have a signed document and no signer was set to re-sign it
68
            if ($parent === null) {
69
                return $this->getXML();
70
            }
71
72
            $node = $parent->ownerDocument?->importNode($this->getXML(), true);
73
            $parent->appendChild($node);
74
            return $parent;
75
        }
76
77
        $e = $this->toUnsignedXML($parent);
78
        // This is a dirty hack, but if we add the xsi-type on AbstractRoleDescriptor we cannot
79
        // get the tests to pass because the attribute-order is messed up. This has something
80
        // to do with the fact that toUnsignedXML's recursive nature.
81
        if (method_exists(static::class, 'getXsiTypePrefix')) {
82
            $e->setAttributeNS(
83
                'http://www.w3.org/2000/xmlns/',
84
                'xmlns:' . static::getXsiTypePrefix(),
0 ignored issues
show
The method getXsiTypePrefix() does not exist on SimpleSAML\SAML2\XML\md\AbstractSignedMdElement. It seems like you code against a sub-type of SimpleSAML\SAML2\XML\md\AbstractSignedMdElement such as SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

84
                'xmlns:' . static::/** @scrutinizer ignore-call */ getXsiTypePrefix(),
Loading history...
85
                static::getXsiTypeNamespaceURI(),
0 ignored issues
show
The method getXsiTypeNamespaceURI() does not exist on SimpleSAML\SAML2\XML\md\AbstractSignedMdElement. It seems like you code against a sub-type of SimpleSAML\SAML2\XML\md\AbstractSignedMdElement such as SimpleSAML\SAML2\XML\md\AbstractRoleDescriptor. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

85
                static::/** @scrutinizer ignore-call */ 
86
                        getXsiTypeNamespaceURI(),
Loading history...
86
            );
87
        }
88
89
        if ($this->signer !== null) {
90
            $signedXML = $this->doSign($e);
91
            $signedXML->insertBefore($this->signature?->toXML($signedXML), $signedXML->firstChild);
92
            return $signedXML;
93
        }
94
95
        return $e;
96
    }
97
98
99
    /**
100
     * @param  \DOMElement|null $parent
101
     * @return \DOMElement
102
     */
103
    abstract public function toUnsignedXML(?DOMElement $parent = null): DOMElement;
104
}
105