Kali Linux渗透测试之SQLmap自动注入(一)——Target

本文介绍了SQLmap,一款强大的开源SQL注入工具,详细讲解了其功能,包括基于不同技术的漏洞检测、支持的数据库管理系统、与其他工具的集成,以及在Kali Linux中的安装和使用。特别强调了SQLmap的自动注入功能,如目标检测、数据库枚举和操作系统命令执行等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1. SQLmap工具简介

  • SQLmap是一款开源的SQL注入漏洞检测、利用工具;
  • 可以检测动态页面中get/post参数、cookie、http头;
  • 它由Python语言开发而成,运行需要安装python环境;
  • 在kali中已经集成,其功能完善,适用几乎所有数据库,可自动进行数据榨取;
  • 可以获取数据库指纹信息、访问底层文件系统、执行操作系统命令;
  • 也可以做XSS漏洞检测;

注意:sqlmap是用来检测和利用sql注入点的,并不能扫描出网站有哪些漏洞,所以使用前先找出sql注入点。

2. SQLmap基于五种漏洞检测技术

(注:无论哪种检测,都是为了证明目标存在SQL注入漏洞)

1、基于布尔的盲注检测;

2、基于时间的盲注检测;

      'and (select*from (select(sleep(20)))a)--+

3、基于错误的检测;

4、基于UNION联合查询的检测;

      适用于通过循环直接输出联合查询结果,否则只显示第一项结果

5、基于堆叠查询的检测;

     通过分号(;)堆叠多个查询语句

     适用于非select的数据修改、删除的操作

3. SQLmap支持的数据库管理系统DBMS

MySQL、Oracle、PostgreSQL、Microsoft SQL Server, Microsoft Access,IBM DB2, SQLite,Firebird, Sybase , SAP MaxDB

4. SQLmap的其他特性

1、数据库直接连接 -d    【客户端直接连接服务器端数据库,链接账户信息】;

     不通过SQL注入,但需要指定身份认证信息、IP、端口,可直接查看数据库信息;

2、与burpsuite、Google结合使用,支持正则表达式限定测试目标;

3、Get、Post、Cookie、Referer、User-Agent(随机或指定);

      支持扫描身份认证后的web application,认证成功后,服务器会返回cookie,SQLmap智能,Cookie过期后会自动处理Set-Cookie头、更新Cookie信息【不用担心扫描过程中,cookie过期】

4、限速:最大并发、延迟发送;

5、支持Basic,Digeset,NTLM,CA身份认证;

6、数据库版本、用户、权限、hash枚举和字典破解、暴力破解表列名称;

7、文件上传下载、UDF、启动并执行存储过程、操作系统命令执行、访问windows注册表;

8、与W3af、metasploit集成结合使用,基于数据库服务进程提权和上传执行后门;

5. SQLmap安装

【kali已集成,随kali库更新而更新】

其他linux系统安装

  • apt-get install git
  • git clone https://github.com/sqlmapproject/sqlmap.git

升级

  • sqlmap --update         #在线更新
  • git clone https://github.com/sqlmapproject/sqlmap.git          #离线更新
  • git pull                                                                        

6. SQLmap自动注入01——Target

sqlmap的功能主要包括七大类,在下面的介绍中主要介绍第一类Target,后续文章中会介绍其他类的功能;

6.1> 功能详情

sqlmap –h              #常用参数列表

root@root:~# sqlmap -h
        ___
       __H__
 ___ ___[']_____ ___ ___  {1.2.3#stable}
|_ -| . [']     | .'| . |
|___|_  [)]_|_|_|__,|  _|
      |_|V          |_|   http://sqlmap.org

Usage: python sqlmap [options]

Options:
  -h, --help            Show basic help message and exit
  -hh                   Show advanced help message and exit
  --version             Show program's version number and exit
  -v VERBOSE            Verbosity level: 0-6 (default 1)

  Target:
    At least one of these options has to be provided to define the
    target(s)

    -u URL, --url=URL   Target URL (e.g. "http://www.site.com/vuln.php?id=1")
    -g GOOGLEDORK       Process Google dork results as target URLs

  Request:
    These options can be used to specify how to connect to the target URL

    --data=DATA         Data string to be sent through POST
    --cookie=COOKIE     HTTP Cookie header value
    --random-agent      Use randomly selected HTTP User-Agent header value
    --proxy=PROXY       Use a proxy to connect to the target URL
    --tor               Use Tor anonymity network
    --check-tor         Check to see if Tor is used properly

  Injection:
    These options can be used to specify which parameters to test for,
    provide custom injection payloads and optional tampering scripts

    -p TESTPARAMETER    Testable parameter(s)
    --dbms=DBMS         Force back-end DBMS to this value

  Detection:
    These options can be used to customize the detection phase

    --level=LEVEL       Level of tests to perform (1-5, default 1)
    --risk=RISK         Risk of tests to perform (1-3, default 1)

  Techniques:
    These options can be used to tweak testing of specific SQL injection
    techniques

    --technique=TECH    SQL injection techniques to use (default "BEUSTQ")

  Enumeration:
    These options can be used to enumerate the back-end database
    management system information, structure and data contained in the
    tables. Moreover you can run your own SQL statements

    -a, --all           Retrieve everything
    -b, --banner        Retrieve DBMS banner
    --current-user      Retrieve DBMS current user
    --current-db        Retrieve DBMS current database
    --passwords         Enumerate DBMS users password hashes
    --tables            Enumerate DBMS database tables
    --columns           Enumerate DBMS database table columns
    --schema            Enumerate DBMS schema
    --dump              Dump DBMS database table entries
    --d
评论 17
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值