Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Shall we change rule 1000 regex's ? #337

Closed
buixor opened this issue Dec 22, 2016 · 7 comments
Closed

Shall we change rule 1000 regex's ? #337

buixor opened this issue Dec 22, 2016 · 7 comments

Comments

@buixor
Copy link
Contributor

buixor commented Dec 22, 2016

hello,

to limit the amount of false positive on core rule 1000 :

MainRule "rx:select|union|update|delete|insert|table|from|ascii|hex|unhex|drop" "msg:sql keywords" "mz:BODY|URL|ARGS|$HEADERS_VAR:Cookie" "s:$SQL:4" id:1000;

Shall we change the regex to something like :

[^\w]*(select|union|update|delete|insert|table|from|ascii|hex|unhex|drop)[^\w]*

It will greatly reduce false positives on words such as "selection" etc. but it might be bypass-prone ?

@C0nw0nk
Copy link

C0nw0nk commented Dec 22, 2016

If you look here at the types of MySQL exploits found in web apps.
https://www.exploit-db.com/webapps/

Example :

(select+1+from+(select+count(*),+concat((select+(select+concat(

I think there is allot of variations of methods they can use to try and bypass it spacing between words etc.

I also think its a rule that would need testing for the best outcome as a core rule before being changed.

As the original rule currently sits it is blocking very well and users can insert this. BasicRule wl:1000; #Disable rule to disable it on locations / areas of their sites they do not require it.

I am also curious about this rule with libsql enabled.

LibInjectionSql;
CheckRule "$LIBINJECTION_SQL >= 8" BLOCK;

Its not necessary for those who enable libsql?

@jvoisin
Copy link
Contributor

jvoisin commented Dec 22, 2016

The modified rule 1000 will still match, since ( and + aren't words.

@buixor
Copy link
Contributor Author

buixor commented Dec 22, 2016

According to debuggex, the rule shall match, \w matches any word character (equal to [a-zA-Z0-9_])

@ghost
Copy link

ghost commented Feb 7, 2017

Seems like a great improvement, this rule matches a lot of data usually.
Thanks

@buixor
Copy link
Contributor Author

buixor commented Feb 17, 2017

Yes, I'm thinking of at least adding the new rule in 0.56, and we'll see later if we can safely remove the "old" one :)

@Annihil
Copy link
Contributor

Annihil commented Apr 20, 2017

\b(select|union|update|delete|insert|table|from|ascii|hex|unhex|drop)\b
works better for me,
it matches select+from but not selected+fromage,
which is what we want I think 😃

@jvoisin
Copy link
Contributor

jvoisin commented Apr 21, 2017

Good old selected fromage <3

maddingue added a commit to oscaro/naxsi that referenced this issue Sep 25, 2020
maddingue added a commit to oscaro/naxsi that referenced this issue Sep 25, 2020
maddingue added a commit to oscaro/naxsi that referenced this issue Sep 28, 2020
maddingue added a commit to oscaro/naxsi that referenced this issue Oct 9, 2020
@mremande mremande closed this as completed Nov 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants