client9 / libinjection

SQL / SQLI tokenizer parser analyzer
Other
1k stars 274 forks source link

Nested comments #24

Closed Kanatoko closed 11 years ago

Kanatoko commented 11 years ago

select 1 where 2=1/* // / */ or 1=1--;

is valid on PostgreSQL(8.3.5) and MS SQL Server(2012).

Currently '1/* // / */ or 1=1--' is not treated as SQLi. How should we do?

client9 commented 11 years ago

Wow.

notice if you add a space

'1/* // / / or 1=1-' not detected '1/ /* / / / or 1=1-' detected

it is detected. There is logic that if a nested comment is detected, it just assumes it's SQLi (the 'X' token type).

You'll see in the code something like

if '/' then find '/' then look for '/' ---between-- / and */ (nested comment)

It needs to change to

then look for '/' between / and ending '/'

then it should work!

Just added a unit test$B!D(B http://jenkins.client9.com/job/libinjection-build/125/console

On 2013/04/27, at 13:54, Kanatoko notifications@github.com wrote:

select 1 where 2=1/* // / */ or 1=1--;

is valid on PostgreSQL(8.3.5) and MS SQL Server(2012).

Currently '1/* // / */ or 1=1--' is not treated as SQLi. How should we do?

$B!=(B Reply to this email directly or view it on GitHub.

client9 commented 11 years ago

^^ reply by email doesn't look very nice :-(

should be fixed: https://github.com/client9/libinjection/commit/2acb95ebfedd39eb049f01b3470e747f0b8e3a01

however, I think we should try more tests.

nickg

Kanatoko commented 11 years ago

Yes, I noticed this issue when I implemented 'X' token type.