JGe356144 (Community Member) asked a question.

Why VeraCode scan report CWE 201 (Insertion of Sensitive Information Into Sent Data) on following code?

I have an application that need to send out email to the email address configured in web.config file. The code snippet is like following:

 

    protected void SendEmail(string strPDFName)

    {

        using (SmtpClient client = new SmtpClient())

        {

          using (MailMessage message = new MailMessage())

          {

            message.From = new MailAddress(ConfigurationManager.AppSettings["FromEmail"].ToString());

            message.To.Add(new MailAddress(ConfigurationManager.AppSettings["ToEmail"].ToString()));

 

            message.Subject = "Application";

            message.Body = "This is message body.";

            client.Send(message);

          }

        }

    }

 

VeraCode scan reports CWE 201 issue on line "client.Send(message);". In the flaw description, VeraCode indicates it is because of the ConfigurationManager.get_AppSettings call. The email "from" address and "to" address are from web.config file. It does not make sense to report it as a flaw.


DD672807 likes this.
  • Anthony Fielding (Veracode)

    Hello @JGe356144 (Community Member)​ ,

    Thanks for your question. We report this flaw when we observe potentially sensitive information from the application configuration leaving the application. In this case this flaw is a candidate for a "Mitigation By Design" mitigation proposal, since you have identified this data to not be sensitive.

     

    Kind regards,

    Anthony Fielding

    Expand Post
  • DD672807 (Community Member)

    If the data is sensitive how to fix this

    Can we use any encryption here

Topics (3)

No articles found
Loading

Ask the Community

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