I have a DB using windows-1252 character encoding and dynamic SQL that does simple single quote escaping like this...

l_str := REPLACE(TRIM(someUserInput),'''','''''');

Because the DB is windows-1252 when the notorious Unicode Character 'MODIFIER LETTER APOSTROPHE' (U+02BC) is sent it gets converted.

Example: The front end app submits this...


But ends up searching on this...

and someColumn like '%TESTʼEND%'

What I want to know is, since the ʼ was converted into ʼ (which luckily is safe just yields wrong search results) is there any scenario where a non-windows-1252 characters can be converted into something that WILL break this thus making SQL injection possible?

I know about bind variables, I know the DB should be unicode as well, that's not what I'm asking here. I am needing proof that what you see above is not safe. I have searched for days and cannot find a way to cause SQL injection when doing simple single quote escaping like this when the DB is windows-1252. Thanks!

Oh, and always assuming the column being search is a varchar, not number. I am aware of the issues and how things change when dealing with numbers. So assume this is always the case:

l_str := REPLACE(TRIM(someUserInput),'''','''''');
... and someVarcharColumn like '%'||l_str||'%'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.