如安在SAML中查找bug——第一局部 | 申博官网
登录
  • 欢迎进入申博官网!
  • 如果您觉得申博官网对你有帮助,那么赶紧使用Ctrl+D 收藏申博官网并分享出去吧
  • 这里是申博官方网!
  • 申博官网是菲律宾sunbet官网品牌平台!
  • 申博开户专业品牌平台!

如安在SAML中查找bug——第一局部

申博_安全预警 申博 68次浏览 已收录 0个评论

申博网络安全巴士站

申博-网络安全巴士站是一个专注于网络安全、系统安全、互联网安全、信息安全,全新视界的互联网安全新媒体。

————————————-

媒介

这篇文章是关于Bug Bounty 项目中怎样发掘 SAML(平安断言符号言语)相干破绽的要领论的第一篇文章。关于挖洞方面,我的上风在于我有很强的CTF履历和网络平安配景,但关于web运用程序平安来讲却知之甚少。我发明我控制的测试web的要领有很多还须要革新,因而这些文章的目标是搜集来自多个泉源的信息,雄厚自身控制的web测试要领。我愿望任何人都能够经由历程我这一系列文章学到一项手艺,在挖洞的旅途上越挖越远。

配景

让我们从最先测试SAML布置所必需相识的中心观点最先。若是您已熟习基础知识,能够跳到第二局部或第三局部。

平安断言符号言语(SAML)

单点登录(SSO)是一种身份考证效劳,许可用户运用一组凭证接见多个运用程序。平安断言符号言语(Security Assertion Markup Language,SAML)是完成SSO的要领之一。SAML是由结构化信息范例增进构造(OASIS)宣布的基于XML的范例。基于Web的多域SSO无疑是运用SAML的最主要的用例。SAML另有一些其他的用例,好比Federated Identity,然则我们的存眷点在于基于Web的SSO上。归根结柢,SAML相当于一种对Web运用程序举行身份考证的协定。
在深切议论SAML时,我们将重点研讨SAML v2.0,迥殊是SAML v2.0 Web浏览器SSO配置文件,该配置文件界说了怎样在Web浏览器中运用SAML。SAMLv2.0自2005年就涌现了,深切研讨SAMLv2.0关于我们的取得bug赏金大有资助。

抽象地诠释

我近来从新申请了我家人的护照。荣幸的是,SAML和运用护照游览之间有一个异常轻易明白的干系。关于我们这些在美国的人来讲,为了取得护照,我们填写了须要的文件,网络相干文件,拍了张照片,买了一张汇款单,把他们整顿一下,然后送到当局审批。一旦我们有了护照,我们就能够经由历程供应护照来向任何人证实我们是谁。
设想一下我们想去德国游览。我们所须要做的就是在海关出示我们的护照,我们就能够出发了。德国不须要看到我们填写的表格,我们寄来的汇票,或许我们的出生证实。德国也不在乎我们等了两个月才拿到护照,也不在乎我们为了护照跑了邮局四躺。德国人只对护照感兴趣。护照证实了我们的身份。德国对当局有肯定水平的信托。他们认可,当局在签发护照时作出了应有的检察事情。
在这个例子中,有三个方面介入了进入德国的历程:德国、美国当局和我们。让我们类比到SAML中。
SAML断言:一条XML音讯,个中包罗有关用户身份和潜伏的其他用户属性的信息。在我们的示例中,护照就是SAML断言。
身份供应商(IDP):实行身份考证并发出断言的效劳。在我们的示例中,美国当局就是IDP
效劳供应商(SP):用户愿望接见的Web运用程序。在我们的示例中,德国事SP。他们供应我们感兴趣的效劳,即进入该国(能够另有其他与啤酒有关的器械)。

SAML UNDERNEATH THE HOOD

SAML身份考证事情流程

下面概述的历程就是所谓的SP——Initiated登录。另有IdP-Initiated。区分特性是身份考证事情流程最先的地位。若是用户从SP最先,则它是SP-Initiated。若是用户从IdP最先,则它是IdP-Initiated。但我们将更多存眷于SP-Initiated事情流程。

如安在SAML中查找bug——第一局部

