
JArredondo115396 (Community Member) asked a question.
I am new to Veracode mitigation and doing initial scans on several applications. One application which has hundreds of debugging lines had a number flagged as CWE-117 yet I am not able to determine a consistent basis for this. In the very same class I see this line of code generate the flaw (Note, _workModel.ProcessID is a GUID type):
_logger.Debug($"{_workModel.ProcessId}|Starting Certify Process. ");
yet in a similar method this line of code did not generate a flaw:
_logger.Debug($"{_workModel.ProcessId}|Attempting to clean Certify logs. ");
Many of these flaws do not write any sort of user information to logs, including types like GUID's and integers which cannot contain CRLF's or other unsafe characters and should be safer to write to logs but yet CWE-177 flaws occur. Please help me understand this inconsistency. Thanks.
.png)
Hi @JArredondo115396 (Community Member) ,
Veracode Static Analysis detects CWE 117 by inspecting the binary (or source code for source languages) for
Only if all 3 conditions are true will we report a flaw. In general though we recommend having a *consistent* logging strategy. For example using a Supported Cleansing Function ( https://help.veracode.com/go/review_cleansers ) on all dynamic data. If you implement this, Veracode Static Analysis will be able to automatically close the flaws.
There are also other solutions that can not be automatically detected by Veracode Static Analysis, for example not logging to a log file but logging to a logging service that does not delimit with newlines (\n and \r).
If you're using this you can document this in a mitigation proposal ( https://help.veracode.com/go/improve_mitigation ) and contact your security team for approval.
Thank you,
Boy Baukema