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

Security: allow removing characters above U+FFFF in RequestFactory #28

Open
JanTvrdik opened this issue Dec 5, 2014 · 3 comments
Open
Milestone

Comments

@JanTvrdik
Copy link
Contributor

MySQL's utf8 encoding does not support characters above U+FFFF. Using utf8 encoding and not removing characters above U+FFFF can be used to bypass input validation. You can for example use this to bypass minimum length requirement for thread title on Nette forum. See excellent presentation Hacking with Unicode for more practical examples.

Applications must either use utf8mb4 encoding (which supports full UTF-8) or remove all characters above U+FFFF. I think that Nette should support both approaches.

We should certainly allow removing characters above U+FFFF in RequestFactory and either make it default or change default encoding in Nette\Database to utf8mb4.


Note: utf8mb4 encoding is available since MySQL 5.5.3 (2010-03-24)

@JanTvrdik
Copy link
Contributor Author

@dg Any thoughts? What would you recommend to people who use Nette?

@dg
Copy link
Member

dg commented Jan 10, 2015

utf8mb4 enabled, thx for suggestion nette/database@7988663

@dg
Copy link
Member

dg commented Jan 10, 2015

strict nonstrict note
names utf8, table utf8 error 1366 truncates string for all < 5.5.3 users
names utf8mb4, table utf8 error 1366 replaces with ? for nearly all >= 5.5.3 users
names utf8, table utf8mb4 error 1366 replaces with ???? fixed by nette/database@7988663

To remove characters on input is like magic quotes. It sould be solved on Database level, invalid character can be optionally converted to '?'.

@dg dg added this to the v2.4 milestone Feb 17, 2015
@dg dg modified the milestones: v3.0, v4.0 Feb 28, 2019
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

No branches or pull requests

2 participants