Prevents SQL injection - cannot use cfqueryparam in this case

Hello. I have a form with a checkbox next to each line.  If the user checks certain boxes, then click on the "Delete" button, I want to run the following query, but I want to protect from sql injection attacks:

< cfquery datasource = "#application.mainDS #" >
Remove userMessages
where messageID in (#form.messageID #)
< / cfquery >

As written above, it works fine.  But if I try to protect this code with < cfqueryparam value = "" #form.messageID # "cfsqltype ="cf_sql_varchar">, I get this error:"Conversion failed when you convert the value '7.21' int data type varchar"(7 and 21 are the messageID to delete)."  Of course the comma prevents the conversion of an integer.

If I use cfsqltype = "cf_sql_integer", the string is converted to a single integer (in this case 40015, which is nonsense).

I tried from form.messageID to a stored procedure, but I seemed to have the same problem here.  I was able to execute the query in a loop where I just want to remove a line at a time, but I want run a query if I can do it safely.  Any ideas?

Thank you.

PK

You just need to add the 'list' attribute to cfqueryparam to indicate that the 'value' contains multiple messageID.

Tags: ColdFusion

Similar Questions

  • prevent sql injection in the transition from input parameter

    Dear expert;

    I was advice not not programmed that way due to the fact, it could cause a SQL injection. Therefore, what is the alternative for below. It must be a function that returns a ref cursor See my below syntax
    create or replace package test as 
    
    type list_cur is ref cursor;
    function lists_needed(p_class varchar2) return list_cur;
    end test;
    
    create or replace package body test as
    function lists_needed(p_class varchar2) return list_cur is
    
    my_list_cur list_cur;
    
    begin
    open my_list_cur for 
    
    select id from tbl_one t where t.id like (p_class) || %;
    
    return my_list_cur;
    
    end lists_needed;
    end test;
    any help is appreciated. Thank you.

    SQL injection requires a dynamic code. I don't see how it could happen in this code or the example in your other thread.

  • Since I updated to Firefox 8 on Mac OS x 10.4.11, Firefox does not open more (not same previous versions downloaded via Safari). I get the error message "You cannot use Firefox with this version of Mac OS x" (translated from Dutch).

    I tried to create a new profile, the problem remains the same.

    None of the 3 accounts on this desktop computer can use Firefox. This has never been a problem. Today (14.11.11) I've updated Firefox to 8 and nothing more. Via Safari, I downloaded Firefox 7 to reinstall, same error message.

    From Firefox 4, Mac must have an Intel x 86 processor (which you do not have) and OSX 10.5 or higher (version OSX 10.4).

    The good news is that Firefox 3.6.24 still support OSX 10.4 and Mac with the PPC Mac architecture. The bad news is that the support for Firefox 3.6.x series is likely to end in the first quarter of 2012.

    If this answer solved your problem, please click 'Solved It' next to this response when connected to the forum.

  • In Oracle SQL, select cannot use the column in the statement and order of

    Hello

    Is there a work around for this.

    Thanks in advance
    Pablo.

    Hello

    943981 wrote:
    Hi all

    This is the error I get:

    ORA-00960: column ambiguous naming in select list
    00960 00000 - "ambiguous column naming in select list".
    * Cause: A column name in the order by list corresponds to more than a select
    columns in the list.
    * Action: Delete columns duplicated naming in the selection list.
    Error on line: column 6:17

    This error message seems pretty clear to me. What don't you understand?

    Or the other
    (a) use aliases, so each column has a unique name, or
    (b) remove the columns duplicated of the SELECT clause.

    Post your query. It is difficult to tell exactly what you're doing wrong when we do not know exactly what you are doing.
    For best results, view a complete test (including CREATE TABLE and INSERT statements) script, if necessary that people can to recreate the problem and test their ideas.
    See the FAQ forum {message identifier: = 9360002}

  • Missing previews at the catalog level and by car.  Cannot use filters at this level.  Missing files.

    With the help of LR4 (not 4.1) and Win7 Home Premium.

    Catalog has been updated to LR3 and LR4 catalog worked very well so far. I use LR since the beginning.

    Two problems, probably.  106K photos on two discs, almost 3 TB.

    He has not realized at the level of the catalog.  Normally the previews of pictures of 106K would appear. Message is "Click on the"Import"button to begin."  Filter function does not work the Message: "no photo matching the filter.

    He has not seen at the level of the road.  Message is 'No photos in the selected folder' filter does not work Message: 'no picture matching the filter.

    At the folder level, all right, but two records give the same message "No pictures in the folder selected" filter does not work in these two folders: Message: 'no photos matching the filter' 14K photos between two bad records

    Dozens, hundreds of other files and subfolders are fine. Filter function works fine at the level of folder and subfolder.

    The collections are very good, including photos in both files, which gives the message "no pictures in the folder selected.

    What I did:

    The LR4 is uninstalled and reinstalled twice.

    Download and install own LR4.

    Same problems

    Tried to import the missing files.  Don't import because they are already in the catalog.  Don't import even if I uncheck "do not import suspected duplicates."

    Exported in the form of a catalog, one of the folders 'no pictures in the folder selected.  It appeared to create a viable catalog with previews, search filters, etc..  I edited some photos with no problems.  Although it gives a message saying that extracted hundreds were missing.  But they seem to be there anyway.

    Delete the folder catalog and imported catalog catalog of working folder that I just created.

    Same problems.

    Exported as a catalogue of the different folder of "no pictures in the folder selected.  Same result as the first record of bad.  For example, it appeared to create a viable catalog with previews, search filters, etc..  Although it gives a message saying that extracted hundreds were missing.  But they seem to be there anyway.

    Does not do anything with this second folder catalog.  Intriguing, the same message on missing previews.

    Real and *.xmp files are in bad records.

    Now what?

    Discovery of a thread in this forum.  Known issues fixed in 4.1 beta.  Upgrade to LR4.1 and the problem is solved.

  • How to escape text in the query pattern to avoid the SQL Injection

    We plan to use Oracle Text to search for in a Java web application and use a query template as shown below, but are concerned about SQL Injection attacks. In general, we use a parameter query, but that does not seem possible with these search patterns. Is there advice or recommended to avoid SQL Injection when using query patterns - what characters need to be escaped or cleaned the entry user, etc? Or is there another approach to query patterns which does the same thing, but can use the settings?

    Select (1) score, my_id from my_table where CONTAINS (search_dummy,
    ' < query >
    < textquery lang 'grammar' = 'CONTEXT' = > dangerous search terms
    < progress >
    < seq > < rewriting > transform ((JETONS, "${", "}","")) < / rewrite > < / next >
    < seq > < rewriting > transform ((JETONS, "${", "}",";")) < / réécrire > / suiv >))
    < seq > < rewriting > transform ((JETONS, "${", "}", "AND")) < / rewrite > < / seq >
    < seq > < rewriting > transform ((JETONS, "${", "}", "ACCUM")) < / rewrite > < / seq >
    < / progress >
    < / textquery >
    < score datatype = "INTEGER" algorithm = "COUNT" / >
    (< / query > ', 1) > 0
    ORDER BY SCORE (1) DESC;

    Thanks in advance for any help or advice!

    You should be able to put the entire query to the CONTAINS clause argument in a variable binding. Prevent SQL injection. It is possible they could do 'contains the injection' and perform research of the else clause contains this as your intention, but unless you are relying on a part of contains the clause to implement security, that shouldn't be a problem.

  • Insert data to DB avoiding code SQL injection

    Hello

    I used the following method to insert data to DB

    (1) I had a 'DB-Helper class' and that I have the following function

    void dbHelper::createOrUpdateRecord(const QString Insertquery) {
        QSqlDatabase database = QSqlDatabase::database();
        QSqlQuery query(database);
        query.prepare(Insertquery);
    
        if (query.exec()) {
           alert(tr("Record created"));
        } else {
            const QSqlError error = query.lastError();
            alert(tr("Create record error: %1").arg(error.text()));
        }
        database.close();
    }
    

    (2) where I want to insert data to DB I created the query to insert the string and pass the string as a parameter to the function above

    createOrUpdateQuery =("INSERT INTO tutorial (title,titleArabic,shortDesc,shortDescArabic,description,descriptionArabic,externalLink,tutorialId,isActive) VALUES(\""
    + map.value("title").toString() + "\", \""
    + map.value("titleArabic").toString() + "\",\""
    + map.value("shortDesc").toString() + "\",\""
    + map.value("shortDescArabic").toString() + "\",\""
    + map.value("description").toString() + "\",\""
    + map.value("descriptionArabic").toString() + "\",\""
    + map.value("externalLink").toString() + "\",\""
    + map.value("tutorialId").toString() + "\",\""
    + map.value("isActive").toString() + "\" )");
            }
    
    dbHelp.createOrUpdateRecord(createOrUpdateQuery);
    

    I read that this method also causes Sql Injection.And using this method we can insert only string as data values.

    My question is:

    I read that the best method to insert data using "bind." So, if Iam trying to use the 'bind' method then I won't be able to make integration to db as a generic function. Is this possible. Please help me to do the insertion of data in db as a generic fn

    I didn't test this, but it might give you an idea:

    sql = "INSERT INTO tutorial (title,titleArabic,shortDesc,shortDescArabic,description,descriptionArabic,externalLink,tutorialId,isActive) "
    + "VALUES(:title, :titleArabic, :shortDesc, :shortDescArabic, :description, :descriptionArabic, :externalLink, :tutorialId, :isActive)"
    
    createOrUpdateRecord(sql, map);
    
    void dbHelper::createOrUpdateRecord(const QString Insertquery, QMap paramMap {
        QSqlDatabase database = QSqlDatabase::database();
        QSqlQuery query(database);
        query.prepare(Insertquery);
    
        QMap		   
  • IPS detects SQL Injection on HTTPS

    Hello

    Do you think Cisco IPS is able to detect the SQL Injection via HTTPS?

    "In some situations, it may be possible to detect and prevent SQL injection attacks by using a system of prevention of intrusion (IPS). For an IPS to be effective, it must have visibility into the application traffic. "For applications that use encryption end-to-end with HTTPS (for example, applications that use the HTTPS protocol without termination or of the acceleration to an intermediate network device), an IPS can not identify the traffic with the characteristics of a SQL injection attack." by:

    Understanding SQL Injection

  • OSX 10.4.11 trying to download firefox 4. Message of Suddeningly getting the saying 'impossible to use firefox on this osx' Finder use firefox forever.

    I downloaded Firefox this am. Had to leave before the end of the download. During the day, electric circuit breaker closed computer unexpecedtly. After the reboot, downloaded Firefox again, dragged icon to the applications and had 'cannot use Firefox on this OSX' Finder message have always used Firefox to the default browser. Don't know what I did. Should I uninstall Firefox and try again?

    Firefox 4 requires at least OS X 10.5. You can get the latest version of Firefox 3.6 http://www.mozilla.com/en-US/firefox/all-older.html

    Mozilla is working to keep Mac users with non-compliant systems to enter the notification on Firefox 4 and also do not display the button 'Download Firefox 4' on http://www.mozilla.com

  • Cannot use modern applications of the user interface

    I got Windows 7 Windows 8 Pro and activated. But modern user interface applications cannot use.

    This is a screenshot when I tried to open some applications, what can I do about it?

    Hello

    Please, try the fix mentioned here and see if that helps:
    Hope this helps, good luck :)
  • Avoid Evaluate in this case?


    I invoke a webservice that returns the berries of entry of Java for the ldap user information.

    To display the name of each entry, I have this code:

    < cfloop index = "i" to = "#arraylen (topOfOrg.getEntryArray () .getEntry () = '0')-1 #" >
    #directReports.getEntryArray () .getEntry (evaluate (intIndex)) .getName () < cfoutput > # < / cfoutpu t >
    < / cfloop >

    I would avoid using assess in this case? And how could I if it is an option?

    Thanks for any thoughts/ideas.

    Quote:
    Using JavaCast ("int", i) instead of evaluate (intIndex).

    Thanks MikerRoo, that worked and feels faster.

    KC

  • ORA-19838: cannot use this control file to open the database

    Dear all,

    While making RMAN cloning, we are facing problem,

    SQL > alter database open resetlogs;

    ALTER database open resetlogs

    *

    ERROR on line 1:

    ORA-19838: cannot use this control file to open the database

    Concerning

    Villi Kumar

    Dear all,

    While checking the database,

    Control the name of the database file is PROD

    In the instance, database name is TEST.

    So we took the PROD and edited control file trace file based on the TEST environment.

    Then run the script published in the TEST database trace file.

    Now we can open the database by using below command

    ALTER database open resetlogs;

    Concerning

    Villi Kumar

  • SQL injections. If I use Muse are these impossible?

    If I use Muse to design my new website is it still possible to be hack by someone using injections of SGL?

    Hello

    in case you still need to answer,

    SQL injection is majorly attacked sites when it comes to DB. Up to now, Muse generates static sites, means no interaction with the database or not dynamic content. You need to export the site in html format, then make changes in the code, if you want to include a database or any other dynamic content. Once you do this, you can try the firewalls and detection mechanisms similar intrusion that offer little defense against web attacks on a large scale.

    I hope this helps.

  • cannot be used to unlock this iPhone.

    cannot be used to unlock this iPhone.

    Yes, but to detect the iphone wasn't unlock work doesn ist so far

  • I downloaded the new version and it says: you cannot use this application with this version of Mac os how can I download the older version?

    I downloaded the new version and it says: you cannot use this application with this version of Mac os how can I download the older version? My os is 10.4.11

    You can read this article: Firefox no longer works with Mac OS X 10.4 or PowerPC processors to read about the EOL for Mac 10.4 support and what the best options going forward.

Maybe you are looking for

  • Help with the best Wifi configuration

    I'm moving into a new home that is total 3 floors (basement 1, 2 above). I currently use an airport extreme.  I don't think just the Airport extreme will be enough for the new House.  What material you think I should add to create a strong wifi netwo

  • How to solve an error IP auto assigned on my TC?

    I can't have my Time Capsule airport connectivity after the passage of the cable modems. 1 cisco DCP2008 cable modem works fine connected directly to one of my two MacBook Air. 2. I called my provider several times; They confirm my signal is fine and

  • Re: Clean up my laptop?

    Is it possible to remove all of my computer for the re - load? I bought the new Microsoft Office, but cannot load on my laptop because there is not enough space. I have deleted a large number of my programs, but I would like to know if there is a way

  • Satellite L30: Where can I download the drivers?

    I'm not able to download the device drivers for Toshiba Satellite L30Model no: PSL30L - 00M 019. Please let me know the site from where I can download the drivers.

  • Winner of Xperia Lounge

    Hello I have joined the competition in show Xperia but when finished the competition time, page of competition does not appear to this. I can't see who won the contest. How can I find out who won the contest? Thank you.