Attacking WCF Web Services-Holyfield-Shmoocon 2010
Attacking WCF Web Services-Holyfield-Shmoocon 2010
Brian Holyfield
Gotham Digital Science
http://www.gdssecurity.com
[email protected]
Attacking WCF Web Services
• Session Objectives
– Introduction to WCF
– Tools & Techniques for Attacking WCF Services
• Session Outline
– WCF Overview
– Silverlight WCF Web Services
– WCF and WS-Security
– Duplex Services
WTF is WCF?
Attacker
Obtaining WCF MetaData
• HTTP-GET
– Same as legacy ASMX
– Retrieved by appending “?wsdl” to the address
<serviceMetadata httpGetEnabled="true"/>
[snip]
Basic MEX Request Structure
POST /MyService.svc/mex HTTP/1.1
Content-Type: application/soap+xml; charset=utf-8
Host: wcf.example.com
Content-Length: 565
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-
envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action>
http://schemas.xmlsoap.org/ws/2004/09/transfer/Get
</a:Action>
<a:To>
http://wcf.example.com/MyService.svc/mex
</a:To>
</s:Header>
<s:Body/>
</s:Envelope>
MetaData over SSL
– WcfTestClient
• Automatically Parses WSDL or MEX
• Ships with Visual Studio 2008+
– http://weblogs.asp.net/blogs/guillermo/Code/WcfTestClient.zip
– WCF Storm
• Supports most WCF bindings
• Free Lite Version available
– http://www.wcfstorm.com/wcf/download-wcfstorm-lite.aspx
Obtaining MetaData from XAP Files
23
Example 2: WCF Duplex Services
• CreateSequence
http://service/wcf.svc
Action: CreateSequence Port 80
Reply To: http://client:8000/test
• CreateSequence
http://service/wcf.svc http://target:8000/wcf.svc
Action: CreateSequence Action: CreateSequenceResponse
Reply To: http://target:8000/test Reply From: http://service/wcf.svc
• CreateSequence
http://service/wcf.svc Target1
Action: CreateSequence
Reply To: http://target1:8000/test
Client1
Target2
WSDualHttpBinding
• CreateSequence
http://service/wcf.svc Target1
Action: CreateSequence
Reply To: http://target1:8000/test
Client1 http://service/wcf.svc
Action: CreateSequence
Reply To: http://target2:8000/test
Target2
WSDualHttpBinding
• CreateSequence
http://service/wcf.svc Target1
Action: CreateSequence
Reply To: http://target1:8000/test
Client1 http://service/wcf.svc
Action: CreateSequence
Reply To: http://target2:8000/test
Target2
HTTP/1.1 202 Accepted
Abusing WSDualHttpBinding
10.X.X.X
myapp.cloudapp.net
Example 3: Secure WCF Bindings
QUESTIONS