简体   繁体   English

带有https WSDL的SOAP是否安全?

[英]Is SOAP with a https WSDL secure?

I'm working on a project using PHP and SOAP to connect to a web service, and I have a question about security. 我正在使用PHP和SOAP连接到Web服务的项目上,我对安全性有疑问。

At a basic level, my code is as follows: 在基本级别上,我的代码如下:

// Connect to web service
$client = new SoapClient( 'https://mywebservice.com:8443/whatever?wsdl' );

// Store the response after passing my values for that service
$response = $client->my_service( $my_args );

The SoapClient URL is over https, and is an address to a WSDL. SoapClient URL通过https进行访问,并且是WSDL的地址。 It all functions fine - I'm able to return and post data back with no problems. 一切功能正常-我可以毫无问题地返回和发布数据。

The website it will be used on is using SSL sitewide. 将在其上使用的网站在整个站点范围内使用SSL。 My question is - is the above method secure for passing sensitive data back and forth if we're using https for the WSDL? 我的问题是-如果我们在WSDL中使用https,则上述方法对于来回传递敏感数据是否安全? Or should I be doing something extra with SOAP I'm not aware of? 还是应该对我不了解的SOAP做一些额外的事情?

I'm aware there's WS-Security, but is that needed if everything is over https? 我知道这里有WS-Security,但是如果一切都通过https进行,那是否需要?

Thanks 谢谢

Answering security questions requires asking self what we are trying to protect, and what could attack vectors be. 要回答安全问题,需要问自己:我们正在努力保护什么,以及攻击媒介可能是什么。

In short HTTPS, from your requirements, is safe. 简而言之,根据您的要求,HTTPS是安全的。 This because you are asking whether SSL can securely protect an information the web server knows and wants to send to the back-end server. 这是因为您正在询问SSL是否可以安全地保护Web服务器知道并希望发送到后端服务器的信息。 SSL is for that. SSL是为此目的。 You don't need to use additional WS-Security features. 您不需要使用其他WS-Security功能。 At least please validate server certificate. 至少请验证服务器证书。

This is safe as soon as all the website runs under SSL and you implement all common requirements for secure websites, including the HSTS header and refuse to serve HTTP requests. 一旦所有网站都在SSL下运行,并且您对安全网站实施了所有常见要求(包括HSTS标头并拒绝提供HTTP请求),这将是安全的。 I am saying this because I assume that the sensitive data you may like to protect comes from the client. 我之所以这样说,是因为我假设您可能希望保护的敏感数据来自客户端。

Example 1 例子1

As an example, suppose a credit card payment system with a vulnerability. 例如,假设有一个漏洞的信用卡支付系统。

  • Client connects via HTTPS to web server and sends CC number. 客户端通过HTTPS连接到Web服务器并发送抄送号码。 No one can see that 没有人能看到
  • Server pushes the card number to back-end via HTTPS. 服务器通过HTTPS将卡号推送到后端。 No one can see that 没有人能看到
  • Back end stores the credit card number plaintext in the database system 后端将信用卡号明文存储在数据库系统中

The answer will be: "OK, you are protecting communication between web server and backend, but beware that someone is interested at looking at the database". 答案将是:“好的,您正在保护Web服务器与后端之间的通信,但请注意有人对查看数据库感兴趣”。 Imagine a SQL injection vulnerability on an HTTPS website capable of dumping credit cards database. 想象一下一个HTTPS网站上的SQL注入漏洞,该漏洞能够转储信用卡数据库。 This is not what HTTPS is for. 这不是HTTPS的目的。

Example 2 例子2

Now let's examine another scenario where HTTPS is not enough. 现在让我们检查一下HTTPS不够的另一种情况。 Basically, HTTPS protects end-to-end communications. 基本上,HTTPS保护端到端通信。 Here is my requirement: 这是我的要求:

  • The payment authorization must be permanently signed by the machine requesting for the payment and stored for future auditing in a third-party service 付款授权书必须由请求付款的机器永久签名,并存储在第三方服务中以供将来审核

