Skip navigation
xgen
Currently Being Moderated

Is cfinsert and cfupdate open to SQL Injection

Oct 12, 2009 2:19 PM

Hello All,

 

I'm looking for a real answer on if cfinsert and cfupdate are vulnerability to SQL Injection. The closest thing I can find from Adobe is Ben Forta's Personal recommendation. I was hoping to find some form of "official note" in the live docs to indicate there is a SQL Injection issue with cfinsert  - cfupdate. (Other than someone's post  to Ben's Blog)

http://www.forta.com/blog/index.cfm/2006/10/3/Use-CFINSERT-And-CFUPDAT E

 

In this forum I have seen this question asked, and the only answer is "You should validate your inputs". Yes, you should, but that does not answer the question of if cfinsert and cfupdate is vulnerability to SQL Injection.

 

I have found this blog entry that if I interpret is correctly from his findings cfinsert and cfupdate where only vulnerability to SQL Injection IF you did not give  cfinsert  - cfupdate the list of fields to take action on. -Is this true?

http://blog.securityps.com/2009/05/demystifying-cfinsert-sql-injection .html

 

Also, on a closely related note, is cfinsert  - cfupdate on ColdFusion 9 also vulnerable? If so, why? Seems like a BUG that could be easly addressed by the CF server team.

 

Thank you,

 
Replies
  • Currently Being Moderated
    Oct 12, 2009 4:35 PM   in reply to xgen

    Try it.  If you are using MS SQL or Sybase, you can putting mulitple queries into a cfquery tag.

     

    Here is your test.  In a numeric field, put "2; update yourtable set somefield = something_else" and submit the form to something with a cfinsert or cfupdate.  See what happens.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2009 11:58 AM   in reply to xgen

    There is an issue raised in the CF bugbase - http://cfbugs.adobe.com/cfbugreport/flexbugui/cfbugtracker/main.html#b ugId=78833.

     

    This implies:

    * yes it's a problem (the issue is open, not closed);

    * no it's not fixed.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 13, 2009 12:29 PM   in reply to xgen

    I do agree with you here.  But to be devil's advocate for a second: the same could be said of <cfquery>.  One has to take additional measures to ensure the same vulnerabilities are mitigated with that.

     

    I'm not sure that it's really news that these two tags are not the most well-thought-out features in the CF arsenal, and if you listen to most opinions in the community regarding <cfinsert> and <cfupdate>, it's: "don't use them".

     

    They're great for quick and dirty insert/update processes in internal or test code, but I'd never use them in production.

     

    It also remains a fact that any external input (form fields, URL param) must be validated as being kosher and within expected margins before they're used in any way.  That is just common sense.  And if one neglects to do that: one brings any eventuality onto one's self.  The problem here really is with people not doing their "due diligence" on externally sourced data, not specififcally with <cfinsert>, <cfupdate> or <cfquery>.

     

    Still: I think Adobe should make it more clear in the docs that additional measures need to be take to make them safe.  And by that time... one might as well use a <cfquery> to do the SQL.

     

    --

    Adam

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 29, 2012 4:49 AM   in reply to Adam Cameron.

    Just an update on this old, tired-out thread.

     

    I just tested <CFUPDATE> and <CFINSERT> on CF9.0.2 and CF10, and the SQL being sent to the DB is indeed parameterised.

     

    --

    Adam

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points