1

代理我正在尝试使用 WSO2 中的 ESB 构建 Web 服务。我的服务使用数据服务从数据库中获取数据,因此我需要将 esb 与 dss 连接起来。当代理和数据服务不安全时,它们可以正常工作,但是当它们安全时,我会收到以下错误

  <soapenv:Fault xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
     <faultcode>wsse:InvalidSecurity</faultcode>
     <faultstring>Nonce value : 8/BKMsFNs2gTJ58FXyV43Q==, already seen before for user name : UsuarioPrueba1. Possibly this could be a replay attack.</faultstring>
     <detail/>
  </soapenv:Fault>

保护数据服务但不代理其工作正常。我从 ESB 和 DSS 发送在用户和角色中创建的 usernametoken 和密码

4

1 回答 1

1

我们可能会收到此错误的一种可能情况是,如果我们使用标头中介来发送自定义 SOAP 安全标头。

例如,我在 [1] 中创建了一个代理,您可能会注意到我将以下元素放在了 soap 消息安全标头中。

<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">95euUDNp5wT7nT3BadS9Tw==</wsse:Nonce> 

由于我每次都向后端发送相同的随机数,因此后端将其检测为可能的重放攻击。

为了摆脱这个错误,我删除了上面的“Nonce”元素。然后后端停止给出错误

“Nonce 值:95euUDNp5wT7nT3BadS9Tw==,之前已经看到用户名:admin。这可能是重放攻击。”

了。

只有当我们在 Soap 安全标头中发送“Nonce”元素时,后端才会检查可能的重放攻击。因此,删除该元素是消除错误的一种方法。

这也意味着,仅当您不希望后端评估 Nonce 值以检测重放攻击时,这才是一种解决方案。

我知道这个问题已经一岁了;但想添加一个答案作为参考。

[1]

    <?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="InsuranceServiceProxy2"
       transports="https,http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <header scope="default">
            <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                           xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                           xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                           soapenv:mustUnderstand="1">
               <wsu:Timestamp wsu:Id="TS-23">
                  <wsu:Created>2015-06-13T03:07:55Z</wsu:Created>
               </wsu:Timestamp>
               <wsse:UsernameToken wsu:Id="UsernameToken-22">
                  <wsse:Username>admin</wsse:Username>
                  <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">admin</wsse:Password>
                  <wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">95euUDNp5wT7nT3BadS9Tw==</wsse:Nonce>
                  <wsu:Created>2015-06-13T03:07:55.091Z</wsu:Created>
               </wsse:UsernameToken>
            </wsse:Security>
         </header>
         <property name="Authorization"
                   value="Basic YWRtaW46YWRtaW4="
                   scope="transport"
                   type="STRING"/>
      </inSequence>
      <outSequence>
         <send/>
      </outSequence>
      <endpoint>
         <address uri="https://localhost:8243/services/InsuranceServiceBEProxy2"/>
      </endpoint>
   </target>
   <description/>
</proxy>
于 2015-06-13T15:26:53.863 回答