c# - Create command thowrs ORA-01036: illegal variable name/number exception -


i working on fixing sql injection flaw reported tool. our application reading oracle queries xml. query shown below...

<commandtext>create user &amp;username identified externally</commandtext> 

in program, query was modified follows...

create user user_05 identified externally 

i asked add parameter statements avoid sql injection. did similar thing shown below...

oraclecommand command = connection.createcommand(); command.commandtext = "create user :username identified externally"; string attrname = "username"; string valuetobeput = "user_05"; command.parameters.add(new oracleparameter(attrname, valuetobeput)); command.executenonquery(); 

and when tried execute query. failing following exception:

{"ora-01036: illegal variable name/number"} 

can me on this. might doing wrong here?

thanks.

to prevent exploiting code, should check if entered values save. oracle provides dbms_assert package you.

what create stored procedure accepts username argument. stored procedure create database user you. stored procedure verify argument if there no sql injection using

dbms_assert.qualified_sql_name (); 

your code bind input calling stored procedure.

check out dbms_assert package http://docs.oracle.com/database/121/arpls/d_assert.htm#arpls65375

what don't understand why want create users on fly...


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -