介绍
sqlmap is an open source penetration testing tool that automates the process of detecting and exploiting SQL injection flaws and taking over of database servers. It comes with a powerful detection engine, many niche features for the ultimate penetration tester and a broad range of switches lasting from database fingerprinting, over data fetching from the database, to accessing the underlying file system and executing commands on the operating system via out-of-band connections.(官网)
汉译:sqlmap是一个开源渗透测试工具,它可以自动检测和利用SQL注入缺陷并接管数据库服务器。它具有强大的检测引擎、许多适合于终极渗透测试器的小众功能,以及广泛的开关,从数据库指纹识别、从数据库获取数据,到访问底层文件系统,以及通过带外连接在操作系统上执行命令。
常见命令
sqlmap -u URL --current-db 查看当前数据库
sqlmap -u URL -D pentesterlab --tables 查看指定数据库里的所有表(pentesterlab是数据库名)
sqlmap -u URL -D pentesterlab -T flag --colum 查看指定数据库指定表下的所有字段(pentesterlab是数据库名,flag是表名)
sqlmap -u URL -D pentesterlab -T flag -C flag,id --dump 查看指定字段的值(flag是字段名)
sqlmap支持五种不同的注入模式:
l 基于布尔的盲注,即可以根据返回页面判断条件真假的注入;
l 基于时间的盲注,即不能根据页面返回内容判断任何信息,用条件语句查看时间延迟语句是否执行(即页面返回时间是否增加)来判断;
l 基于报错注入,即页面会返回错误信息,或者把注入的语句的结果直接返回在页面中;
l 联合查询注入,可以使用union的情况下的注入;
l 堆查询注入,可以同时执行多条语句的执行时的注入。