OpenID安全性:RP不能确保auth被实际提供者批准

时间:2012-05-19 18:00:31

标签: openid dotnetopenauth openid-provider

一般说明

我使用DotNetOpenAuth实现了OP(OpenID提供程序)。我正在针对示例RP(依赖方)测试它,例如Drupal的OpenID登录和DotNetOpenAuth的OpenIdRelyingPartyWebForms解决方案中的Samples项目。

问题在于,据我所知,当浏览器反弹我的OP并发送“成功身份验证”请求(mode: id_resclaimed_id: smth等)返回RP ,RP不会尝试向OP执行服务器端请求,并询问它是否实际验证了用户。我可以看到OP返回了一个openid.sig签名,但是我再也看不到RP如何验证它,因为它没有与OP交换密钥。

所以问题是:在OP方面是否有一些设置可以使工作流程安全?

技术细节

我正在使用Wireshark来侦听RP端的HTTP流量。没有HTTPS,所以我可以查看和阅读所有消息。下面你可以看到究竟发生了什么。 B =浏览器, OP = OpenID提供商, RP =依赖方。域名将替换为* .example.com。

  1. (B - > RP)用户尝试访问信赖方上仅限会员的资源。他输入了浏览器发布到RP的OP端点。

      

    openid_identifier:http://OP.example.com/OpenId/Provider.aspx?xrds

  2. (RP - > OP - > RP) RP向我的OP发出服务器端请求,该请求返回XRDS文档。我在这里看不到类似秘密密钥交换的任何内容。

    <?xml version="1.0" encoding="UTF-8"?>
    <xrds:XRDS
        xmlns:xrds="xri://$xrds"
        xmlns:openid="http://openid.net/xmlns/1.0"
        xmlns="xri://$xrd*($v*2.0)">
        <XRD>
            <Service priority="10">
                <Type>http://specs.openid.net/auth/2.0/server</Type>
                <Type>http://openid.net/extensions/sreg/1.1</Type>
                <URI>http://OP.example.com/OpenId/Provider.aspx</URI>
            </Service>
        </XRD>
    </xrds:XRDS>
    
  3. (RP - &gt; B - &gt; OP)依赖方302-将用户重定向到OP的/OpenId/Provider.aspx?[params]网址,其中参数如下:

    openid.claimed_id: http://specs.openid.net/auth/2.0/identifier_select
    openid.identity: http://specs.openid.net/auth/2.0/identifier_select
    openid.assoc_handle: {634730422000625000}{jkQC1Q==}{32}
    openid.return_to: http://RP.example.com/login.aspx?ReturnUrl=%2FMembersOnly%2FDefault.aspx&dnoa.receiver=ctl00_Main_OpenIdLogin1&dnoa.UsePersistentCookie=Session&dnoa.userSuppliedIdentifier=http%3A%2F%2FOP.example.com%2FOpenId%2FProvider.aspx%3Fxrds
    openid.realm: http://RP.example.com/
    openid.mode: checkid_setup
    openid.ns: http://specs.openid.net/auth/2.0
    openid.ns.sreg: http://openid.net/extensions/sreg/1.1
    openid.sreg.policy_url: http://RP.example.com/PrivacyPolicy.aspx
    openid.sreg.required: email,gender,postcode,timezone
    
  4. (OP - > B - &gt; RP)提供商对用户进行身份验证,并使用以下网址参数将其重定向回RP:

    ReturnUrl: /MembersOnly/Default.aspx
    dnoa.receiver: ctl00_Main_OpenIdLogin1
    dnoa.UsePersistentCookie: Session
    dnoa.userSuppliedIdentifier: http://OP.example.com/OpenId/Provider.aspx?xrds
    openid.claimed_id: http://OP.example.com/OpenId/User.aspx/2925
    openid.identity: http://OP.example.com/OpenId/User.aspx/2925
    openid.sig: pWJ0ugjQATKGgRSW740bml9LDsSxFiJ+a9OLO6NlsvY=
    openid.signed: claimed_id,identity,assoc_handle,op_endpoint,return_to,response_nonce,ns.sreg,sreg.nickname,sreg.email
    openid.assoc_handle: {634730422000625000}{jkQC1Q==}{32}
    openid.op_endpoint: http://OP.example.com/OpenId/Provider.aspx
    openid.return_to: http://RP.example.com/login.aspx?ReturnUrl=%2FMembersOnly%2FDefault.aspx&dnoa.receiver=ctl00_Main_OpenIdLogin1&dnoa.UsePersistentCookie=Session&dnoa.userSuppliedIdentifier=http%3A%2F%2FOP.example.com%2FOpenId%2FProvider.aspx%3Fxrds
    openid.response_nonce: 2012-05-19T16:40:11ZSfsL4BK1
    openid.mode: id_res
    openid.ns: http://specs.openid.net/auth/2.0
    openid.ns.sreg: http://openid.net/extensions/sreg/1.1
    openid.sreg.nickname: user@OP.example.com
    openid.sreg.email: user@OP.example.com
    
  5. (RP - &gt; OP) RP对OP执行服务器端HTTP请求。没有数据传输,只是对先前获取的用户身份URL的GET请求。顺便说一下,为什么要提出这个要求?

    GET /OpenId/User.aspx/2925 HTTP/1.1
    
  6. (OP - &gt; RP) OP回复另一个XRDS文档:

    <xrds:XRDS
        xmlns:xrds="xri://$xrds"
        xmlns:openid="http://openid.net/xmlns/1.0"
        xmlns="xri://$xrd*($v*2.0)">
        <XRD>
            <Service priority="10">
                <Type>http://specs.openid.net/auth/2.0/signon</Type>
                <Type>http://openid.net/extensions/sreg/1.1</Type>
                <URI>http://OP.example.com/OpenId/Provider.aspx</URI>
            </Service>
            <Service priority="20">
                <Type>http://openid.net/signon/1.0</Type>
                <Type>http://openid.net/extensions/sreg/1.1</Type>
                <URI>http://OP.example.com/OpenId/Provider.aspx</URI>
            </Service>
        </XRD>
    </xrds:XRDS>
    
  7. (RP - &gt; B)就是这样。用户已获得授权,RP会向他显示仅限会员的资源。

2 个答案:

答案 0 :(得分:2)

RP可以在有状态无状态模式下运行(也分别称为智能和哑模式)。查看network flow charts for each

如果RP在有状态模式下运行,则RP和OP之间会进行一次性密钥交换。如果处于无状态模式,您将在每次验证后看到从RP到OP的消息,以验证断言的签名。

关于关于#5的问题(对声明的标识符的HTTP HEAD请求),这是DotNetOpenAuth RP,检查OP是否对其声明的身份具有权威性。由于之前已经提取了此URL,因此缓存会启动并避免内容传输。

答案 1 :(得分:0)

我现在感觉很蠢,我错过了一些基本的东西 - RP和OP之间的密钥交换,但它只发生一次,然后密钥在两侧缓存了一段时间

因此,我对OpenID提供程序的实现证明是安全的:)

相关问题