McAfee Vulnerability ??

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

McAfee Vulnerability ??

Post by Mike718NY » Tue Jun 09, 2009 10:59 am

McAfee took the seal off my website because they say I have a Vulnerability.
The page they pointed out produced this:

[[ConLib:Custom/ProdList]] Unclosed quotation mark after the character string ';",)` AND VisibilityId=0 ORDER BY name ASC'.

I'm guessing it's from this line of code from a custom page I made:

ProductCollection productList = ProductDataSource.LoadForCriteria(
"ManufacturerId=" + Request.QueryString["ID"] + " AND VisibilityId=0", "name ASC");

Is this a real threat or just one falsely flagged by McAfee?

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: McAfee Vulnerability ??

Post by Logan Rhodehamel » Tue Jun 09, 2009 11:24 am

Very real threat. What you are doing is insecure. You are passing unfiltered querystring data into a sql query.

Code: Select all

ManufacturerId=" + AlwaysConvert.ToInt(Request.QueryString["ID"]) + " AND VisibilityId=0", "name ASC");
Do that instead, ASAP.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

Re: McAfee Vulnerability ??

Post by Mike718NY » Tue Jun 09, 2009 12:12 pm

Thanks
Originally I was thinking along the same lines for a fix, like doing something like this:

int ID = (int)Request.QueryString["ID"];
.......

but your way does the trick.

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: McAfee Vulnerability ??

Post by Logan Rhodehamel » Tue Jun 09, 2009 12:20 pm

Mike718NY wrote:Thanks
Originally I was thinking along the same lines for a fix, like doing something like this:

int ID = (int)Request.QueryString["ID"];
.......

but your way does the trick.
I think your code may cause a crash if it can't cast the value into integer.. any time you take input from the query string assume someone is going to try to put bad data into it. The always convert function attempts a conversion to int. If it can't convert it to int, it returns a 0 without a crash.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

Re: McAfee Vulnerability ??

Post by Mike718NY » Tue Jun 09, 2009 1:14 pm

I'm getting the message:

The name 'AlwaysConvert' does not exist in the current context

Do I need to reference another AC assembly?
All I have now is:

using CommerceBuilder.Products;

User avatar
Logan Rhodehamel
Developer
Developer
Posts: 4116
Joined: Wed Dec 10, 2003 5:26 pm

Re: McAfee Vulnerability ??

Post by Logan Rhodehamel » Tue Jun 09, 2009 1:15 pm

Either CommerceBuilder.Utility or CommerceBuilder.Common... can't remember which off hand.
Cheers,
Logan
Image.com

If I do not respond to an unsolicited private message, it's not because I'm ignoring you. It's because the answer to your question is valuable to others. Try the new topic button.

Mike718NY
Commodore (COMO)
Commodore (COMO)
Posts: 485
Joined: Wed Jun 18, 2008 5:24 pm

Re: McAfee Vulnerability ??

Post by Mike718NY » Tue Jun 09, 2009 1:32 pm

CommerceBuilder.Utility
thanks

Post Reply