步调1-我们实验接见一些受珍爱的资本。
步调2-该资当地点的效劳器(效劳供应者)不认识我们,因而它天生一个SAML要求发送给身份供应者。
步调3-在天生SAML要求后,SP将我们重定向到IdP。注重:SAML要求经由历程浏览器抵达IdP。
步调4-Idp吸收SAML要求。
步调4a(图中未标注)-Idp供应了一些身份考证要领;登录表单或相似的器械。
步调4b(图中未标注)-为了使Idp考证我们是正当用户,应当许可它接见SAML要求中包罗的资本。
步调5-Idp建立SAML响应。SAML响应包罗SP所需的SAML断言。断言一般最少包罗以下信息:指导断言来自准确的Idp、指定用户身份的NameID属性和数字署名。SAML响应也经由历程我们的浏览器举行通报。
步调6-Idp将我们重定向到SP的断言消费者效劳(ACS)URL。ACS只是SP愿望吸收SAML断言的URL。
步调7-ACS考证SAML响应。
步调8-许可我们接见末了要求的资本。

SAML要求示例

让我们更细致地看一下上面概述的步调2和步调3。我们将向示例效劳供应者要求位于 https://shibdemo-sp1.test.edu/secure/的资本(望文生义,我们经由历程身份考证能力检察的内容)。
shibdemo-sp1.test.edu是用于测试的IDP和SP的当地假造化实例,而不是现实站点

GET /secure/ HTTP/1.1
Host: shibdemo-sp1.test.edu
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://shibdemo-sp1.test.edu/
Connection: close
Upgrade-Insecure-Requests: 1

SP会天生SAML要求,由于我们未经由历程身份考证。我们能够在下面看到原始SAML要求。

<?xml version="1.0"?>
<samlp:AuthnRequest 
    xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol" 
    AssertionConsumerServiceURL="https://shibdemo-sp1.test.edu/Shibboleth.sso/SAML2/POST" 
    Destination="https://shibdemo-idp.test.edu/idp/profile/SAML2/Redirect/SSO" 
    ID="_cdae718238ba9c207a35cc7c70b046a0" 
    IssueInstant="2019-03-12T20:54:58Z" 
    ProtocolBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" 
    Version="2.0">
    <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://shibdemo-sp1.test.edu/shibboleth</saml:Issuer>
    <samlp:NameIDPolicy AllowCreate="1"/>
</samlp:AuthnRequest>

AssertionConsumerServiceURL:标识身份考证后IdP应将SAML响应发送到的地位
Destination:透露表现要求发送到的地点(IdP)
ProtocolBinding:一般随同AssertionConsumerServiceURL属性; 界说SAML协定音讯的传输机制
saml:Issuer:标识天生要求音讯的实体

我们已概述了上述要求中凸起的元素,关于任何其他元素的详细信息能够在中心范例中检察。
上面的要求是如许的:“嘿,请对发送此音讯的用户举行身份考证,当您完成身份考证时请务必告诉我”。
建立SAML要求后,SP如今运用302重定向复兴我们对/secure/的GET要求。
302指导我们的浏览器转到Idp。SAML要求作为302的一局部编码到HTTP响应的地位标头中。

