Issues (99)

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/saml/AbstractBaseID.php (1 issue)

Labels
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
namespace SimpleSAML\SAML2\XML\saml;
6
7
use DOMElement;
8
use SimpleSAML\SAML2\Assert\Assert;
9
use SimpleSAML\SAML2\Constants as C;
10
use SimpleSAML\SAML2\Type\SAMLStringValue;
11
use SimpleSAML\SAML2\Utils;
12
use SimpleSAML\SAML2\XML\EncryptableElementTrait;
13
use SimpleSAML\SAML2\XML\ExtensionPointInterface;
14
use SimpleSAML\SAML2\XML\ExtensionPointTrait;
15
use SimpleSAML\XML\Attribute as XMLAttribute;
16
use SimpleSAML\XML\Chunk;
17
use SimpleSAML\XML\SchemaValidatableElementInterface;
18
use SimpleSAML\XML\SchemaValidatableElementTrait;
19
use SimpleSAML\XMLSchema\Constants as C_XSI;
20
use SimpleSAML\XMLSchema\Exception\InvalidDOMElementException;
21
use SimpleSAML\XMLSchema\Exception\SchemaViolationException;
22
use SimpleSAML\XMLSchema\Type\QNameValue;
23
use SimpleSAML\XMLSecurity\Backend\EncryptionBackend;
24
use SimpleSAML\XMLSecurity\XML\EncryptableElementInterface;
25
26
/**
27
 * SAML BaseID data type.
28
 *
29
 * @package simplesamlphp/saml2
30
 */
31
abstract class AbstractBaseID extends AbstractBaseIDType implements
32
    EncryptableElementInterface,
33
    ExtensionPointInterface,
34
    SchemaValidatableElementInterface
35
{
36
    use EncryptableElementTrait;
0 ignored issues
show
The trait SimpleSAML\SAML2\XML\EncryptableElementTrait requires the property $ownerDocument which is not provided by SimpleSAML\SAML2\XML\saml\AbstractBaseID.
Loading history...
37
    use ExtensionPointTrait;
38
    use SchemaValidatableElementTrait;
39
40
41
    /** @var string */
42
    public const LOCALNAME = 'BaseID';
43
44
45
    /**
46
     * Initialize a saml:BaseID from scratch
47
     *
48
     * @param \SimpleSAML\XMLSchema\Type\QNameValue $type
49
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $NameQualifier
50
     * @param \SimpleSAML\SAML2\Type\SAMLStringValue|null $SPNameQualifier
51
     */
52
    protected function __construct(
53
        protected QNameValue $type,
54
        ?SAMLStringValue $NameQualifier = null,
55
        ?SAMLStringValue $SPNameQualifier = null,
56
    ) {
57
        parent::__construct($NameQualifier, $SPNameQualifier);
58
    }
59
60
61
    /**
62
     * @return \SimpleSAML\XMLSchema\Type\QNameValue
63
     */
64
    public function getXsiType(): QNameValue
65
    {
66
        return $this->type;
67
    }
68
69
70
    /**
71
     * Convert XML into an BaseID
72
     *
73
     * @param \DOMElement $xml The XML element we should load
74
     * @return static
75
     *
76
     * @throws \SimpleSAML\XMLSchema\Exception\InvalidDOMElementException
77
     *   if the qualified name of the supplied element is wrong
78
     */
79
    public static function fromXML(DOMElement $xml): static
80
    {
81
        Assert::same($xml->localName, 'BaseID', InvalidDOMElementException::class);
82
        Assert::same($xml->namespaceURI, C::NS_SAML, InvalidDOMElementException::class);
83
        Assert::true(
84
            $xml->hasAttributeNS(C_XSI::NS_XSI, 'type'),
85
            'Missing required xsi:type in <saml:BaseID> element.',
86
            SchemaViolationException::class,
87
        );
88
89
        $type = QNameValue::fromDocument($xml->getAttributeNS(C_XSI::NS_XSI, 'type'), $xml);
90
91
        // now check if we have a handler registered for it
92
        $handler = Utils::getContainer()->getExtensionHandler($type);
93
        if ($handler === null) {
94
            // we don't have a handler, proceed with unknown identifier
95
            return new UnknownID(
96
                new Chunk($xml),
97
                $type,
98
                self::getOptionalAttribute($xml, 'NameQualifier', SAMLStringValue::class, null),
99
                self::getOptionalAttribute($xml, 'SPNameQualifier', SAMLStringValue::class, null),
100
            );
101
        }
102
103
        Assert::subclassOf(
104
            $handler,
105
            AbstractBaseID::class,
106
            'Elements implementing BaseID must extend \SimpleSAML\SAML2\XML\saml\AbstractBaseID.',
107
        );
108
        return $handler::fromXML($xml);
109
    }
110
111
112
    /**
113
     * Convert this BaseID to XML.
114
     *
115
     * @param \DOMElement $parent The element we are converting to XML.
116
     * @return \DOMElement The XML element after adding the data corresponding to this BaseID.
117
     */
118
    public function toXML(?DOMElement $parent = null): DOMElement
119
    {
120
        $e = parent::toXML($parent);
121
        $e->setAttributeNS(
122
            'http://www.w3.org/2000/xmlns/',
123
            'xmlns:' . static::getXsiTypePrefix(),
124
            static::getXsiTypeNamespaceURI()->getValue(),
125
        );
126
127
        $type = new XMLAttribute(C_XSI::NS_XSI, 'xsi', 'type', $this->getXsiType());
128
        $type->toXML($e);
129
130
        if ($this->getNameQualifier() !== null) {
131
            $e->setAttribute('NameQualifier', $this->getNameQualifier()->getValue());
132
        }
133
134
        if ($this->getSPNameQualifier() !== null) {
135
            $e->setAttribute('SPNameQualifier', $this->getSPNameQualifier()->getValue());
136
        }
137
138
        return $e;
139
    }
140
141
142
    public function getEncryptionBackend(): ?EncryptionBackend
143
    {
144
        // return the encryption backend you want to use,
145
        // or null if you are fine with the default
146
        return null;
147
    }
148
}
149