Django Raw Query SQL injection display attack

风格不统一 提交于 2019-12-12 02:33:10

问题


I am trying to write a website with Django that could display SQL injection for classroom purposes.However when i try to exploit the query nothing is getting returned. I am using a MYSQL database

peopledata = people.objects.raw("select * from people where name = \"%s\" "%input
result = list(peopledata)

I tried using "; show tables; -- and "; --, in the input field and nothing showed up. Is there a way to display the exploited data?


回答1:


Your input should be any_name OR'x'='x' or any_name OR name IS NOT NULL

The first input would guarantee the clause to be true no matter what the first clause is.

The second query will then return every record in the database, instead of returning the name you searched for. This is demonstrates a big security risk. If the data being returned is confidential (id SSN) the user has now received access to data he/she should not be viewing.

Another example would be:

any_name; DROP TABLE people; --

And:

any_name; INSERT INTO people('email','passwd','login_id','full_name') 
        VALUES ('steve@email.com','hello','steve','Steve LastName'); --

NOTE: Apply these queries appropriately to your DB. Using single/double quotes when necessary etc.



来源:https://stackoverflow.com/questions/17113712/django-raw-query-sql-injection-display-attack

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!