SQL Injection is rampant this week

Setting of the stage:
I am using cf error reporting to send me an email whenever
there is an exception error on my site.
I am using cfqueryparam to make sure SQL injection is not
getting through
Trouble: using cfqueryparam to catch the attack causes an
exception error whenever there is an attempted attack. So this
morning I received 211 emails from the site (and they are still
coming in) telling me "
Invalid data 4;DECLARE @S CHAR(4000);SET ...for CFSQLTYPE
CF_SQL_INTEGER.
So is there a way to catch this error and simply abort and
not send me the email? Maybe put a test in the error exception page
that checks for ";declare, ;select ;delete; insert, etc..." Or
maybe put a check in the application file to check the url
variables for the same?
I am looking for ideas from others - I am SICK of my inbox
getting jam packed with sql injection messages.
thnaks all!
Chris

If you are using cferror then there is a struct called error,
if you are using Application.cfc then in the onError() method there
is a struct called arguments.exception.
All unhandled error end up at one of these methods or
templates (depending on approach), this struct contains all the
details about the exception. You can check the type and all the
other informatuion to see what type of error it is and handle them
appropriately. If you don't want an email then don't send one.
Certainly don't put try / catches around all the cfquery tags that
is madness and wont solve it anyway. Only catch an error if there
is something you can do about it.

