Rule Definition
Setting IncludeExceptionDetailInFaults to true enables clients to obtain information about internal service method exceptions; it is only recommended as a way of temporarily debugging a service application. In addition, the WSDL for a method that returns unhandled managed exceptions in this way does not contain the contract for the FaultException of type ExceptionDetail. Clients must expect the possibility of an unknown SOAP fault to obtain the debugging information properly.
Remediation
Set the property to false or have by the default value.
Violation Code Sample
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single,InstanceContextMode = InstanceContextMode.Single,IncludeExceptionDetailInFaults=true)]
Fixed Code Sample
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single,InstanceContextMode = InstanceContextMode.Single,IncludeExceptionDetailInFaults=false)]
-or-
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Single,InstanceContextMode = InstanceContextMode.Single)]
Reference
https://docs.microsoft.com/fr-fr/dotnet/api/system.servicemodel.servicebehaviorattribute.includeexceptiondetailinfaults?view=netframework-4.7.2
Related Technologies
Technical Criterion
Secure Coding - Weak Security Features
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.