HTTP/1.1 302 Found
Date: Tue, 12 Mar 2019 20:54:58 GMT
Server: Apache/2.2.3 (CentOS)
Expires: Wed, 01 Jan 1997 12:00:00 GMT
Cache-Control: private,no-store,no-cache,max-age=0
Location: https://shibdemo-idp.test.edu/idp/profile/SAML2/Redirect/SSO?SAMLRequest=fZJdT4MwFIb%2FCuk9FNgmWzNIcLtwyXRkoBfemFKO0gRa7Cl%2B%2FHvZmDoTs8u2b5%2B350mXyNumY2lva7WH1x7QOh9to5AdD2LSG8U0R4lM8RaQWcHy9HbLQs9nndFWC90QJ0UEY6VWK62wb8HkYN6kgPv9Nia1tR0ySrGWZQWtdrELPDs0eVD1NB92S92ArT1ETQ%2FwkGa7vCDOeshIxQ%2Fcfyiy6n4pw4IOz3mWDZwQe6ikAWFpnu%2BIs1nH5ElUHKJgHk7mJV%2BI0I%2F4ZCZEJCK%2F9KdX3B9iiD1sFFqubExCP1i4%2FsQNwiL02WzKZvNH4mSnqa%2BlqqR6uayoHEPIbooic8exHsDgcaQhQJLlQTQ7Fpsz9Zex%2FNs3SS7bxR%2B7S3pWNLZ27G4gb9aZbqT4dNKm0e8rA9xCTAJCk%2FHK39%2BRfAE%3D&RelayState=ss%3Amem%3A39430bdac29d44586c326f12b4cb3345ffa47137a374e37cba0877e0fc79ea91
Content-Length: 897
Connection: close
Content-Type: text/html; charset=iso-8859-1

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://shibdemo-idp.test.edu/idp/profile/SAML2/Redirect/SSO?SAMLRequest=fZJdT4MwFIb%2FCuk9FNgmWzNIcLtwyXRkoBfemFKO0gRa7Cl%2B%2FHvZmDoTs8u2b5%2B350mXyNumY2lva7WH1x7QOh9to5AdD2LSG8U0R4lM8RaQWcHy9HbLQs9nndFWC90QJ0UEY6VWK62wb8HkYN6kgPv9Nia1tR0ySrGWZQWtdrELPDs0eVD1NB92S92ArT1ETQ%2FwkGa7vCDOeshIxQ%2Fcfyiy6n4pw4IOz3mWDZwQe6ikAWFpnu%2BIs1nH5ElUHKJgHk7mJV%2BI0I%2F4ZCZEJCK%2F9KdX3B9iiD1sFFqubExCP1i4%2FsQNwiL02WzKZvNH4mSnqa%2BlqqR6uayoHEPIbooic8exHsDgcaQhQJLlQTQ7Fpsz9Zex%2FNs3SS7bxR%2B7S3pWNLZ27G4gb9aZbqT4dNKm0e8rA9xCTAJCk%2FHK39%2BRfAE%3D&RelayState=ss%3Amem%3A39430bdac29d44586c326f12b4cb3345ffa47137a374e37cba0877e0fc79ea91">here</a>.</p>
<hr>
<address>Apache/2.2.3 (CentOS) Server at shibdemo-sp1.test.edu Port 443</address>
</body></html>

随SAML要求一同发送的RelayState参数是SP发送给IDP的状况信息,以便SP晓得SAML响应返回时末了要求资本的人。SAML响应必需包罗雷同的RelayState值。
SAMLRequest参数是我们前面看到的原始XML片断的紧缩和编码版本。SAML运用Deflate紧缩算法,然后Base64对效果举行编码。
oneLogin供应了一个优异的在线SAML东西套件,我们能够在个中运用SAML处置惩罚编码/解码和加密/解密等功能。

34c3 v9 writeup

环境搭建 https://github.com/saelo/v9 mkdir v9 && cd v9
fetch v8 && cd v8 # see https://github.com/v8/v8/wiki/Building-from-Source
git checkout 6.3.292.48
gclient sync
patch -p1 < /path/to/v9.patch ./tools/dev/v8gen.py x64.debug ninja -C out.gn/x64.debug exploit 工具类准备 这部分就是一些可复用的代码。 String.prototype.padLeft = Number.prototype.padLeft = function(total, pad) { return (Array(total).join(pad || 0) + this).slice(-total); } // Return the hexadecimal representation of the

如安在SAML中查找bug——第一局部
让我们继承深切研讨,看看IdP端会发作甚么。

SAML响应示例

我们直接跳到SAML身份考证事情流中议论的步调5和步调6。请记着,我们要检察的内容发作在用户向IDP举行身份考证以后。
让我们起首看一下原始的SAML响应。

