Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unmagicquotes: add ref + discussion #4632

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

noraj
Copy link

@noraj noraj commented Apr 6, 2021

  1. I added this ref that it explains the vulnerability better than the original

  2. Should we add dependency on the DBMS MySQL since I saw only paper talking about this behavior in MySQL? Should we add another dependency on the char encoding because it is documented to work with Big5, GBK, and SJIS and others but not UTF-8 for example.

  3. As the condition is written only the 1st single quote is replaced and not all occurrences, this modification to the code would allow to replace all single quotes:

-if payload[i] == '\'' and not found:
+if payload[i] == '\'':

With and without the modification:

1982347827 AND SUBSTR((SELECT HEX(COALESCE(CAST(COUNT(tbl_name) AS TEXT),CAST(X%bf%27 AS TEXT))) FROM sqlite_master WHERE type=CAST(X%bf%277461626c65%bf%27 AS TEXT)),1,1)>CAST(X%bf%2701%bf%27 AS TEXT)-- -

1982347827 AND SUBSTR((SELECT HEX(COALESCE(CAST(COUNT(tbl_name) AS TEXT),CAST(X%bf%27 AS TEXT))) FROM sqlite_master WHERE type=CAST(X'7461626c65' AS TEXT)),1,1)>CAST(X'01' AS TEXT)-- -

Or is it on purpose that only the 1st occurrence is replaced? Because I never read something about that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant