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

SQL Injection #52

Open
mikemda opened this issue Dec 15, 2016 · 0 comments
Open

SQL Injection #52

mikemda opened this issue Dec 15, 2016 · 0 comments

Comments

@mikemda
Copy link

mikemda commented Dec 15, 2016

Hi,

Recently I was reviewing some code that contained an SQL injection vulnerability which I believe to originate from the use of alphabetical_paginate .

the code they used looked like
@users, @sorting_params = @users.alpha_paginate(
params[:startletter],
ALPHABETICAL_PAGINATE_CONFIG,
&:name
)

The injection was happening via
http://somesite.com/users?startletter=G

By passing
G' or 1='1
as the value of startletter it was possible to return all objects.

I think the fix should be to only take the first character, rather than the full string.

Feel free to contact me if you require further information.

Kind Regards
Mike

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

1 participant