<?xml version="1.0" encoding="UTF-8"?>
<samlp:Response Destination="https://shibdemo-sp1.test.edu/Shibboleth.sso/SAML2/POST" ID="_2af3ff4a06aa82058f0eaa8ae7866541" InResponseTo="_cdae718238ba9c207a35cc7c70b046a0" IssueInstant="2019-03-12T20:54:54.061Z" Version="2.0" xmlns:samlp="urn:oasis:names:tc:SAML:2.0:protocol">
    <saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity" xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://shibdemo-idp.test.edu/idp/shibboleth</saml:Issuer>  
    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
    <ds:SignedInfo>
      <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
      <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
      <ds:Reference URI="#_2af3ff4a06aa82058f0eaa8ae7866541">
        <ds:Transforms>
          <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
          <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        </ds:Transforms>
        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
        <ds:DigestValue>Se+WwXd5r44J56LauTz/wnP3jWg=</ds:DigestValue>
      </ds:Reference>
    </ds:SignedInfo>
    <ds:SignatureValue>f8X28hHMpnTi/Hqi6phuxqbYKsf99Qi8QqVI3x3zRj6njs+J9ey7qxw4GTMV657IfmmMotE0IAIrmPh3lebX65bCUCpiDtFaP04KjWNGGWa7z6rjwhRIY6chYGYzdmrXWmvY2EXW3nkynAJ2vXo5mncOz2P17/bQgqDU6BTzfRzYU6q6TcGLjRd7pGMGbBm6wH5c8aHM4FaQZNv7qHkIVvTlCRcpg/b8qS2fWW8kwgklLXd1xTCXh9XedxrFWq75nSFZ6FiakfUMybC5YIqZ7nr4GfVKqdmh3wvCF/P9jrUkBNDsw3Id63UAwbnMVv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Moj33wDDhaMH1Dlm23zfgB/0w3ztZnnmdxXJxGZuLiybJXTMbkjhUk41udHTQcsxKdaRoaQobDNdbqyl245RP15QXKphaz8DadCyH4v8o5NIU5lZyEG7KCpWnqWe6au6OrbGqBkqDIrEue3Wnu+TFaJRXBd12D9Xb8g==</ds:X509Certificate>
      </ds:X509Data>
    </ds:KeyInfo>
  </ds:Signature>
  <samlp:Status>
    <samlp:StatusCode Value="urn:oasis:names:tc:SAML:2.0:status:Success"/>
  </samlp:Status>
  <saml:Assertion xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ID="_e0acf8ced7e2cafc7c65b2c097842486e0838d76e0" IssueInstant="2019-03-13T22:44:33Z" Version="2.0">
    <saml:Issuer>https://shibdemo-idp.test.edu/idp/shibboleth</saml:Issuer>
    <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
      <ds:SignedInfo>
        <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
        <ds:Reference URI="#_e0acf8ced7e2cafc7c65b2c097842486e0838d76e0">
          <ds:Transforms>
            <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
          </ds:Transforms>
          <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
          <ds:DigestValue>kDAb3x6EFvA9VblqwbIFcCnLQvo=</ds:DigestValue>
        </ds:Reference>
      </ds:SignedInfo>
      <ds:SignatureValue>e6qavbOCH8YAAMzDXnEwT4R7VBvan2gfYU6f5M1Akp6bqZqu3H4iJ5/VKtkMb7773E4RtDpY1vy9+6hLd/BQ2V5ZN6HG12JOVAgCr9rzna2sgNDYzGfmHsOwD9QJTOYZIFU3mtOSK6Lk8bZxM7wK5X0vmRNHI5a3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WYXniebXpPNMfoMBPpMao20uv9dkKHH2AzuT7TWAICiSj29ZuHEVJaK1mfwErr+R8etKnGT0tA53/509+gWG0eCQSh+AF/VPWQ4JRoPMszKdLzl4surnNOA5JegKVvTcT91+G+OWv0hB4iMD/quegLSBfrlbtyTT58Moj33wDDhaMH1Dlm23zfgB/0w3ztZnnmdxXJxGZuLiybJXTMbkjhUk41udHTQcsxKdaRoaQobDNdbqyl245RP15QXKphaz8DadCyH4v8o5NIU5lZyEG7KCpWnqWe6au6OrbGqBkqDIrEue3Wnu+TFaJRXBd12D9Xb8g==</ds:X509Certificate>
        </ds:X509Data>
      </ds:KeyInfo>
    </ds:Signature>
    <saml:Subject>
      <saml:NameID Format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" SPNameQualifier="https://shibdemo-sp1.test.edu/shibboleth">_29b7a1a396d841b09fcf2b0bd8ce88fed6ad70e1a7</saml:NameID>
      <saml:SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer">
        <saml:SubjectConfirmationData InResponseTo="_cdae718238ba9c207a35cc7c70b046a0" NotOnOrAfter="2019-03-13T22:49:33Z" Recipient="https://shibdemo-sp1.test.edu/Shibboleth.sso/SAML2/POST"/>
      </saml:SubjectConfirmation>
    </saml:Subject>
    <saml:Conditions NotBefore="2019-03-13T22:44:03Z" NotOnOrAfter="2019-03-13T22:49:33Z">
      <saml:AudienceRestriction>
        <saml:Audience>https://shibdemo-sp1.test.edu/shibboleth</saml:Audience>
      </saml:AudienceRestriction>
    </saml:Conditions>
    <saml:AuthnStatement AuthnInstant="2019-03-13T22:44:33Z" SessionIndex="_a52c3c1242663b44b706523f0a2ada454eb997e40a" SessionNotOnOrAfter="2019-03-14T06:44:33Z">
      <saml:AuthnContext>
        <saml:AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</saml:AuthnContextClassRef>
      </saml:AuthnContext>
    </saml:AuthnStatement>
    <saml:AttributeStatement>
      <saml:Attribute Name="uid" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
        <saml:AttributeValue xsi:type="xs:string">epi</saml:AttributeValue>
      </saml:Attribute>
      <saml:Attribute Name="mail" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
        <saml:AttributeValue xsi:type="xs:string">epi@test.edu</saml:AttributeValue>
      </saml:Attribute>
      <saml:Attribute Name="first_name" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
        <saml:AttributeValue xsi:type="xs:string">epi</saml:AttributeValue>
      </saml:Attribute>
      <saml:Attribute Name="last_name" NameFormat="urn:oasis:names:tc:SAML:2.0:attrname-format:basic">
        <saml:AttributeValue xsi:type="xs:string">bar</saml:AttributeValue>
      </saml:Attribute>
    </saml:AttributeStatement>
  </saml:Assertion>
</samlp:Response>

ds:Signature:珍爱断言的完整性并对其举行身份考证的XML署名;能够对SAML断言举行署名,但没啥须要。
上面的示例包罗两个ds:Signature元素。一个是音讯的署名,另一个是断言的署名。
saml: Assertion:包罗关于用户身份和潜伏的其他用户属性的信息。
saml: Subject: 指定断言中所有语句的主体。
saml: StatusCode:透露表现响应响应要求而实行的运动状况的代码。
saml: Conditions: 指定断言有用的时候和断言发送给特定效劳供应者的时候。
saml: AuthnStatement:指出Idp对断言的主体举行了身份考证。
saml: AttributeStatement:包罗形貌断言主题的属性。

这是雷同SAML响应的更直观的可视化透露表现。

如安在SAML中查找bug——第一局部
既然我们已运用IDP举行了身份考证,而且它已天生了上面的SAML响应,那末它将运用另一个302重定向来响应我们的身份考证。

HTTP/1.1 302 Moved Temporarily
Date: Tue, 12 Mar 2019 20:54:53 GMT
Expires: 0
Cache-Control: no-cache, no-store, must-revalidate, max-age=0
Pragma: no-cache
Set-Cookie: _idp_session=MTkyLjE2OC4xLjk2%7CNmE1OWIwOTkxMjkzZjMyOTk2Yjg3NzE0NWNjYTkwYTliNGM1NDViZjRkZDhmY2M5OGQ2NmVjOGZlZTc0NzY1Ng%3D%3D%7CXWP3eN6ZeRPWk%2Bnj5AhRklHyIyU%3D; Version=1; Path=/idp; Secure
Location: https://shibdemo-idp.test.edu:443/idp/profile/SAML2/Redirect/SSO
Content-Length: 0
Connection: close
Content-Type: text/plain; charset=UTF-8

302终究致使我们向效劳供应者的断言运用者效劳URL发出POST要求。POST主体包罗RelayState和SAMLResponse参数。追念一下,ACS处置惩罚并考证SAML响应。

POST /Shibboleth.sso/SAML2/POST HTTP/1.1
Host: shibdemo-sp1.test.edu
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://shibdemo-idp.test.edu/idp/profile/SAML2/Redirect/SSO
Content-Type: application/x-www-form-urlencoded
Content-Length: 12314
Connection: close
Upgrade-Insecure-Requests: 1

RelayState=ss%3Amem%3A39430bdac29d44586c326f12b4cb3345ffa47137a374e37cba0877e0fc79ea91&SAMLResponse=PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48c2FtbDJwOlJlc3BvbnNlIHhtbG5zOnNhbWwycD0idXJuOm9hc2lzOm5hbWVzOnRjOlNBTUw6Mi4wOnByb3RvY29sIiBEZXN0aW5hdGlvbj0iaHR0cHM6Ly9zaGliZGVtby1zcDEudGVzdC5lZHUvU2hpYmJvbGV0aC5zc28vU0FNTDIvUE9TVCIgSUQ9Il8yYWYzZmY0YTA2YWE4MjA1OGYwZWFhOGFlNzg2NjU0MSIgSW5SZXNwb25zZVRvPSJfY2RhZTcxODIzOGJhOWMyMDdhMzVjYzdjNzBiMDQ2YTAiIElzc3VlSW5zdGFudD0iMjAxOS0wMy0xMlQyMDo1NDo1NC4wNjFaIiBWZXJzaW9uPSIyLjAiPjxzYW1sMjpJc3N1ZXIgeG1sbnM6c2FtbDI9InVybjpvYXNpczpuYW1lczp0YzpTQU1MOjIuMDphc3Nlc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VuYzpFbmNyeXB0ZWREYXRhPjwvc2FtbDI6RW5jcnlwdGVkQXNzZXJ0aW9uPjwvc2FtbDJwOlJlc3BvbnNlPg%3D%3D

