When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
Hi @LReddy078094 (Community Member) ,
Veracode Static Analysis reports a flaw of CWE 15 if it can detect that data from an external source is used in a connection string.
The danger is that an attacker may inject their own options into the connection string used (see for example https://security.stackexchange.com/a/178791/3206 ).
I would recommend you do the following:
Please let me know if you have any remaining questions or concerns.
Thank you,
Boy Baukema
Hello Boy,
Thank you for providing the explanation on CWE 15. I did go through the links provided, it was helpful. I cleared most of the flaws but one of them seems to be troubling me still.
I corrected my code to use OleDBConnection Builder, but doesn’t help. Still getting the same error except that the score percentage increased from 61 to 74%. (Not sure what that score implies here though)
Here is the code it is failing. What else do you think I need to do. Please help
Thanks,
Lavan
Hi Lavan,
As soon as Veracode Static Analysis detects *any* dynamic data from outside of the application it will report a flaw of CWE 15. In this example this may be the 'file' variable.
It will highlight that if the file is attacker controlled they may use that to select any file available to the application.
I would recommend reviewing whether it's possible to make the file value hardcoded (possibly with an if condition checking which hardcoded value to use).
If not possible, ensuring you have validation in place (for example ensuring that only files from a given directory may be selected) and proposing a mitigation documenting this validation, you can find more information on how to do so here: https://help.veracode.com/reader/DGHxSJy3Gn3gtuSIN2jkRQ/~p4MSKOS8F8X8h0KwFTKoQ . Mitigation proposals must be reviewed by a member of your organizations security team.
Please note that if you see percentage signs in your results instead of line numbers this is typically an indication you are not providing us with the PDB files so we are unable to give you a specific line number. If this is the case I would recommend reviewing our compilation guide ( https://help.veracode.com/reader/4EKhlLSMHm5jC8P8j3XccQ/UWyzuOKNbFbwQACRLkZVjA ) and ensuring the build you provide to us has been compiled with PDB files.
Please let me know if you have any remaining questions or concerns.
Thank you,
Boy Baukema
Tried this as well, didnt work
Hi Lavan,
Here too the file is still dynamic.
Please review my earlier comment.
Thank you,
Boy Baukema
Hi Boy,
I am facing a similar issue and I understand why Veracode is flagging it. But what I don't get is how to fix the flaw. I have tried replacing with empty char and throwing exceptions if the input contains a newline char. But still the scan flags it!
Hi @TThomas772283 (Community Member) ,
I would recommend you schedule a consultation call to discuss.
You can check out this knowledge article (https://community.veracode.com/s/article/How-to-schedule-a-consultation-call) on how to schedule a consultation call with us.
Thank you,
Boy Baukema