RT831819 (Community Member) asked a question.

Encountering error CWE-117 using Microsoft.EnterprisePractices.Logging library where a dictionary object <string,object> is being passed. - in this case it is a string, datetime object.

Is there a way to remedy this?


  • Seb! (Veracode)

    Hi RT831819!

     

    Thanks for reaching out,

     

    Veracode will pick up CWE-117 whenever a string that can be influenced by input to the system is written to the logs. It's usually Carriage Returns & Line Feeds (CLRF) that we are worried about as it can lead to log forgery and flooding.

     

    We don't recognise any logging libraries out-of-the-box that mitigate against CLRF. To remove the flaw in Veracode we would recommend passing the string contents through a cleansing function for CWE-117 before writing to the logs. We support numerous .NET cleansers which can be found here https://help.veracode.com/reader/4EKhlLSMHm5jC8P8j3XccQ/IiF_rOE79ANbwnZwreSPGA

     

    Many logging libraries can be configured through templates to also mitigate CLRF, however this is not something that Veracode will detect. If you have configured your logger to protect against CLRF you can raise a "Mitigate by Design" within the Veracode platform for your security team to review.

     

    Hope this helps, Seb

    Expand Post
    • RT831819 (Community Member)

      We are using AntiXss to encode two strings that are part of the log and when sending just that information the scan passes. However, using .Net's Entripise logging library we are also sending a datetime stamp that is not based on user input and needs to be in the formation of a dictionary object <string,object> ("Timestamp", datetime) . Even when using the AntiXss on the string portion of the above, when actually writing to the log and using an object to represent the dictionary the scan shows a flaw again. Again, if we remove sending this piece of data everything works but we need to send datetime info for our log as the DB depends on it

       

       

      Expand Post

Topics (1)

No articles found
Loading

Ask the Community

Get answers, share a use case, discuss your favorite features, or get input from the community.