一旦收到POST要求并考证SAML响应,我们就能够接见末了要求的受珍爱资本。

GET /secure/ HTTP/1.1
Host: shibdemo-sp1.test.edu
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Referer: https://shibdemo-idp.test.edu/idp/profile/SAML2/Redirect/SSO
Connection: close
Cookie: _shibsession_64656661756c7468747470733a2f2f7368696264656d6f2d7370312e746573742e6564752f73686962626f6c657468=_ac05716a62d3ee9450c863b093f32bbb
Upgrade-Insecure-Requests: 1
HTTP/1.1 200 OK
Date: Tue, 12 Mar 2019 20:55:04 GMT
Server: Apache/2.2.3 (CentOS)
X-Powered-By: PHP/5.1.6
Content-Length: 1047
Connection: close
Content-Type: text/html; charset=UTF-8


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>IDM Integration</title>
-------------8<-------------

XML署名

我们须要议论的末了一项是XML署名。风趣的是,XML署名能够用于对全部XML树或树中的特定元素举行署名。我们在前面已看到,在我们的示例SAML响应中运用了两个零丁的XML署名。每一个署名卖力分歧局部。在本节中,我们将研讨将XML署名合并到XML文档中的分歧要领。值得注重的是,虽然我们的示例运用响应元素作为要署名的资本,但XML署名能够运用于任何对象,包罗断言元素。

被封装的署名

基础XML署名由以下元素构成

<Signature>
  <SignedInfo>
    <CanonicalizationMethod />
    <SignatureMethod />
    <Reference>
       <Transforms />
       <DigestMethod />
       <DigestValue />
    </Reference>
    <Reference /> 
  </SignedInfo>
  <SignatureValue />
  <KeyInfo />
  <Object />
</Signature>

对我们来讲迥殊值得注重的是,要署名的每一个资本都有自身的Reference元素。Reference元素的URI属性透露表现由该特定署名的资本。

<samlp:Response ... ID="_2af3ff4a06aa82058f0eaa8ae7866541" ... >
    ...
    <ds:Signature>
        <ds:SignedInfo>
            ...
            <ds:Reference URI="#_2af3ff4a06aa82058f0eaa8ae7866541">
                ...
            </ds:Reference>
        </ds:SignedInfo>
    </ds:Signature>
    ...
</samlp:Response>

被封装的署名是指署名自身是其署名的资本的子女。我们能够在示例的ds:Transform元素中看到这一点。

<ds:Reference URI="#_2af3ff4a06aa82058f0eaa8ae7866541">
    <ds:Transforms>
        <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/>
        ...
    </ds:Transforms>
    ...
</ds:Reference>

封装的署名

若是XML署名包罗被署名的数据,则称为enveloping signature。

<ds:Signature>
    <ds:SignedInfo>
        ...
        <ds:Reference URI="#_2af3ff4a06aa82058f0eaa8ae7866541">
            ...
        </ds:Reference>
    </ds:SignedInfo>
    <samlp:Response ... ID="_2af3ff4a06aa82058f0eaa8ae7866541" ... >
        ...
    </samlp:Response>
</ds:Signature>

分离式署名

若是XML署名用于对包罗该署名的XML文档以外的资本署名,则称为detached signature

<samlp:Response ... ID="_2af3ff4a06aa82058f0eaa8ae7866541" ... >
    ...
</samlp:Response>
<ds:Signature>
    <ds:SignedInfo>
        ...
        <ds:Reference URI="#_2af3ff4a06aa82058f0eaa8ae7866541">
            ...
        </ds:Reference>
    </ds:SignedInfo>
</ds:Signature>

结论

署名、断言和响应之间的相互作用构成了本系列下一篇文章的主要内容。我们将研讨与SAML相干的分歧进击载体,然后深切研讨BurpSuite的SAML Raider插件。敬请期待。


申博|网络安全巴士站声明:该文看法仅代表作者自己,与本平台无关。版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明如安在SAML中查找bug——第一局部
喜欢 (0)
[]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址