Similar Messages

  • SQL Injection, replace single quote with two single quotes?

    Is replacing a single quote with two single quotes adequate
    for eliminating
    SQL injection attacks? This article (
    http://www.devguru.com/features/kb/kb100206.asp
    ) offers that advice, and it
    enabled me to allow users to search name fields in the
    database that contain
    single quotes.
    I was advised to use "Paramaterized SQL" in an earlier post,
    but I can't
    understand the concept behind that method, and whether it
    applies to
    queries, writes, or both.

    Then you can use both stored procedures and prepared
    statements.
    Both provide better protection than simply replacing
    apostrophes.
    Prepared statements are simple:
    Set myCommand = Server.CreateObject("ADODB.Command")
    ...snip...
    myCommand.CommandText = "INSERT INTO Users([Name], [Email])
    VALUES (?, ?)"
    ...snip...
    myCommand.Parameters.Append
    myCommand.CreateParameter("@Name",200,1,50,Name)
    myCommand.Parameters.Append
    myCommand.CreateParameter("@Email",200,1,50,Email)
    myCommand.Execute ,,128 'the ,,128 sets execution flags that
    tell ADO not to
    look for rows to be returned. This saves the expense of
    creating a
    recordset object you don't need.
    Stored procedures are executed in a similar manner. DW can
    help you with a
    stored procedure through the "Command (Stored Procedure)"
    server behavior.
    You can see a full example of a prepared statement by looking
    at DW's
    recordset code after you've created a recordset using version
    8.02.
    "Mike Z" <[email protected]> wrote in message
    news:eo5idq$3qr$[email protected]..
    >I should have repeated this, I am using VBScript in ASP,
    with an Access DB.
    >

  • SQL Injection when using Search by Example on a View Object

    It seems that the SQL queries generated by "Search by Example" pattern (When you drop a view object as a Search Form) are not using bind parameters, and will be vulnerable to SQL injection attacks. This pattern is very handy and could be very useful to create search pages. Is there a way to avoid SQL Injection and still use this feature in ADF?
    Chandresh

    Hi,
    from a training slide developed by Duncan Mills:
    When the user is in Find mode and enters some information, he or she is constructing a ViewCriteria row. Each attribute in the View object exists in this row and any values that the user enters into the fields are mapped into these attributes.
    In most circumstances, you will only ever have one criteria row, although the developer can allow multiple rows if the Create operation is called during Find mode.
    To parse the entered query values, you need to look at each row, and then at each attribute. Calling getAttribute() returns the value the user entered (if any) for that field. You can then pass that string to a filter routine (shown in the next slide), which inspects this value for errors.
    The filter routine can then change the example value if required and reset the criteria.
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    protected String detectInjection(String criteria) {
      boolean reject = false;
      String testPattern =       "^(>=|<=|=<|=>|<|>|<>|!=|=|BETWEEN|IN|LIKE|IS)";
      String testCriteria = criteria.trim().toUpperCase();
        if (testCriteria != null && testCriteria.length() > 0) {
          Pattern pattern = Pattern.compile(testPattern);
          Matcher matcher = pattern.matcher(testCriteria);
          if (matcher.find())
            reject = true;
        return reject?null:criteria;
      }Frank

  • SQL Injection Discussion

    Hello, I have found a lot of discussion about the SQL Injection.
    Seems like it is very famous issue nowadays.
    I am currently doing some findings on the SQL injection and hopefully this thread may give some benefits to everyone.
    1. has SQLIA been resolved nowadays?
    2. where SQLIA can be launched? is it only from the front-end of the website (eg. login form) or can also attack directly the database? if can, how it can be done? How the type of attack can be determined whether i is launched form the application or anywhere else?
    3. Which is better? whether to prevent the SQLIA at the application layer or database layer?
    My focus is to prevent the SQLIA in the web application itself for example by using data validation.
    That's all for this post. Thank you so much.
    Regards, hus..

    SQL statements that use bind variables are not vulnerable to SQL injection attacks (well, not practically vulnerable). There is a small risk that if the database is unpatched someone might be able to exploit a buffer overflow in some Oracle-delivered function that your query is using but that's not a realistic threat scenario.
    There is plenty of documentation available online. For example a Google search on "bind variable" "sql injection" returns as the top result this PDF- An Introduction to SQL Injection Attacks in Oracle which discusses bind variables in some detail. In the top 5 results is this Oracle documentation on avoiding SQL injection in PL/SQL which discusses using bind variables.
    Justin

  • SQL Injection Attacks

    Any Admins aware of possible SQL "injection" attacks like this?
    For example in your web sites login.asp or similar:
    select * from users
    where uname='%value1%'
    and pwd='%value2%'
    where %value1% equals "garbage"
    and %value2% equals "garbage' or TRUE or '"
    select * from users
    where uname='garbage'
    and pwd='garbage' or TRUE or ''
    Useful source of security info:
    http://www.nextgenss.com/news.html
    Get Oracle Security Patches:
    http://otn.oracle.com/deploy/security/alerts.htm
    Adeeva.

    There was an excellent presentation on this and other database attacks at the recent SEOUC conference in Charlotte. You can see the slides by going to http://www.seouc.org. Select "Presentation Abstracts" from the menu and then choose the keynote address. There were a lot of open jaws in the presentation room.
    One technique that we use is to package all SQL used in our websites using bind variables. So the login script you showed would be replaced by a packaged procedure something like this:
    PROCEDURE validate_logon (id_in appusers.id%TYPE, pw_in appusers.password%TYPE)
    RETURN INTEGER
    IS
    x INTEGER;
    sqlstr := 'select count(*) from appusers where id = :1 and password = :2';
    BEGIN
    EXECUTE IMMEDIATE sqlstr INTO x USING id_in, pw_in;
    RETURN x;
    END;
    This would return a positive integer (should always be 1) if the validation succeeds and 0 if it fails. They can't easily inject stuff into this. We used packaged dynamic SQL with bind variables for everything. Also, the account that logs onto the database never has access of any kind to the tables or views, only EXECUTE on the procedures.
    Nothing is foolproof but at least it makes it harder for them.

  • Preventing SQL injection - can't use cfqueryparam in this case

    Hello. I have a form with a checkbox next to each row.  If the user checks some boxes, then clicks the "Delete" button, I want to execute the following query, but I want to protect it from sql injection attacks:
        <cfquery datasource="#application.mainDS#">
            delete 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 converting the varchar value '7,21' to data type int" (7 and 21 are the messageID's to be deleted).  Obviously the comma prevents conversion to an integer.
    If I use cfsqltype="cf_sql_integer", then the string gets converted to a single integer (in this case 40015, which is nonsense).
    I tried passing form.messageID to a stored procedure, but I seemed to have the same problem there.  I could run the query in a loop where I just delete one row at a time, but I'd like to run just one query if I can do it safely.  Any ideas?
    Thanks.
    PK

    I agree that you should not do an SQL "DELETE" from a web page.  Instead, use "soft deletes," where you contrive for there to be a deleted_flag (boolean), and maybe deleted_by (varchar) and deleted_timestamp.  Then create an SQL "VIEW" which automagically omits the "deleted" records.
    It is also a very good idea to refer to the records using a nonsensical, made-up "moniker" instead of actual record-IDs.  You see, "if I am a nasty person and I know that there is a record #123456, then I'll bet I know the record-IDs of 123,455 other records, too."  But if you refer to the record as "QZB0E9S" and the next record-id in the list is "4Q_9RJPEM2" then it won't take me long to realize that I can't get too far, not even by brute-force.  (And if I see that the record-IDs seem to have verification tags, like "QZB0E9S:4E396", then I know that I am really scroo'd in my hacking-attempt because even if I did somehow million-monkeys my way into a valid record-ID, I've got no earthly idea how to come up with the tag.
    It pays to code defensively, like this.  And it doesn't really take more time.  Without question, always use <cfqueryparam> !!

  • Trouble with sql dates getting Monday of this week

    Hi
    How do I get the Monday of this week. I am using:
    <code>next_day(trunc(sysdate,'DAY'),'Monday')</code>
    but get the coming Monday. Initially this code was working before apex was upgraded from 3.0 to 3.1.
    Why would this stop working.
    But if I was to use
    <code>next_day(trunc(sysdate,'DAY'-7),'Monday')</code>
    thanks
    Tony

    Hi Scott
    thats what I thought but I was not getting the present week's Monday. I am trying to get the Sunday and Monday of the present week so have had to put a
    -7 next to the sysdate.
    The Application I have been using was running in but when there was an upgrade to apex 3.1 then the returned dates have not been correct.
    thanks
    Tony

  • SQL Injection Blocker

    Hello all-
    I've got a server with a huge number of ColdFusion templates
    (over 10,000) which I really need to protect agains SQL Injection.
    I know that CFQUERYPARAM is the best way to do this. I'd love
    to do it that way, but with so many pages, and so many queries it
    would take weeks/months to fix the queries, then test to make sure
    I didn't screw something up.
    So, I've come up with a plan that I wanted to get some input
    on.
    Currently, I have a page on my server that is included in
    almost every page that runs. It is a simple page that I can modify
    to change the status of my systems in the event of a database
    changeover, or some other sort of failure. (The pages still run,
    but no updating is allowed, only reading)
    Okay, so on this page which is always included, I was
    thinking about analyzing the variables that come over. I was
    thinking about looking for things that looked like a SQL injection
    attack and blocking the page from running.
    I wanted to know if this would work- anyone have ideas? This
    would be great because I could protect the entire server in about
    an hour. But, I don't want to give myself a false sense of security
    if this won't really do the job.

    First, here are some simple things you can do to protect all
    pages before you follow the other advice and plans in this thread:
    In CF administrator, click on your datasources and then the
    "Advanced" button.
    There you will uncheck all but the read and stored procedure
    and (possibly) write permissions. "Drop", "Create", etc., are
    definite no-nos here.
    If you haven't already, make one data source read-permissions
    only and refactor your code to use it everywhere except for
    carefully segregated updates, inserts and deletes.
    Now, in SQL Server itself, remove all permissions from the
    users that CF uses except for data_reader and (selectively) data
    writer and exec permissions on any procedures or functions you use.
    In SQL server, setup at least two CF users. One, should have
    only the data_reader permission (plus any read-only stored
    procedures).
    Find articles, such as this one:
    http://www.sqlservercentral.com/columnists/bknight/10securingyoursqlserver.asp,
    and follow their advice, start with locking down xp_cmdshell.
    These measures require little or no CF code changes but will
    block all but the most determined and skilled hackers. You still
    need to follow Adam's advice though.
    BTW, Dan is very wrong, ALL DB's are vulnerable to SQL
    injection.
    SQL server is not even the most vulnerable anymore (Studies
    show that Oracle now has that "honor").

  • SQL Injection on CallableStatement

    I will try to post this all in one line, as the tags are not working today. I know that one should use PreparedStatement over Statement to obviate the thread of a SQL injection attack. Is CallableStatement vulnerable as well? For reference, this would be running against an Oracle RDBMS. Thanks!
    - Saish

    I guess there is no hard-and-fast rule.Well, I guess the hard and fast rule is "only use
    bound variables". If you've got a sane database
    design then that shouldn't cause you any problems.
    Dave.I agree. I was approaching the issue mainly from a security perspective in locking down a legacy system against SQL injection attacks. Using Eclipse, I was able to zero-in on usages of Statement fairly easily. But the more I looked into CallableStatement, the more I realized that I woud have to inspect each invocation manually. (Just in case someone did not bind variables or built a dynamic SQL string).
    - Saish

  • SQL Injection and variable substitutions

    Hello helpful forum, I'm trying to understand what really goes on "behind" the scenes
    with the variable substitutions in order to protect from sql injections.
    I'm using apex 3.0.0.00.20
    The trickiest component seems to be a Report of type "pl/sql returning sql", since
    multiple dynamic sql interpretations are done there.
    consider the following innocent looking disaster:
    DECLARE
    l_out VARCHAR2(2000);
    BEGIN
    l_out := 'select * from test_injection t where t.name like ''%' || :NAME || '%''';
    RETURN l_out;
    END;
    if NAME is a single quote the report will return:
    failed to parse SQL query: ORA-00911: invalid character
    which hints to the fact that NAME is not escaped, and you are in fact able to access db functions
    as in: '||lower('S')||'
    I also tried to put there a function that runs in a autonomous transaction to log its calls, and
    I see that it's called five times for each request.
    consider now the similar solution (notice the two single quotes):
    DECLARE
    l_out VARCHAR2(2000);
    BEGIN
    l_out := 'select * from test_injection t where t.name like ''%'' || :NAME || ''%''';
    RETURN l_out;
    END;
    with this second example nothing of the above is possible.
    So my theory (please confirm it or refute it) is that there is a first variable substitution done
    at the pl/sql level (and in the second case :NAME is just a string so nothing is substituted).
    Then the dynamic sql is executed and it returns the following string:
    select * from test_injection t where t.name like '%' || :NAME || '%'
    now another substitution is done (at an "APEX" level) and then query is finally executed to return
    the rows to the report.
    The tricky point seems to be that the first substitution doesn't escape the variable (hence the error
    with the single quote), while the second substitution does.
    Please let me know if this makes sense and what are the proper guidelines to avoid sql injection with
    the different kinds of reports and components (SQL, pl/sql returning sql, processes, ...)
    Thanks

    Giovanni,
    You should build report regions like this using the second method so that all bind variables (colon followed by name) appear in the resultant varchar2 variable, l_out in your example, which will then be parsed as the report query. This addresses not only the SQL injection problem but the shared-pool friendliness problem.
    Scott

  • Sql injection

    What is SQL Injection?
    SQL Injection is a way to attack the data in a database through a firewall protecting it. It is a method by which the parameters of a Web-based application are modified in order to change the SQL statements that are passed to a database to return data. For example, by adding a single quote (‘) to the parameters, it is possible to cause a second query to be executed with the first.
    An attack against a database using SQL Injection could be motivated by two primary objectives:
    1. To steal data from a database from which the data should not normally be available, or to obtain system configuration data that would allow an attack profile to be built. One example of the latter would be obtaining all of the database password hashes so that passwords can be brute-forced.
    2. To gain access to an organisation’s host computers via the machine hosting the database. This can be done using package procedures and 3GL language extensions that allow O/S access.
    There are many ways to use this technique on an Oracle system. This depends upon the language used or the API. The following are some languages, APIs and tools that can access an Oracle database and be part of a Web-based application.
    * JSP
    * ASP
    * XML, XSL and XSQL
    * Javascript
    * VB, MFC, and other ODBC-based tools and APIs
    * Portal, the older WebDB, and other Oracle Web-based applications and API’s
    * Reports, discoverer, Oracle Applications
    * 3- and 4GL-based languages such as C, OCI, Pro*C, and COBOL
    * Perl and CGI scripts that access Oracle databases
    * many more.
    Any of the above applications, tools, and products could be used as a base from which to SQL inject an Oracle database. A few simple preconditions need to be in place first though. First and foremost amongst these is that dynamic SQL must be used in the application, tool, or product, otherwise SQL Injection is not possible.
    The final important point not usually mentioned in discussions about SQL injection against any database including Oracle is that SQL injection is not just a Web-based problem. As is implied in the preceding paragraph, any application that allows a user to enter data that may eventually end up being executed as a piece of dynamic SQL can potentially be SQL injected. Of course, Web-based applications present the greatest risk, as anyone with a browser and an Internet connection can potentially access data they should not.
    While second article of this series will include a much more in-depth discussion of how to protect against SQL injection attacks, there are a couple of brief notes that should be mentioned in this introductory section. Data held in Oracle databases should be protected from employees and others who have network access to applications that maintain that data. Those employees could be malicious or may simply want to read data they are not authorized to read. Readers should keep in mind that most threats to data held within databases come from authorized users.
    Protecting against SQL Injection on Oracle-based systems is simple in principle and includes two basic stages. These are:
    1. Audit the application code and change or remove the problems that allow injection to take place. (These problems will be discussed at greater length in the second part of this series.)
    2. Enforce the principle of least privilege at the database level so that even if someone is able to SQL inject an application to steal data, they cannot see anymore data than the designer intended through any normal application interface.
    The “Protection” section, which will be included in the second part of this series, will discuss details of how to apply some of these ideas specifically to Oracle-based applications.
    [http://www.securityfocus.com/infocus/1644]
    how oracle prevent sql injections?

    mango_boy wrote:
    damorgan wrote:
    And they do so using bind variables
    http://www.morganslibrary.org/reference/bindvars.html
    and DBMS_ASSERT
    http://www.morganslibrary.org/reference/dbms_assert.html
    do you have any suggestion for mysql users??Yes. Install Oracle.

  • SQL injection protection help

    In trying to help another user, I was reminded of a problem I
    face
    often. Trying to create a DW recordset using an IN clause (I
    think this
    got broken in the 8.0.2 update and seems to still be broken
    in CS3).
    I create a string held in a variable like this:
    $ids = (1,5,9,23,6)
    My advanced recordset is this:
    SELECT * FROM tbl WHERE id IN varIds
    Then I set the variable parameters to type=text,
    default=(-1), and
    runtime to $ids.
    The generated SQL doesn;t work because DW puts single quotes
    around my
    variable and the SQL query becomes invalid. DW creates this:
    SELECT * FROM tbl WHERE id IN '(1,5,9,23,6)'
    It should be:
    SELECT * FROM tbl WHERE id IN (1,5,9,23,6)
    So, I edited the SWITCH block at the top of the document to
    include a
    "custom" type, which is the same as the TEXT type but without
    the single
    quotes.
    case "custom":
    $theValue = ($theValue != "") ? $theValue : "NULL";
    break;
    Then in my SQL statement, I manually changed "text" to
    "custom".
    This work fine, but does that open me up to SQL injection or
    other bad
    stuff?
    Alec Fehl, MCSE, A+, ACE, ACI
    Adobe Community Expert
    AUTHOR:
    Microsoft Office 2007 PowerPoint: Comprehensive Course
    (Labyrinth
    Publications)
    Welcome to Web Design and HTML (Labyrinth Publications)
    CO-AUTHOR:
    Microsoft Office 2007: Essentials (Labyrinth Publications)
    Computer Concepts and Vista (Labyrinth Publications)
    Mike Meyers' A+ Guide to Managing and Troubleshooting PCs
    (McGraw-Hill)
    Internet Systems and Applications (EMC Paradigm)

    It looks like you're using PHP ... to protect from SQL
    injections I always
    do this:
    $query = "SELECT * FROM tbl WHERE col='%s' AND col2 IN
    (%d,%d)"
    $query = sprintf($query,"val",34,23);
    $result = mysql_query($query);
    This method ensures that if a user puts "DELETE FROM tbl" in
    an input
    field, it will not cause any deletions, instead the words
    'DELETE FROM tbl'
    will be inserted. Check out sprintf in the PHP manual - good
    stuff!
    One thing to remember about SQL injection, the injected SQL
    has to be
    entered somehow by the end-user (usually with a form); I may
    be wrong, but
    this sql statement looks like it is contained entirely within
    your scripts
    (i.e. it isn't getting getting a user-generated value to
    build any part of
    the SQL statement). Again, I'm guessing here - but it looks
    that way.
    Alex
    "Alec Fehl" <[email protected]> wrote in message
    news:[email protected]...
    > In trying to help another user, I was reminded of a
    problem I face often.
    > Trying to create a DW recordset using an IN clause (I
    think this got
    > broken in the 8.0.2 update and seems to still be broken
    in CS3).
    >
    > I create a string held in a variable like this:
    > $ids = (1,5,9,23,6)
    >
    > My advanced recordset is this:
    >
    > SELECT * FROM tbl WHERE id IN varIds
    >
    > Then I set the variable parameters to type=text,
    default=(-1), and runtime
    > to $ids.
    >
    > The generated SQL doesn;t work because DW puts single
    quotes around my
    > variable and the SQL query becomes invalid. DW creates
    this:
    >
    > SELECT * FROM tbl WHERE id IN '(1,5,9,23,6)'
    >
    > It should be:
    >
    > SELECT * FROM tbl WHERE id IN (1,5,9,23,6)
    >
    > So, I edited the SWITCH block at the top of the document
    to include a
    > "custom" type, which is the same as the TEXT type but
    without the single
    > quotes.
    > case "custom":
    > $theValue = ($theValue != "") ? $theValue : "NULL";
    > break;
    > Then in my SQL statement, I manually changed "text" to
    "custom".
    >
    > This work fine, but does that open me up to SQL
    injection or other bad
    > stuff?
    >
    >
    > --
    > Alec Fehl, MCSE, A+, ACE, ACI
    > Adobe Community Expert
    >
    > AUTHOR:
    > Microsoft Office 2007 PowerPoint: Comprehensive Course
    (Labyrinth
    > Publications)
    > Welcome to Web Design and HTML (Labyrinth Publications)
    >
    > CO-AUTHOR:
    > Microsoft Office 2007: Essentials (Labyrinth
    Publications)
    > Computer Concepts and Vista (Labyrinth Publications)
    > Mike Meyers' A+ Guide to Managing and Troubleshooting
    PCs (McGraw-Hill)
    > Internet Systems and Applications (EMC Paradigm)

  • SQL injection hacking

    Hello all,
    Someone is telling me that a site of mine is vulnerable to a
    hacking
    technique called "SQL injection". They cited a URL such as
    http://www.mydomain.com/gallery.cfm?VarCatID=29
    as an example.
    I Googled SQL injection, and found a lot of information,
    which I'm in the
    midst of reading.
    What I really want to know is, how serious a risk is this?
    Should I be
    taking action, and if so, what?
    Aren't there millions of sites that use that type of URL
    string?? Are they
    all unsafe too?
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet

    Thank you, Tom!
    Patty Ayers | www.WebDevBiz.com
    Free Articles on the Business of Web Development
    Web Design Contract, Estimate Request Form, Estimate
    Worksheet
    "Tom Muck" <[email protected]> wrote in
    message
    news:ecuu0f$dbn$[email protected]..
    > If you are passing an integer on a querystring, make
    sure you validate
    > that an integer is being passed, either by using a
    cfparm, cfqueryparam,
    > or by using the val() function on the passed querystring
    variable:
    >
    > <cfquery name="blah" datasource="#mydsn#">
    > SELECT * FROM mytable WHERE catid =
    > <cfqueryparam cfsqltype="cf_sql_integer"
    value="#url.VarCatID#">
    > </cfquery>
    >
    > The DW 8.0.2 update changed the way that DW does this so
    injection is no
    > longer a concern.
    >
    > --
    > --
    > Tom Muck
    > co-author Dreamweaver MX 2004: The Complete Reference
    >
    http://www.tom-muck.com/
    >
    > Cartweaver Development Team
    >
    http://www.cartweaver.com
    >
    > Extending Knowledge Daily
    >
    http://www.communitymx.com/
    >
    >
    > "P@tty Ayers"
    <[email protected]> wrote in message
    > news:ecut8j$cg6$[email protected]..
    >> Hello all,
    >>
    >> Someone is telling me that a site of mine is
    vulnerable to a hacking
    >> technique called "SQL injection". They cited a URL
    such as
    >>
    http://www.mydomain.com/gallery.cfm?VarCatID=29
    as an example.
    >>
    >> I Googled SQL injection, and found a lot of
    information, which I'm in the
    >> midst of reading.
    >>
    >> What I really want to know is, how serious a risk is
    this? Should I be
    >> taking action, and if so, what?
    >>
    >> Aren't there millions of sites that use that type of
    URL string?? Are
    >> they all unsafe too?
    >>
    >>
    >> --
    >> Patty Ayers | www.WebDevBiz.com
    >> Free Articles on the Business of Web Development
    >> Web Design Contract, Estimate Request Form, Estimate
    Worksheet
    >> --
    >>
    >>
    >>
    >>
    >
    >

  • SQL Injection concerns

    I have been studying sql injection attacks and the
    mysql_real_escape function.
    I read the adobe technote about sql injection and it noted
    that Dreamweaver 8.0 incorporates anti-sql injection code to
    prevent attacks and it specifically refers to Add, Delete, and
    Update; Filtered Recordsets, and Login User server behaviors. Can
    anyone please confirm this to put my mind at ease?
    The Search form and results page uses a filtered recordset,
    so can I presume that it is guarded from attack?
    Can you tell me of any areas that I need to add anti-sql
    injection code myself?
    Thank you so much for your help!

    EviePhillips wrote:
    > The code on this second page (the one where the form
    posts to) ECHOs the form
    > variables. Do I need to enter the
    mysql_real_escape_string around each of the
    > ECHOed posted form variables?
    No, mysql_real_escape_string() is used only when inserting
    user input
    values into a database. You cannot use it without a database
    connection.
    However, you should pass the values to htmlentitities()
    before
    displaying them in your page. You can do this by accessing
    the Format
    menu in the Dynamic Text dialog box. After using the Bindings
    panel to
    insert the value, switch to the Server Behaviors panel, and
    double-click
    the Dynamic Text entry to open the dialog box.
    > I am then going to use the ADD Record server behavior to
    add the data to my
    > database from this page, which based on your counsel is
    fully protected from
    > sql injection.
    >
    > You are very kind for sharing your knowledge!
    > EP
    >
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS4",
    "PHP Solutions" & "PHP Object-Oriented Solutions"
    http://foundationphp.com/

  • SQL Injection & CF code Attacks

    One thing I've noticed with sites using CF is that many, many
    programmers do not take into account SQL Injection and CF Form/URL
    variable attacks. I've seen SO many CF pages that blow up when the
    input varies in the slightest, displaying CF error messages,
    datasources, variable names, etc.
    Seems not enough programmers use CFTRY/CFCATCH or even know
    about it. I've seen where SQL table names and datasources were
    being passed in a URL!! It's frightening
    Interested in everyone's BEST PRACTICES to avoid these type
    of attacks.
    I'll start it off with a few I use:
    Use CFTRY / CFCATCH.
    ALWAYS set the maxlength value on form input text boxes and
    make sure the value matches the corresponding column length in your
    DB. If you do not, someone can enter a huge amount of data in the
    field, causing your CF routine or DB to choke.
    Scope all variables, URL, Form, etc.
    Use numbers/integers whenever possible for URL variable
    values.
    Avoid using varchar as the data type in your stored
    procedures for passed URL or Form variables. Use INT instead.
    Validate user input using CF before passing to your SQL, etc.
    queries. Test for allowed/disallowed characters, blanks, length of
    input value, etc.
    Use stored procedures whenever possible.
    Don't make URL or Form variable names too descriptive. ex.
    ?m=100 is better than ?memberID=100

    In addition to the things listed above, you should never
    expect the values sent from any form submission to be 100% as they
    are coded. There are tons of programs out there that can be used to
    intercept and alter the submitted data before it hits your server.
    It is a slow process, but we are locking down any and all form
    variables not just type="text" and textarea's.
    If a user has the ability to alter submitted data, they can
    change the values for all types of form fields (hidden, radio,
    checkbox, select, button, etc...). A lot of our old code did not
    take that into consideration and simply allowed the value entered
    from a "predefind" (hard coded value) form type (radio, checkbox,
    etc...) directly into the database without a check.
    Another step is to turn off "Enable Robust Exception
    Information" in the CF Administrator. This step will help in not
    giving an attacker the complete SQL statement being used in your
    code. Note: This is a recomended practice for all production CF
    servers as it is, but it never hurts to say it. CFTRY/CFCATCH
    blocks work as well to hid that info, but neither way will
    prevent an attack.
    You also can not rely on client side JavaScript for
    validation.
    CR

Maybe you are looking for

  • Blog summary widget problem

    I am getting reports that some users cannot load my iWeb '08 site. I have looked into it and not everyone is affected the same. In safari it's fine but in firefox on a mac it only loads a partial page with a js error. On a windows pc it's a crap-shoo

  • Databae closing issue in OIM

    Hi, Whenever we create any database transaction OIM cusom code like select, update etc... Do we need to explicitly close the database connection? If so then how can we close the connection in code? Thanks!!

  • Will you accept the challenge?

    Here is a little thing that have been making me get a pain in my back since last week, you know, all day long settle down studying, searching for a solution... I finally made it as simple as possible, now all I need is a way to unload the component,

  • JButton - set down state (toggle like behaviour)?

    I'm sure this has been asked and answered.. as well as being something simple.. yet I can't find out how to set the state of a JButton to down. As in when you click a JButton and hold down the mouse, it's in a pressed down state, I'd like to preserve

  • [SOLVED] Uzbl weird characters

    When viewing some pages in uzbl, such as Youtube, I am getting a cryptic character instead of what is supposed to be there. IIRC it means that the character it is trying to load doesn't exist in the current character map, correct? How can I fix this?