ugotee160229 (Community Member) asked a question.

How to resolve CWE 73 (Directory Traversal) and CWE 117 (CRLF Injection)

We did veracode scan on our web api (C#) code we are getting two errors in report-

1) CWE 73 (Directory Traversal) - It is occurring on File.Delete() call , we have added a validation method on file name but that didn't worked.

Code Example -

if(File.Exists(fileName))

{

File.Delete(fileName);

}

2) CWE 117 (CRLF Injection) - It is occurring on Log.Info() call while assigning any int variable into this method , we tried fixing this by using AntiXssEncoder.UrlEncode() method. But it didn't worked.

Example - Log.Info(MethodName + "MethodName. Parameter:" + AntiXssEncoder.UrlEncode(Parameter))

 

We have tried almost all suggestions provided for such problem but nothing is working.

So Please suggest us on this.


Topics (5)

No articles found
Loading

Ask the Community

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