Clearly SSL won't solve this. 显然,SSL无法解决此问题。 Suppose your web service is part of a community and the back-end server talks with several web servers. 假设您的Web服务是社区的一部分,并且后端服务器与多个Web服务器对话。 SSL will protect and authenticate traffic between web and back end, however the back-end server can store arbitrarily valid SOAP messages claiming they come from your web server SSL将保护和验证Web与后端之间的流量,但是后端服务器可以存储任意有效的SOAP消息,声称它们来自您的Web服务器

You must sign the SOAP payload for that, and use WS-Security. 您必须为此签名SOAP有效负载,然后使用WS-Security。 The payload can be transferred to a third party auditing service, enveloped in an external SOAP message authenticated by the back-end service. 有效负载可以传输到第三方审核服务,该服务封装在由后端服务验证的外部SOAP消息中。

Example 3: let's make things complicated 例3:让事情变得复杂

Now let me alter your question. 现在,让我更改您的问题。 "How can I allow a client to send the web server a sensitive information that the server cannot read but the back-end can read?". “如何允许客户端向Web服务器发送服务器无法读取但后端可以读取的敏感信息?”

Here is, for example, when a POS machine (like the below photo, courtesy of Google Images) wants to send your web server a purchase order without revealing the CC number, that will be known only to the bank. 例如,例如,当POS机(如下面的图片,由Google图片提供)想要向您的网络服务器发送购买订单而不显示CC编号时,银行只会知道。

示例移动POS

Sorry, I can't find a university work I did in the past years about this scenario because I had a slide about it. 抱歉,找不到我过去几年在这种情况下所做的大学工作,因为我有一张幻灯片。

Then SSL is not enough and you can use WS-Security to do the following: SSL 还不够 ,您可以使用WS-Security进行以下操作:

  • Client forms a SOAP message containing the card number that is encrypted with the back-end server key 客户端形成一个SOAP消息,其中包含用后端服务器密钥加密的卡号
  • Client envelopes that SOAP message with a purchase order containing the items and sends it to your server, even via HTTP 客户端使用包含商品的采购订单来封装该SOAP消息,然后甚至通过HTTP将其发送到您的服务器
  • Web Server takes the purchase order and prepares the order Web Server接收采购订单并准备订单
  • Web Server takes the unreadable SOAP message encrypted for the bank and issues a payment order Web服务器采用为银行加密的不可读的SOAP消息并发出付款指令
  • On successful payment, the order is delivered 付款成功后,订单已交付

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么肥皂安全? 为什么不使用HTTPS? - Why is soap secure? why not HTTPS? SOAP错误:解析WSDL:无法从'https加载 - SOAP-ERROR: Parsing WSDL: Couldn't load from 'https PHP Soap 客户端无法加载 https wsdl 链接 - PHP Soap Client cannot load https wsdl link 使用Zend Soap Client通过https在php中调用wsdl - Calling a wsdl in php over https using Zend Soap Client SOAP 错误:解析 WSDL:无法从“https://***?wsdl”加载 - SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://***?wsdl' 在https协议上访问SOAP Web服务会引发异常SOAP-ERROR:解析WSDL - Accessing SOAP webservices on https protocol throws Exception SOAP-ERROR: Parsing WSDL SOAP 错误:解析 WSDL:无法从“https://ads.google...LineItemService?wsdl”加载:无法加载外部实体 - SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://ads.google...LineItemService?wsdl' : failed to load external entity 警告:SoapServer :: SoapServer():I / O警告:无法在以下位置加载外部实体“ https://…/soap-pruebas.wsdl” - Warning: SoapServer::SoapServer(): I/O warning : failed to load external entity “https://…/soap-pruebas.wsdl” in 当wsdl将服务端口绑定定义为https和端口80时,PHP SOAP请求失败的解决方法? - Workaround for PHP SOAP request failure when wsdl defines service port binding as https and port 80? 通过自签名证书的PHP SoapClient,SOAP错误:解析WSDL:无法从'https://加载 - PHP SoapClient over selfsigned certificate, SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM